Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.property.basic
Class BasicSingleValueProperty

    java.lang.Object
      org.modeshape.graph.property.basic.BasicProperty
          org.modeshape.graph.property.basic.BasicSingleValueProperty

All Implemented Interfaces:
  Serializable, Comparable<Property>, Iterable<Object>, Property, Readable

    @Immutable
    public class BasicSingleValueProperty

extends BasicProperty

An immutable version of a property that has exactly 1 value. This is done for efficiency of the in-memory representation, since many properties will have just a single value, while others will have multiple values.

See Also:
  Serialized Form

Nested Class Summary
`protected class` | `BasicSingleValueProperty.ValueIterator`

Field Summary
`protected Object` | `value`

Constructor Summary
`BasicSingleValueProperty(Name name, Object value)` Create a property with a single value

Method Summary
`Object` | `getFirstValue()` Obtain the property's first value in its natural form.
`boolean` | `isEmpty()` Determine whether this property has no actual values.
`boolean` | `isMultiple()` Determine whether the property currently has multiple values.
`boolean` | `isSingle()` Determine whether the property currently has a single value.
`Iterator<Object>` | `iterator()`
`int` | `size()` Get the number of actual values in this property.

Methods inherited from class org.modeshape.graph.property.basic.BasicProperty
`compareTo, equals, getName, getString, getString, getString, getString, getString, getValues, getValuesAsArray, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### value

    protected final Object value

Constructor Detail

### BasicSingleValueProperty

    public BasicSingleValueProperty(Name name,
                                    Object value)

  Create a property with a single value

  Parameters:
    `name` - the property name
    `value` - the property value (which may be null)

Method Detail

### isEmpty

    public boolean isEmpty()

  Determine whether this property has no actual values. This method may return `true` regardless of whether the property allows a `single value`, or `multiple values`.

  This method is a convenience method that is equivalent to `size() == 0`.

  Returns:
    true if this property has no values, or false otherwise
  See Also:
    `Property.isMultiple()`, `Property.isSingle()`

### isMultiple

    public boolean isMultiple()

  Determine whether the property currently has multiple values.

  Returns:
    true if the property has multiple values, or false otherwise.
  See Also:
    `Property.isSingle()`, `Property.isEmpty()`

### isSingle

    public boolean isSingle()

  Determine whether the property currently has a single value.

  Returns:
    true if the property has a single value, or false otherwise.
  See Also:
    `Property.isMultiple()`, `Property.isEmpty()`

### size

    public int size()

  Get the number of actual values in this property. If the property allows `multiple values`, then this method may return a value greater than 1. If the property only allows a `single value`, then this method will return either 0 or 1. This method may return 0 regardless of whether the property allows a `single value`, or `multiple values`.

  Returns:
    the number of actual values in this property; always non-negative

### getFirstValue

    public Object getFirstValue()

  Obtain the property's first value in its natural form. This is equivalent to calling `isEmpty() ? null : iterator().next()`

  Returns:
    the first value, or null if the property is `empty`
  See Also:
    `Property.getFirstValue()`

### iterator

    public Iterator<Object> iterator()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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