Este contenido no está disponible en el idioma seleccionado.
16.29. Property Interface
The Property interface defines methods for obtaining the name and property values:
@Immutable public interface Property extends Iterable<Object>, Comparable<Property>, Readable { /** * Get the name of the property. * * @return the property name; never null */ Name getName(); /** * Get the number of actual values in this property. * @return the number of actual values in this property; always non-negative */ int size(); /** * Determine whether the property currently has multiple values. * @return true if the property has multiple values, or false otherwise. */ boolean isMultiple(); /** * Determine whether the property currently has a single value. * @return true if the property has a single value, or false otherwise. */ boolean isSingle(); /** * Determine whether this property has no actual values. This method may return true * regardless of whether the property has a single value or multiple values. * This method is a convenience method that is equivalent to size() == 0. * @return true if this property has no values, or false otherwise */ boolean isEmpty(); /** * Obtain the property's first value in its natural form. This is equivalent to calling * isEmpty() ? null : iterator().next() * @return the first value, or null if the property is {@link #isEmpty() empty} */ Object getFirstValue(); /** * 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. * @return an iterator over the values; never null */ Iterator<?> getValues(); /** * Obtain the property's values as an array of objects in their natural form. * A valid iterator is returned if the property has single valued or multi-valued, or a * null value is returned if the property is {@link #isEmpty() empty}. * The resulting array is a copy, guaranteeing immutability for the property. * @return the array of values */ Object[] getValuesAsArray(); }
@Immutable
public interface Property extends Iterable<Object>, Comparable<Property>, Readable {
/**
* Get the name of the property.
*
* @return the property name; never null
*/
Name getName();
/**
* Get the number of actual values in this property.
* @return the number of actual values in this property; always non-negative
*/
int size();
/**
* Determine whether the property currently has multiple values.
* @return true if the property has multiple values, or false otherwise.
*/
boolean isMultiple();
/**
* Determine whether the property currently has a single value.
* @return true if the property has a single value, or false otherwise.
*/
boolean isSingle();
/**
* Determine whether this property has no actual values. This method may return true
* regardless of whether the property has a single value or multiple values.
* This method is a convenience method that is equivalent to size() == 0.
* @return true if this property has no values, or false otherwise
*/
boolean isEmpty();
/**
* Obtain the property's first value in its natural form. This is equivalent to calling
* isEmpty() ? null : iterator().next()
* @return the first value, or null if the property is {@link #isEmpty() empty}
*/
Object getFirstValue();
/**
* 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.
* @return an iterator over the values; never null
*/
Iterator<?> getValues();
/**
* Obtain the property's values as an array of objects in their natural form.
* A valid iterator is returned if the property has single valued or multi-valued, or a
* null value is returned if the property is {@link #isEmpty() empty}.
* The resulting array is a copy, guaranteeing immutability for the property.
* @return the array of values
*/
Object[] getValuesAsArray();
}