Class SelfAttribute<O>

  • All Implemented Interfaces:
    Attribute<O,​O>

    public class SelfAttribute<O>
    extends SimpleAttribute<O,​O>
    An attribute which returns the object itself.

    This can be useful when performing queries on objects in the collection itself (rather than on fields in the objects in the collection). Typical use case would be for performing startsWith queries on an IndexedCollection<String>.

    Author:
    Niall Gallagher
    • Constructor Detail

      • SelfAttribute

        public SelfAttribute​(Class<O> objectType,
                             String attributeName)
      • SelfAttribute

        public SelfAttribute​(Class<O> objectType)
    • Method Detail

      • getValue

        public O getValue​(O object,
                          QueryOptions queryOptions)
        Description copied from class: SimpleAttribute
        Returns the (non-null) value of the attribute from the object.

        Specified by:
        getValue in class SimpleAttribute<O,​O>
        Parameters:
        object - The object from which the value of the attribute is required
        queryOptions - Optional parameters supplied by the application along with the operation which is causing this attribute to be invoked (either a query, or an update to the collection)
        Returns:
        The value for the attribute, which should never be null