Class CategoryAttributeImpl
- java.lang.Object
-
- org.apache.lucene.util.AttributeImpl
-
- org.apache.lucene.facet.index.attributes.CategoryAttributeImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,CategoryAttribute,Attribute
public final class CategoryAttributeImpl extends AttributeImpl implements CategoryAttribute
An implementation ofCategoryAttribute.- See Also:
- Serialized Form
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected CategoryPathcategoryPathThe category path instance.protected HashMap<Class<? extends CategoryProperty>,CategoryProperty>propertiesA map of properties associated to the current category path.-
Fields inherited from class org.apache.lucene.util.AttributeImpl
enableBackwards
-
-
Constructor Summary
Constructors Constructor Description CategoryAttributeImpl()Construct an empty CategoryAttributeImpl.CategoryAttributeImpl(CategoryPath categoryPath)Construct a CategoryAttributeImpl with the given CategoryPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperty(CategoryProperty property)Add a property.voidclear()Clears the values in this AttributeImpl and resets it to its default value.voidclearProperties()Clear all properties.CategoryAttributeclone()Shallow clone.voidcopyTo(AttributeImpl target)Copies the values from this Attribute into the passed-in target attribute.booleanequals(Object o)CategoryPathgetCategoryPath()Returns the category path value.CategoryPropertygetProperty(Class<? extends CategoryProperty> propertyClass)Get a property of a certain property class.CategoryPropertygetProperty(Collection<Class<? extends CategoryProperty>> propertyClasses)Get a property of one of given property classes.Set<Class<? extends CategoryProperty>>getPropertyClasses()Get all the active property classes.inthashCode()voidremove(Class<? extends CategoryProperty> propertyClass)Remove an property of a certain property class.voidset(CategoryAttribute other)Set the content of thisCategoryAttributefrom anotherCategoryAttributeobject.voidsetCategoryPath(CategoryPath cp)Sets the category path value of this attribute.-
Methods inherited from class org.apache.lucene.util.AttributeImpl
reflectAsString, reflectWith, toString
-
-
-
-
Field Detail
-
categoryPath
protected CategoryPath categoryPath
The category path instance.
-
properties
protected HashMap<Class<? extends CategoryProperty>,CategoryProperty> properties
A map of properties associated to the current category path.
-
-
Constructor Detail
-
CategoryAttributeImpl
public CategoryAttributeImpl()
Construct an empty CategoryAttributeImpl.
-
CategoryAttributeImpl
public CategoryAttributeImpl(CategoryPath categoryPath)
Construct a CategoryAttributeImpl with the given CategoryPath.- Parameters:
categoryPath- The category path to use.
-
-
Method Detail
-
set
public void set(CategoryAttribute other)
Description copied from interface:CategoryAttributeSet the content of thisCategoryAttributefrom anotherCategoryAttributeobject.- Specified by:
setin interfaceCategoryAttribute- Parameters:
other- TheCategoryAttributeto take the content from.
-
getCategoryPath
public CategoryPath getCategoryPath()
Returns the category path value.- Specified by:
getCategoryPathin interfaceCategoryAttribute- Returns:
- The category path last assigned to this attribute, or null if none has been assigned.
-
setCategoryPath
public void setCategoryPath(CategoryPath cp)
Description copied from interface:CategoryAttributeSets the category path value of this attribute.- Specified by:
setCategoryPathin interfaceCategoryAttribute- Parameters:
cp- A category path. May not be null.
-
addProperty
public void addProperty(CategoryProperty property) throws UnsupportedOperationException
Description copied from interface:CategoryAttributeAdd a property. The property can be later retrieved usingCategoryAttribute.getProperty(Class)with this property class .
Adding multiple properties of the same class is forbidden.- Specified by:
addPropertyin interfaceCategoryAttribute- Parameters:
property- The property to add.- Throws:
UnsupportedOperationException- When attempting to add a property of a class that was added before and merge is prohibited.
-
getProperty
public CategoryProperty getProperty(Class<? extends CategoryProperty> propertyClass)
Description copied from interface:CategoryAttributeGet a property of a certain property class.- Specified by:
getPropertyin interfaceCategoryAttribute- Parameters:
propertyClass- The required property class.- Returns:
- The property of the given class, or null if no such property exists.
-
getProperty
public CategoryProperty getProperty(Collection<Class<? extends CategoryProperty>> propertyClasses)
Description copied from interface:CategoryAttributeGet a property of one of given property classes.- Specified by:
getPropertyin interfaceCategoryAttribute- Parameters:
propertyClasses- The property classes.- Returns:
- A property matching one of the given classes, or null if no such property exists.
-
copyTo
public void copyTo(AttributeImpl target)
Description copied from class:AttributeImplCopies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.- Specified by:
copyToin classAttributeImpl
-
clone
public CategoryAttribute clone()
Description copied from class:AttributeImplShallow clone. Subclasses must override this if they need to clone any members deeply,- Specified by:
clonein interfaceCategoryAttribute- Overrides:
clonein classAttributeImpl- Returns:
- A clone of this
CategoryAttribute.
-
clear
public void clear()
Description copied from class:AttributeImplClears the values in this AttributeImpl and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.- Specified by:
clearin interfaceCategoryAttribute- Specified by:
clearin classAttributeImpl
-
clearProperties
public void clearProperties()
Description copied from interface:CategoryAttributeClear all properties.- Specified by:
clearPropertiesin interfaceCategoryAttribute
-
getPropertyClasses
public Set<Class<? extends CategoryProperty>> getPropertyClasses()
Description copied from interface:CategoryAttributeGet all the active property classes.- Specified by:
getPropertyClassesin interfaceCategoryAttribute- Returns:
- A set containing the active property classes, or
nullif there are no properties.
-
remove
public void remove(Class<? extends CategoryProperty> propertyClass)
Description copied from interface:CategoryAttributeRemove an property of a certain property class.- Specified by:
removein interfaceCategoryAttribute- Parameters:
propertyClass- The required property class.
-
-