Class SimpleNullableAttribute<O,A>
- java.lang.Object
-
- com.googlecode.cqengine.attribute.support.AbstractAttribute<O,A>
-
- com.googlecode.cqengine.attribute.SimpleNullableAttribute<O,A>
-
- All Implemented Interfaces:
Attribute<O,A>
- Direct Known Subclasses:
FunctionalSimpleNullableAttribute
,SimpleNullableMapAttribute
public abstract class SimpleNullableAttribute<O,A> extends AbstractAttribute<O,A>
Represents an attribute in an object (such as a field) which can be null. Provides a method to read the value of the field given such an object.- Author:
- Niall Gallagher
- See Also:
SimpleAttribute
-
-
Constructor Summary
Constructors Constructor Description SimpleNullableAttribute()
Creates an attribute with no name.SimpleNullableAttribute(Class<O> objectType, Class<A> attributeType)
Creates an attribute with no name, and manually specifies the type of the attribute and its enclosing object.SimpleNullableAttribute(Class<O> objectType, Class<A> attributeType, String attributeName)
Creates an attribute with the given name, and manually specifies the type of the attribute and its enclosing object.SimpleNullableAttribute(String attributeName)
Creates an attribute with the given name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract A
getValue(O object, QueryOptions queryOptions)
Returns the (possibly null) value of the attribute from the object.Iterable<A>
getValues(O object, QueryOptions queryOptions)
Returns the values belonging to the attribute in the given object.-
Methods inherited from class com.googlecode.cqengine.attribute.support.AbstractAttribute
calcHashCode, canEqual, equals, getAttributeName, getAttributeType, getObjectType, hashCode, toString
-
-
-
-
Constructor Detail
-
SimpleNullableAttribute
public SimpleNullableAttribute(String attributeName)
Creates an attribute with the given name. This name is not actually used by the query engine except in providing informative exception and debug messages. As such it is recommended, but not required, that a name be provided. A suitable name might be the name of the field to which an attribute refers.- Parameters:
attributeName
- The name for this attribute- See Also:
SimpleNullableAttribute()
-
SimpleNullableAttribute
public SimpleNullableAttribute()
Creates an attribute with no name. A name for the attribute will be generated automatically from the name of the subclass (or anonymous class) which implements the attribute.- See Also:
SimpleNullableAttribute(String)
-
SimpleNullableAttribute
public SimpleNullableAttribute(Class<O> objectType, Class<A> attributeType)
Creates an attribute with no name, and manually specifies the type of the attribute and its enclosing object.- Parameters:
objectType
- The type of the object containing this attributeattributeType
- The type of this attribute
-
SimpleNullableAttribute
public SimpleNullableAttribute(Class<O> objectType, Class<A> attributeType, String attributeName)
Creates an attribute with the given name, and manually specifies the type of the attribute and its enclosing object.- Parameters:
objectType
- The type of the object containing this attributeattributeType
- The type of this attributeattributeName
- The name for this attribute
-
-
Method Detail
-
getValues
public Iterable<A> getValues(O object, QueryOptions queryOptions)
Returns the values belonging to the attribute in the given object. If the attribute is aSimpleAttribute
, the list returned will contain a single value for the attribute. If the attribute is aMultiValueAttribute
, the list returned will contain any number of values for the attribute.- Parameters:
object
- The object from which the values of the attribute are 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 values for the attribute in the given object
-
getValue
public abstract A getValue(O object, QueryOptions queryOptions)
Returns the (possibly null) value of the attribute from the object.- 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 can be null
-
-