## org.apache.lucene.util
Class AttributeImpl

    java.lang.Object
      org.apache.lucene.util.AttributeImpl

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, Attribute

Direct Known Subclasses:
  FlagsAttributeImpl, OffsetAttributeImpl, PayloadAttributeImpl, PositionIncrementAttributeImpl, TermAttributeImpl, Token, TypeAttributeImpl

    public abstract class AttributeImpl

extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, Attribute

Base class for Attributes that can be added to a `AttributeSource`.

Attributes are used to add data in a dynamic, yet type-safe way to a source of usually streamed objects, e. g. a `TokenStream`.

See Also:
  Serialized Form

Constructor Summary
`AttributeImpl()`

Method Summary
`abstract void` `clear()` Clears the values in this AttributeImpl and resets it to its default value.
`java.lang.Object` `clone()` Shallow clone.
`abstract void` `copyTo(AttributeImpl target)` Copies the values from this Attribute into the passed-in target attribute.
`abstract boolean` `equals(java.lang.Object other)` All values used for computation of `hashCode()` should be checked here for equality.
`abstract int` `hashCode()` Subclasses must implement this method and should compute a hashCode similar to this:
`java.lang.String` `toString()` The default implementation of this method accesses all declared fields of this object and prints the values in the following syntax:

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

Constructor Detail

### AttributeImpl

    public AttributeImpl()

Method Detail

### clear

    public abstract void clear()

  Clears the values in this AttributeImpl and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.

### toString

    public java.lang.String toString()

  The default implementation of this method accesses all declared fields of this object and prints the values in the following syntax:

         public String toString() {
           return "start=" + startOffset + ",end=" + endOffset;
         }

  This method may be overridden by subclasses.

  Overrides:
    `toString` in class `java.lang.Object`

### hashCode

    public abstract int hashCode()

  Subclasses must implement this method and should compute a hashCode similar to this:

         public int hashCode() {
           int code = startOffset;
           code = code * 31 + endOffset;
           return code;
         }

  see also `equals(Object)`

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public abstract boolean equals(java.lang.Object other)

  All values used for computation of `hashCode()` should be checked here for equality. see also `Object.equals(Object)`

  Overrides:
    `equals` in class `java.lang.Object`

### copyTo

    public abstract void copyTo(AttributeImpl target)

  Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.

### clone

    public java.lang.Object clone()

  Shallow clone. Subclasses must override this if they need to clone any members deeply,

  Overrides:
    `clone` in class `java.lang.Object`

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.