Class SelfAttribute<O>
- java.lang.Object
-
- com.googlecode.cqengine.attribute.support.AbstractAttribute<O,A>
-
- com.googlecode.cqengine.attribute.SimpleAttribute<O,O>
-
- com.googlecode.cqengine.attribute.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 performingstartsWith
queries on anIndexedCollection<String>
.- Author:
- Niall Gallagher
-
-
Constructor Summary
Constructors Constructor Description SelfAttribute(Class<O> objectType)
SelfAttribute(Class<O> objectType, String attributeName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description O
getValue(O object, QueryOptions queryOptions)
Returns the (non-null) value of the attribute from the object.static <O> SelfAttribute<O>
self(Class<O> type)
Deprecated.Use the equivalentQueryFactory.selfAttribute(Class)
method instead.-
Methods inherited from class com.googlecode.cqengine.attribute.SimpleAttribute
canEqual, getValues
-
Methods inherited from class com.googlecode.cqengine.attribute.support.AbstractAttribute
calcHashCode, equals, getAttributeName, getAttributeType, getObjectType, hashCode, toString
-
-
-
-
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 classSimpleAttribute<O,O>
- Parameters:
object
- The object from which the value of the attribute is requiredqueryOptions
- 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
-
self
@Deprecated public static <O> SelfAttribute<O> self(Class<O> type)
Deprecated.Use the equivalentQueryFactory.selfAttribute(Class)
method instead. This method will be removed in a future version of CQEngine.
-
-