public class

PayloadAttributeImpl

extends AttributeImpl
implements Serializable Cloneable PayloadAttribute
java.lang.Object
   ↳ org.apache.lucene.util.AttributeImpl
     ↳ org.apache.lucene.analysis.tokenattributes.PayloadAttributeImpl

Class Overview

The payload of a Token. See also Payload.

Summary

Public Constructors
PayloadAttributeImpl()
Initialize this attribute with no payload.
PayloadAttributeImpl(Payload payload)
Initialize this attribute with the given payload.
Public Methods
void clear()
Clears the values in this AttributeImpl and resets it to its default value.
Object clone()
Shallow clone.
void copyTo(AttributeImpl target)
Copies the values from this Attribute into the passed-in target attribute.
boolean equals(Object other)
All values used for computation of hashCode() should be checked here for equality.
Payload getPayload()
Returns this Token's payload.
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)
void setPayload(Payload payload)
Sets this Token's payload.
[Expand]
Inherited Methods
From class org.apache.lucene.util.AttributeImpl
From class java.lang.Object
From interface org.apache.lucene.analysis.tokenattributes.PayloadAttribute

Public Constructors

public PayloadAttributeImpl ()

Initialize this attribute with no payload.

public PayloadAttributeImpl (Payload payload)

Initialize this attribute with the given payload.

Public Methods

public 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.

public Object clone ()

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

public 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.

public boolean equals (Object other)

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

public Payload getPayload ()

Returns this Token's payload.

public 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)

public void setPayload (Payload payload)

Sets this Token's payload.