org.modeshape.jcr.value.basic

## Class BasicMultiValueProperty

- java.lang.Object
- - org.modeshape.jcr.value.basic.BasicProperty
  - - org.modeshape.jcr.value.basic.BasicMultiValueProperty

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

      @Immutable
      public class BasicMultiValueProperty
      extends BasicProperty

  An immutable version of a property that has 2 or more values. 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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `BasicMultiValueProperty.ReadOnlyIterator`

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.value.Property

      `Property.ValueTypeTransformer<T>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicMultiValueProperty(Name name, List<Object> values)` Create a property with 2 or more values.
    `BasicMultiValueProperty(Name name, Object... values)` Create a property with 2 or more values.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getFirstValue()` Obtain the property's first value in its natural form.
    `Object` | `getValue(int index)` Returns the value of the property at the given index.
    `boolean` | `isBinary()` Determine whether this property is a binary property or not.
    `boolean` | `isEmpty()` Determine whether this property has no actual values.
    `boolean` | `isMultiple()` Determine whether the property currently has multiple values.
    `boolean` | `isReference()` Determine whether this property contains reference values, based upon the first value in the property.
    `boolean` | `isSimpleReference()` Determine whether this property contains simple reference values, based upon the first value in the property.
    `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.jcr.value.basic.BasicProperty

      `compareTo, equals, getName, getString, getString, getString, getString, getString, getValues, getValuesAsArray, getValuesAsArray, getValuesAsArray, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicMultiValueProperty

          public BasicMultiValueProperty(Name name,
                                 List<Object> values)

      Create a property with 2 or more values. Note that the supplied list may be modifiable, as this object does not expose any means for modifying the contents.
      Parameters:
        `name` - the property name
        `values` - the property values
      Throws:
        `IllegalArgumentException` - if the values is null or does not have at least 2 values

    - #### BasicMultiValueProperty

          public BasicMultiValueProperty(Name name,
                                 Object... values)

      Create a property with 2 or more values.
      Parameters:
        `name` - the property name
        `values` - the property values
      Throws:
        `IllegalArgumentException` - if the values is null or does not have at least 2 values

  - ### Method Detail

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `Property`
      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()

      Description copied from interface: `Property`
      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()

      Description copied from interface: `Property`
      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()`

    - #### isReference

          public boolean isReference()

      Description copied from interface: `Property`
      Determine whether this property contains reference values, based upon the first value in the property. Note that `PropertyType.SIMPLEREFERENCE` properties *are not* treated as references in order to avoid setting the back-pointer.
      Returns:
        true if this property is a reference property, or false otherwise.

    - #### isSimpleReference

          public boolean isSimpleReference()

      Description copied from interface: `Property`
      Determine whether this property contains simple reference values, based upon the first value in the property.
      Returns:
        true if this property is a simple reference property, or false otherwise.
      See Also:
        `PropertyType.SIMPLEREFERENCE`

    - #### isBinary

          public boolean isBinary()

      Description copied from interface: `Property`
      Determine whether this property is a binary property or not.
      Returns:
        true if the property is a binary property, false otherwise.

    - #### size

          public int size()

      Description copied from interface: `Property`
      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()

      Description copied from interface: `Property`
      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:
        `Iterable.iterator()`, `Property.getValues()`, `Property.getValuesAsArray()`, `Property.isEmpty()`

    - #### iterator

          public Iterator<Object> iterator()

    - #### getValue

          public Object getValue(int index)
                          throws IndexOutOfBoundsException

      Description copied from interface: `Property`
      Returns the value of the property at the given index.
      Parameters:
        `index` - an `int` representing the index at which to retrieve the value. If the value is `0`, this is equivalent to calling `Property.getFirstValue()`
      Returns:
        the value of the property at the given index; may be `null` if the property is empty.
      Throws:
        `IndexOutOfBoundsException` - if the given index is outside the interval of values of the property.

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