org.jboss.dna.graph.property.basic
Class BasicProperty

java.lang.Object
  extended by org.jboss.dna.graph.property.basic.BasicProperty
All Implemented Interfaces:
Comparable<Property>, Iterable<Object>, Property, Readable
Direct Known Subclasses:
BasicEmptyProperty, BasicMultiValueProperty, BasicSingleValueProperty

@Immutable
public abstract class BasicProperty
extends Object
implements Property

An abstract Property implementation.


Constructor Summary
BasicProperty(Name name)
           
 
Method Summary
 int compareTo(Property that)
          
 boolean equals(Object obj)
          
 Name getName()
          Get the name of the property.
 String getString()
          Get the string form of the object.
 String getString(NamespaceRegistry namespaceRegistry)
          Get the string form of the object, using the supplied namespace registry to convert any namespace URIs to prefixes.
 String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder)
          Get the encoded string form of the object, using the supplied namespace registry to convert the any namespace URIs to prefixes.
 String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder, TextEncoder delimiterEncoder)
          Get the encoded string form of the object, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part of any names.
 String getString(TextEncoder encoder)
          Get the encoded string form of the object, using the supplied encoder to encode characters.
 Iterator<?> getValues()
          Obtain the property's values in their natural form.
 Object[] getValuesAsArray()
          Obtain the property's values as an array of objects in their natural form.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.dna.graph.property.Property
getFirstValue, isEmpty, isMultiple, isSingle, size
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

BasicProperty

public BasicProperty(Name name)
Parameters:
name -
Method Detail

getName

public Name getName()
Get the name of the property.

Specified by:
getName in interface Property
Returns:
the property name; never null

getValues

public Iterator<?> getValues()
Obtain the property's values in their natural form. This is equivalent to calling iterator().

A valid iterator is returned if the property has single valued or multi-valued.

The resulting iterator is immutable, and all property values are immutable.

Specified by:
getValues in interface Property
Returns:
an iterator over the values; never null
See Also:
Property.getFirstValue(), Iterable.iterator(), Property.getValuesAsArray(), ValueFactory.create(Iterator)

getValuesAsArray

public Object[] getValuesAsArray()
Obtain the property's values as an array of objects in their natural form.

A valid array is return if the property has single valued or multi-valued, or a null value is returned if the property is empty.

The resulting array is a copy, guaranteeing immutability for the property.

Specified by:
getValuesAsArray in interface Property
Returns:
the array of values
See Also:
Property.getFirstValue(), Iterable.iterator(), Property.getValues(), ValueFactory.create(Object[])

compareTo

public int compareTo(Property that)

Specified by:
compareTo in interface Comparable<Property>

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

getString

public String getString()
Get the string form of the object. A default encoder is used to encode characters.

Specified by:
getString in interface Readable
Returns:
the encoded string
See Also:
Readable.getString(TextEncoder)

getString

public String getString(TextEncoder encoder)
Get the encoded string form of the object, using the supplied encoder to encode characters.

Specified by:
getString in interface Readable
Parameters:
encoder - the encoder to use, or null if the default encoder should be used
Returns:
the encoded string
See Also:
Readable.getString()

getString

public String getString(NamespaceRegistry namespaceRegistry)
Get the string form of the object, using the supplied namespace registry to convert any namespace URIs to prefixes. A default encoder is used to encode characters.

Specified by:
getString in interface Readable
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for any namespace URIs
Returns:
the encoded string
See Also:
Readable.getString(NamespaceRegistry,TextEncoder)

getString

public String getString(NamespaceRegistry namespaceRegistry,
                        TextEncoder encoder)
Get the encoded string form of the object, using the supplied namespace registry to convert the any namespace URIs to prefixes.

Specified by:
getString in interface Readable
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URIs
encoder - the encoder to use, or null if the default encoder should be used
Returns:
the encoded string
See Also:
Readable.getString(NamespaceRegistry)

getString

public String getString(NamespaceRegistry namespaceRegistry,
                        TextEncoder encoder,
                        TextEncoder delimiterEncoder)
Get the encoded string form of the object, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part of any names.

Specified by:
getString in interface Readable
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URIs in the segment names
encoder - the encoder to use for encoding the local part and namespace prefix of any names, or null if the default encoder should be used
delimiterEncoder - the encoder to use for encoding the delimiter between the local part and namespace prefix of any names, or null if the standard delimiter should be used
Returns:
the encoded string
See Also:
Readable.getString(org.jboss.dna.graph.property.NamespaceRegistry, org.jboss.dna.common.text.TextEncoder, org.jboss.dna.common.text.TextEncoder)

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()


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