## org.apache.lucene.facet.index.attributes
Class CategoryAttributeImpl

    java.lang.Object
      org.apache.lucene.util.AttributeImpl
          org.apache.lucene.facet.index.attributes.CategoryAttributeImpl

All Implemented Interfaces:
  Serializable, Cloneable, CategoryAttribute, org.apache.lucene.util.Attribute

    public final class CategoryAttributeImpl

extends org.apache.lucene.util.AttributeImpl
implements CategoryAttribute

An implementation of `CategoryAttribute`.

See Also:
  Serialized Form
WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
`protected CategoryPath` `categoryPath` The category path instance.
`protected HashMap<Class<? extends CategoryProperty>,CategoryProperty>` `properties` A map of properties associated to the current category path.

Fields inherited from class org.apache.lucene.util.AttributeImpl
`enableBackwards`

Constructor Summary
`CategoryAttributeImpl()` Construct an empty CategoryAttributeImpl.
`CategoryAttributeImpl(CategoryPath categoryPath)` Construct a CategoryAttributeImpl with the given CategoryPath.

Method Summary
`void` `addProperty(CategoryProperty property)` Add a property.
`void` `clear()` Resets this attribute to its initial value: a null category path and no properties.
`void` `clearProperties()` Clear all properties.
`CategoryAttribute` `clone()` Clone this `CategoryAttribute`.
`void` `copyTo(org.apache.lucene.util.AttributeImpl target)`
`boolean` `equals(Object o)`
`CategoryPath` `getCategoryPath()` Returns the category path value.
`CategoryProperty` `getProperty(Class<? extends CategoryProperty> propertyClass)` Get a property of a certain property class.
`CategoryProperty` `getProperty(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.
`int` `hashCode()`
`void` `remove(Class<? extends CategoryProperty> propertyClass)` Remove an property of a certain property class.
`void` `set(CategoryAttribute other)` Set the content of this `CategoryAttribute` from another `CategoryAttribute` object.
`void` `setCategoryPath(CategoryPath cp)` Sets the category path value of this attribute.

Methods inherited from class org.apache.lucene.util.AttributeImpl
`reflectAsString, reflectWith, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

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: `CategoryAttribute`
  Set the content of this `CategoryAttribute` from another `CategoryAttribute` object.

  Specified by:
    `set` in interface `CategoryAttribute`
  Parameters:
    `other` - The `CategoryAttribute` to take the content from.

### getCategoryPath

    public CategoryPath getCategoryPath()

  Returns the category path value.

  Specified by:
    `getCategoryPath` in interface `CategoryAttribute`
  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: `CategoryAttribute`
  Sets the category path value of this attribute.

  Specified by:
    `setCategoryPath` in interface `CategoryAttribute`
  Parameters:
    `cp` - A category path. May not be null.

### addProperty

    public void addProperty(CategoryProperty property)
                     throws UnsupportedOperationException

  Description copied from interface: `CategoryAttribute`
  Add a property. The property can be later retrieved using `CategoryAttribute.getProperty(Class)` with this property class .
  Adding multiple properties of the same class is forbidden.

  Specified by:
    `addProperty` in interface `CategoryAttribute`
  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: `CategoryAttribute`
  Get a property of a certain property class.

  Specified by:
    `getProperty` in interface `CategoryAttribute`
  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: `CategoryAttribute`
  Get a property of one of given property classes.

  Specified by:
    `getProperty` in interface `CategoryAttribute`
  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(org.apache.lucene.util.AttributeImpl target)

  Specified by:
    `copyTo` in class `org.apache.lucene.util.AttributeImpl`

### clone

    public CategoryAttribute clone()

  Description copied from interface: `CategoryAttribute`
  Clone this `CategoryAttribute`.

  Specified by:
    `clone` in interface `CategoryAttribute`
  Overrides:
    `clone` in class `org.apache.lucene.util.AttributeImpl`
  Returns:
    A clone of this `CategoryAttribute`.

### clear

    public void clear()

  Description copied from interface: `CategoryAttribute`
  Resets this attribute to its initial value: a null category path and no properties.

  Specified by:
    `clear` in interface `CategoryAttribute`
  Specified by:
    `clear` in class `org.apache.lucene.util.AttributeImpl`

### clearProperties

    public void clearProperties()

  Description copied from interface: `CategoryAttribute`
  Clear all properties.

  Specified by:
    `clearProperties` in interface `CategoryAttribute`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### getPropertyClasses

    public Set<Class<? extends CategoryProperty>> getPropertyClasses()

  Description copied from interface: `CategoryAttribute`
  Get all the active property classes.

  Specified by:
    `getPropertyClasses` in interface `CategoryAttribute`
  Returns:
    A set containing the active property classes, or `null` if there are no properties.

### remove

    public void remove(Class<? extends CategoryProperty> propertyClass)

  Description copied from interface: `CategoryAttribute`
  Remove an property of a certain property class.

  Specified by:
    `remove` in interface `CategoryAttribute`
  Parameters:
    `propertyClass` - The required property class.