org.jboss.dna.graph.property.basic
Class AbstractValueFactory<T>

java.lang.Object
  extended by org.jboss.dna.graph.property.basic.AbstractValueFactory<T>
Type Parameters:
T - the property type
All Implemented Interfaces:
ValueFactory<T>
Direct Known Subclasses:
AbstractBinaryValueFactory, BooleanValueFactory, DecimalValueFactory, DoubleValueFactory, JodaDateTimeValueFactory, LongValueFactory, NameValueFactory, ObjectValueFactory, PathValueFactory, StringValueFactory, UriValueFactory, UuidReferenceValueFactory, UuidValueFactory

@Immutable
public abstract class AbstractValueFactory<T>
extends Object
implements ValueFactory<T>

Abstract ValueFactory.


Field Summary
 
Fields inherited from interface org.jboss.dna.graph.property.ValueFactory
DEFAULT_DECODER, DEFAULT_ENCODER
 
Method Summary
 T[] create(BigDecimal[] values)
          Create an array of values from an array of decimal values.
 T[] create(Binary[] 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(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(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.
 PropertyType getPropertyType()
          Get the type of values created by this factory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.dna.graph.property.ValueFactory
create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create
 

Method Detail

getDecoder

public TextDecoder getDecoder()
Get the text decoder.

Returns:
the decoder

getPropertyType

public PropertyType getPropertyType()
Get the type of values created by this factory.

Specified by:
getPropertyType in interface ValueFactory<T>
Returns:
the value type; never null

create

public T create(Object value)
Create a value from the specified information by determining which other 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, long), ValueFactory.create(Reader, long) and ValueFactory.create(String, TextDecoder).

Specified by:
create in interface ValueFactory<T>
Parameters:
value - the value
Returns:
the new value, or null if the supplied parameter is null

create

public T[] create(BigDecimal[] values)
Create an array of values from an array of decimal values.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the decimals from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(boolean[] values)
Create an array of values from an array of booleans.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the booleans from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(byte[][] values)
Create an array of values from the array of binary content.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the array of content to be used to create the values
Returns:
the value, or null if the supplied array is null

create

public T[] create(Calendar[] values)
Create an array of values from an array of Calendar instances.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the Calendar instances from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(Date[] values)
Create an array of values from an array of dates.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the dates from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(DateTime[] values)
           throws ValueFormatException
Create an array of values from an array of DateTime instants.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the instants from which the values are to be created
Returns:
the values, or null if the supplied array is null
Throws:
ValueFormatException - if the conversion from an array of date values could not be performed
See Also:
ValueFactory.create(org.jboss.dna.graph.property.DateTime[])

create

public T[] create(double[] values)
Create an array of values from an array of doubles.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the doubles from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(float[] values)
Create an array of values from an array of floats.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the floats from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(int[] values)
Create an array of values from an array of integers.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the integers from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(long[] values)
Create an array of values from an array of longs.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the longs from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(Name[] values)
Create an array of values from an array of names.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the names from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public 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. Note that this method will not consider ValueFactory.create(InputStream, long), ValueFactory.create(Reader, long) and ValueFactory.create(String, TextDecoder).

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the values
Returns:
the new value, or null if the supplied parameter is null

create

public T[] create(Path[] values)
Create an array of values from an array of paths.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the paths from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(Reference[] values)
Create an array of values from an array of references.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the references from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(String[] values,
                  TextDecoder decoder)
Create an array of values from an array of strings, using the supplied decoder.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the string values from which the values are to be created
decoder - the decoder that should be used; if null, the default decoder is used
Returns:
the value, or null if the supplied string is null
See Also:
ValueFactory.create(String)

create

public T[] create(String[] values)
Create an array of values from an array of string values, using no decoding.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the values
Returns:
the values, or null if the supplied string is null
See Also:
ValueFactory.create(String[], TextDecoder)

create

public T[] create(URI[] values)
Create an array of values from an array of URIs.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the URIs from which the values are to be created
Returns:
the values, or null if the supplied array is null

create

public T[] create(UUID[] values)
Create an array of values from an array of UUIDs.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the UUIDs from which the values are to be created
Returns:
the values, or null if the supplied array is null
See Also:
ValueFactory.create(java.util.UUID[])

create

public T[] create(Binary[] values)
           throws ValueFormatException,
                  IoException
Create an array of values from the array of binary objects.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the values
Returns:
the new value, or null if the supplied parameter is null
Throws:
ValueFormatException - if the conversion from an array of objects could not be performed
IoException - If an unexpected problem occurs during the conversion.
See Also:
ValueFactory.create(org.jboss.dna.graph.property.Binary[])

create

public Iterator<T> create(Iterator<?> values)
                   throws ValueFormatException,
                          IoException
Create an iterator over the values (of an unknown type). The factory converts any values as required. Note that this method will not consider ValueFactory.create(InputStream, long), ValueFactory.create(Reader, long) and ValueFactory.create(String, TextDecoder).

This is useful to use when iterating over the values of a Property.

Specified by:
create in interface ValueFactory<T>
Parameters:
values - the values
Returns:
the iterator of type T over the values, or null if the supplied parameter is null
Throws:
ValueFormatException - if the conversion from an iterator of objects could not be performed
IoException - If an unexpected problem occurs during the conversion.
See Also:
ValueFactory.create(java.util.Iterator)

create

public Iterable<T> create(Iterable<?> valueIterable)
                   throws ValueFormatException,
                          IoException
Create an iterable with the values (of an unknown type). The factory converts any values as required. Note that this method will not consider ValueFactory.create(InputStream, long), ValueFactory.create(Reader, long) and ValueFactory.create(String, TextDecoder).

This is useful to use when converting all the values of a Property.

Example:
      Property property = ...
      ExecutionContext executionContext = ...
      ValueFactory<String> stringFactory = executionContext.getValueFactories().getStringFactory();
      for (String token : stringFactory.create(property)) {
          ...
      }
 

Specified by:
create in interface ValueFactory<T>
Parameters:
valueIterable - the values
Returns:
the iterator of type T over the values, or null if the supplied parameter is null
Throws:
ValueFormatException - if the conversion from an iterator of objects could not be performed
IoException - If an unexpected problem occurs during the conversion.
See Also:
ValueFactory.create(java.lang.Iterable)


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.