org.apache.lucene.util

Class AttributeSource

  • Direct Known Subclasses:
    TokenStream


    public class AttributeSource
    extends Object
    An AttributeSource contains a list of different AttributeImpls, and methods to add and get them. There can only be a single instance of an attribute in the same AttributeSource instance. This is ensured by passing in the actual type of the Attribute (Class<Attribute>) to the addAttribute(Class), which then checks if an instance of that type is already present. If yes, it returns the instance, otherwise it creates a new instance and returns it.