T
- the property type@Immutable public abstract class AbstractValueFactory<T> extends Object implements ValueFactory<T>
ValueFactory
.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractValueFactory.ConvertingIterator<ValueType> |
Modifier and Type | Field and Description |
---|---|
protected TextDecoder |
decoder |
protected PropertyType |
propertyType |
protected ValueFactories |
valueFactories |
DEFAULT_DECODER, DEFAULT_ENCODER
Modifier | Constructor and Description |
---|---|
protected |
AbstractValueFactory(PropertyType type,
TextDecoder decoder,
ValueFactories valueFactories) |
Modifier and Type | Method and Description |
---|---|
T[] |
create(BigDecimal[] values)
Create an array of values from an array of decimal values.
|
T[] |
create(BinaryValue[] values)
Create an array of values from the array of binary objects.
|
T[] |
create(boolean[] values)
Create an array of values from an array of booleans.
|
T[] |
create(byte[][] values)
Create an array of values from the array of binary content.
|
T[] |
create(Calendar[] values)
Create an array of values from an array of Calendar instances.
|
T[] |
create(Date[] values)
Create an array of values from an array of dates.
|
T[] |
create(DateTime[] values)
Create an array of values from an array of
DateTime instants. |
T[] |
create(double[] values)
Create an array of values from an array of doubles.
|
T[] |
create(float[] values)
Create an array of values from an array of floats.
|
T |
create(InputStream stream,
String hint)
Create a value from the binary content given by the supplied stream with a hint to the BinaryStore for how to store it
|
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[] values)
Create an array of values from an array of longs.
|
T[] |
create(Name[] values)
Create an array of values from an array of names.
|
T[] |
create(NodeKey[] values)
Create an array of values from an array of
NodeKey . |
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[] values)
Create an array of values from an array of paths.
|
T[] |
create(Reference[] values)
Create an array of values from an array of references.
|
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(URI[] values)
Create an array of values from an array of URIs.
|
T[] |
create(UUID[] values)
Create an array of values from an array of UUIDs.
|
TextDecoder |
getDecoder()
Get the text decoder.
|
protected TextDecoder |
getDecoder(TextDecoder decoder)
Utility method to obtain either the supplied decoder (if not null) or this factory's
decoder . |
PropertyType |
getPropertyType()
Get the
type of values created by this factory. |
protected ValueFactory<String> |
getStringValueFactory() |
protected final TextDecoder decoder
protected final PropertyType propertyType
protected final ValueFactories valueFactories
protected AbstractValueFactory(PropertyType type, TextDecoder decoder, ValueFactories valueFactories)
protected ValueFactory<String> getStringValueFactory()
public TextDecoder getDecoder()
protected TextDecoder getDecoder(TextDecoder decoder)
decoder
.decoder
- the decoder, which may be null if this factory's is to be used
public PropertyType getPropertyType()
ValueFactory
type
of values created by this factory.getPropertyType
in interface ValueFactory<T>
public T create(Object value)
ValueFactory
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 ValueFactory.create(InputStream)
and ValueFactory.create(String, TextDecoder)
.create
in interface ValueFactory<T>
value
- the valuepublic T[] create(BigDecimal[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the decimals from which the values are to be createdpublic T[] create(boolean[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the booleans from which the values are to be createdpublic T[] create(byte[][] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the array of content to be used to create the valuespublic T[] create(Calendar[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the Calendar instances from which the values are to be createdpublic T[] create(Date[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the dates from which the values are to be createdpublic T[] create(DateTime[] values) throws ValueFormatException
ValueFactory
DateTime
instants.create
in interface ValueFactory<T>
values
- the instants from which the values are to be createdValueFormatException
- if the conversion from an array of date values could not be performedpublic T[] create(double[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the doubles from which the values are to be createdpublic T[] create(float[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the floats from which the values are to be createdpublic T[] create(int[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the integers from which the values are to be createdpublic T[] create(long[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the longs from which the values are to be createdpublic T[] create(Name[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the names from which the values are to be createdpublic T[] create(Object[] values)
ValueFactory
create
method applies for
each object and then delegating to that method. Note that this method will not consider ValueFactory.create(InputStream)
and
ValueFactory.create(String, TextDecoder)
.create
in interface ValueFactory<T>
values
- the valuespublic T[] create(Path[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the paths from which the values are to be createdpublic T[] create(Reference[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the references from which the values are to be createdpublic T[] create(String[] values, TextDecoder decoder)
ValueFactory
create
in interface ValueFactory<T>
values
- the string values from which the values are to be createddecoder
- the decoder that should be used; if null, the default decoder
is usedValueFactory.create(String)
public T[] create(String[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the valuesValueFactory.create(String[], TextDecoder)
public T[] create(URI[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the URIs from which the values are to be createdpublic T[] create(UUID[] values)
ValueFactory
create
in interface ValueFactory<T>
values
- the UUIDs from which the values are to be createdpublic T[] create(NodeKey[] values) throws ValueFormatException
ValueFactory
NodeKey
.create
in interface ValueFactory<T>
values
- the node key from which the value is to be createdValueFormatException
- if the conversion from a NodeKey could not be performedpublic T[] create(BinaryValue[] values) throws ValueFormatException, IoException
ValueFactory
create
in interface ValueFactory<T>
values
- the valuesValueFormatException
- if the conversion from an array of objects could not be performedIoException
- If an unexpected problem occurs during the conversion.public Iterator<T> create(Iterator<?> values) throws ValueFormatException, IoException
ValueFactory
ValueFactory.create(InputStream)
and ValueFactory.create(String, TextDecoder)
.
This is useful to use when iterating over the values
of a Property
.
create
in interface ValueFactory<T>
values
- the valuesT
over the values, or null if the supplied parameter is nullValueFormatException
- if the conversion from an iterator of objects could not be performedIoException
- If an unexpected problem occurs during the conversion.Property.getValues()
public Iterable<T> create(Iterable<?> valueIterable) throws ValueFormatException, IoException
ValueFactory
ValueFactory.create(InputStream)
and ValueFactory.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)) { ... }
create
in interface ValueFactory<T>
valueIterable
- the valuesT
over the values, or null if the supplied parameter is nullValueFormatException
- if the conversion from an iterator of objects could not be performedIoException
- If an unexpected problem occurs during the conversion.Property.getValues()
public T create(InputStream stream, String hint) throws ValueFormatException, IoException
ValueFactory
create
in interface ValueFactory<T>
stream
- the stream containing the content to be used to create the valuehint
- a hint that the BinaryStore may use to make storage decisions about this input streamValueFormatException
- if the conversion from an input stream could not be performedIoException
- If an unexpected problem occurs while accessing the supplied stream (such as an IOException
).Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.