|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of value to create@ThreadSafe public interface ValueFactory<T>
A factory for Property
values. Each create method may throw one of these exceptions when attempting to convert a
supplied value to the factory's type
:
IllegalArgumentException
- If the supplied value is invalid in respect to the conversion being attempted.UnsupportedOperationException
- If a conversion from the supplied value is not supported.IoException
- If an unexpected problem occurs during the conversion (such as an IOException
).
Field Summary | |
---|---|
static TextDecoder |
DEFAULT_DECODER
|
static TextEncoder |
DEFAULT_ENCODER
|
Method Summary | |
---|---|
T |
create(BigDecimal value)
Create a value from a decimal. |
T[] |
create(BigDecimal[] values)
Create an array of values from an array of decimal values. |
T |
create(Binary value)
Create a value from the binary content given by the supplied stream. |
T[] |
create(Binary[] values)
Create an array of values from the array of binary objects. |
T |
create(boolean value)
Create a boolean from a string. |
T[] |
create(boolean[] values)
Create an array of values from an array of booleans. |
T |
create(byte[] value)
Create a value from the binary content given by the supplied array. |
T[] |
create(byte[][] values)
Create an array of values from the array of binary content. |
T |
create(Calendar value)
Create a value from a Calendar instance. |
T[] |
create(Calendar[] values)
Create an array of values from an array of Calendar instances. |
T |
create(Date value)
Create a value from a date. |
T[] |
create(Date[] values)
Create an array of values from an array of dates. |
T |
create(DateTime value)
Create a value from a date-time instant. |
T[] |
create(DateTime[] values)
Create an array of values from an array of DateTime instants. |
T |
create(double value)
Create a value from a double. |
T[] |
create(double[] values)
Create an array of values from an array of doubles. |
T |
create(float value)
Create a value from a float. |
T[] |
create(float[] values)
Create an array of values from an array of floats. |
T |
create(InputStream stream,
long approximateLength)
Create a value from the binary content given by the supplied stream. |
T |
create(int value)
Create a value from an integer. |
T[] |
create(int[] values)
Create an array of values from an array of integers. |
Iterable<T> |
create(Iterable<?> valueIterable)
Create an iterable with the values (of an unknown type). |
Iterator<T> |
create(Iterator<?> values)
Create an iterator over the values (of an unknown type). |
T |
create(long value)
Create a long from a string. |
T[] |
create(long[] values)
Create an array of values from an array of longs. |
T |
create(Name value)
Create a value from a name. |
T[] |
create(Name[] values)
Create an array of values from an array of names. |
T |
create(Object value)
Create a value from the specified information by determining which other create method applies and delegating
to that method. |
T[] |
create(Object[] values)
Create an array of values from the specified information by determining which other create method applies for
each object and then delegating to that method. |
T |
create(Path.Segment value)
Create a value from a path segment. |
T |
create(Path value)
Create a value from a path. |
T[] |
create(Path[] values)
Create an array of values from an array of paths. |
T |
create(Reader reader,
long approximateLength)
Create a value from a the binary content given by the supplied reader. |
T |
create(Reference value)
Create a value from a reference. |
T[] |
create(Reference[] values)
Create an array of values from an array of references. |
T |
create(String value)
Create a value from a string, using no decoding. |
T[] |
create(String[] values)
Create an array of values from an array of string values, using no decoding. |
T[] |
create(String[] values,
TextDecoder decoder)
Create an array of values from an array of strings, using the supplied decoder. |
T |
create(String value,
TextDecoder decoder)
Create a value from a string, using the supplied decoder. |
T |
create(URI value)
Create a value from a URI. |
T[] |
create(URI[] values)
Create an array of values from an array of URIs. |
T |
create(UUID value)
Create a value from a UUID. |
T[] |
create(UUID[] values)
Create an array of values from an array of UUIDs. |
PropertyType |
getPropertyType()
Get the type of values created by this factory. |
Field Detail |
---|
static final TextDecoder DEFAULT_DECODER
static final TextEncoder DEFAULT_ENCODER
Method Detail |
---|
PropertyType getPropertyType()
type
of values created by this factory.
T create(String value) throws ValueFormatException
value
- the string from which the value is to be created
ValueFormatException
- if the conversion from a string could not be performedcreate(String, TextDecoder)
T create(String value, TextDecoder decoder) throws ValueFormatException
value
- the string from which the value is to be createddecoder
- the decoder that should be used; if null, the default decoder
is used
ValueFormatException
- if the conversion from a string could not be performedcreate(String)
T create(int value) throws ValueFormatException
value
- the integer from which the value is to be created
ValueFormatException
- if the conversion from an integer could not be performedT create(long value) throws ValueFormatException
value
- the string from which the long is to be created
ValueFormatException
- if the conversion from a long could not be performedT create(boolean value) throws ValueFormatException
value
- the boolean from which the value is to be created
ValueFormatException
- if the conversion from a boolean could not be performedT create(float value) throws ValueFormatException
value
- the float from which the value is to be created
ValueFormatException
- if the conversion from a float could not be performedT create(double value) throws ValueFormatException
value
- the double from which the value is to be created
ValueFormatException
- if the conversion from a double could not be performedT create(BigDecimal value) throws ValueFormatException
value
- the decimal from which the value is to be created
ValueFormatException
- if the conversion from a decimal could not be performedT create(Calendar value) throws ValueFormatException
value
- the Calendar instance from which the value is to be created
ValueFormatException
- if the conversion from a Calendar could not be performedT create(Date value) throws ValueFormatException
value
- the date from which the value is to be created
ValueFormatException
- if the conversion from a Date could not be performedT create(DateTime value) throws ValueFormatException
value
- the date-time instant from which the value is to be created
ValueFormatException
- if the conversion from a Date could not be performedT create(Name value) throws ValueFormatException
value
- the name from which the value is to be created
ValueFormatException
- if the conversion from a name could not be performedT create(Path value) throws ValueFormatException
value
- the path from which the value is to be created
ValueFormatException
- if the conversion from a path could not be performedT create(Path.Segment value) throws ValueFormatException
value
- the path segment from which the value is to be created
ValueFormatException
- if the conversion from a path could not be performedT create(Reference value) throws ValueFormatException
value
- the reference from which the value is to be created
ValueFormatException
- if the conversion from a reference could not be performedT create(URI value) throws ValueFormatException
value
- the URI from which the value is to be created
ValueFormatException
- if the conversion from a URI could not be performedT create(UUID value) throws ValueFormatException
value
- the UUID from which the value is to be created
ValueFormatException
- if the conversion from a UUID could not be performedT create(byte[] value) throws ValueFormatException
value
- the content to be used to create the value
ValueFormatException
- if the conversion from a byte array could not be performedT create(Binary value) throws ValueFormatException, IoException
value
- the binary object to be used to create the value
ValueFormatException
- if the conversion from the binary object could not be performed
IoException
- If an unexpected problem occurs while accessing the supplied binary value (such as an
IOException
).T create(InputStream stream, long approximateLength) throws ValueFormatException, IoException
stream
- the stream containing the content to be used to create the valueapproximateLength
- the approximate length of the content (in bytes)
ValueFormatException
- if the conversion from an input stream could not be performed
IoException
- If an unexpected problem occurs while accessing the supplied stream (such as an IOException
).T create(Reader reader, long approximateLength) throws ValueFormatException, IoException
reader
- the reader containing the content to be used to create the valueapproximateLength
- the approximate length of the content (in bytes)
ValueFormatException
- if the conversion from a reader could not be performed
IoException
- If an unexpected problem occurs while accessing the supplied reader (such as an IOException
).T create(Object value) throws ValueFormatException, IoException
create
method applies and delegating
to that method. Note that this method only will call create
methods that take a single parameter; so this
excludes create(InputStream, long)
, create(Reader, long)
and create(String, TextDecoder)
.
value
- the value
ValueFormatException
- if the conversion from an object could not be performed
IoException
- If an unexpected problem occurs while accessing the supplied binary value (such as an
IOException
).T[] create(String[] values) throws ValueFormatException
values
- the values
ValueFormatException
- if the conversion from a string array could not be performedcreate(String[], TextDecoder)
T[] create(String[] values, TextDecoder decoder) throws ValueFormatException
values
- the string values from which the values are to be createddecoder
- the decoder that should be used; if null, the default decoder
is used
ValueFormatException
- if the conversion from a string array could not be performedcreate(String)
T[] create(int[] values) throws ValueFormatException
values
- the integers from which the values are to be created
ValueFormatException
- if the conversion from an integer array could not be performedT[] create(long[] values) throws ValueFormatException
values
- the longs from which the values are to be created
ValueFormatException
- if the conversion from an array of longs could not be performedT[] create(boolean[] values) throws ValueFormatException
values
- the booleans from which the values are to be created
ValueFormatException
- if the conversion from an array of booleans could not be performedT[] create(float[] values) throws ValueFormatException
values
- the floats from which the values are to be created
ValueFormatException
- if the conversion from an array of floats could not be performedT[] create(double[] values) throws ValueFormatException
values
- the doubles from which the values are to be created
ValueFormatException
- if the conversion from an array of doubles could not be performedT[] create(BigDecimal[] values) throws ValueFormatException
values
- the decimals from which the values are to be created
ValueFormatException
- if the conversion from an array of decimal values could not be performedT[] create(Calendar[] values) throws ValueFormatException
values
- the Calendar instances from which the values are to be created
ValueFormatException
- if the conversion from an array of calendar instances could not be performedT[] create(Date[] values) throws ValueFormatException
values
- the dates from which the values are to be created
ValueFormatException
- if the conversion from an array of date values could not be performedT[] create(DateTime[] values) throws ValueFormatException
DateTime
instants.
values
- the instants from which the values are to be created
ValueFormatException
- if the conversion from an array of date values could not be performedT[] create(Name[] values) throws ValueFormatException
values
- the names from which the values are to be created
ValueFormatException
- if the conversion from an array of names could not be performedT[] create(Path[] values) throws ValueFormatException
values
- the paths from which the values are to be created
ValueFormatException
- if the conversion from an array of paths could not be performedT[] create(Reference[] values) throws ValueFormatException
values
- the references from which the values are to be created
ValueFormatException
- if the conversion from an array of references could not be performedT[] create(URI[] values) throws ValueFormatException
values
- the URIs from which the values are to be created
ValueFormatException
- if the conversion from an array of URIs could not be performedT[] create(UUID[] values) throws ValueFormatException
values
- the UUIDs from which the values are to be created
ValueFormatException
- if the conversion from an array of UUIDs could not be performedT[] create(byte[][] values) throws ValueFormatException
values
- the array of content to be used to create the values
ValueFormatException
- if the conversion from an array of byte arrays could not be performedT[] create(Binary[] values) throws ValueFormatException, IoException
values
- the values
ValueFormatException
- if the conversion from an array of objects could not be performed
IoException
- If an unexpected problem occurs during the conversion.T[] create(Object[] values) throws ValueFormatException, IoException
create
method applies for
each object and then delegating to that method. Note that this method will not consider create(InputStream, long)
,
create(Reader, long)
and create(String, TextDecoder)
.
values
- the values
ValueFormatException
- if the conversion from an array of objects could not be performed
IoException
- If an unexpected problem occurs during the conversion.Iterator<T> create(Iterator<?> values) throws ValueFormatException, IoException
create(InputStream, long)
, create(Reader, long)
and
create(String, TextDecoder)
.
This is useful to use when iterating over the values
of a Property
.
values
- the values
T
over the values, or null if the supplied parameter is null
ValueFormatException
- if the conversion from an iterator of objects could not be performed
IoException
- If an unexpected problem occurs during the conversion.Property.getValues()
Iterable<T> create(Iterable<?> valueIterable) throws ValueFormatException, IoException
create(InputStream, long)
, create(Reader, long)
and
create(String, TextDecoder)
.
This is useful to use when converting all the values
of a Property
.
Property property = ... ExecutionContext executionContext = ... ValueFactory<String> stringFactory = executionContext.getValueFactories().getStringFactory(); for (String token : stringFactory.create(property)) { ... }
valueIterable
- the values
T
over the values, or null if the supplied parameter is null
ValueFormatException
- if the conversion from an iterator of objects could not be performed
IoException
- If an unexpected problem occurs during the conversion.Property.getValues()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |