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

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

@Immutable
public abstract class BasicProperty
extends Object
implements Property

Author:
Randall Hauch

Constructor Summary
BasicProperty(Name name)
           
 
Method Summary
 int compareTo(Property o)
          
 boolean equals(Object obj)
          
 Name getName()
          Get the name of the property.
 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.properties.Property
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:
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:
Iterable.iterator(), Property.getValues(), ValueFactory.create(Object[])

compareTo

public int compareTo(Property o)

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

toString

public String toString()

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


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