Class HitField


  • public class HitField
    extends java.lang.Object
    Represents a tokenized string field in a Hit. The original raw content and the field name cannot be modified. But the tokenized version can be retrieved and set.
    Author:
    Lars Christian Jensen
    • Constructor Summary

      Constructors 
      Constructor Description
      HitField​(java.lang.String fieldName, XMLString content)  
      HitField​(java.lang.String fieldName, XMLString content, boolean cjk)
      Creates a hit field
      HitField​(java.lang.String fieldName, java.lang.String content)  
      HitField​(java.lang.String fieldName, java.lang.String content, boolean cjk)  
      HitField​(java.lang.String fieldname, java.lang.String content, boolean cjk, boolean xmlProperty)
      Creates a hit field
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String bareContent​(boolean XMLQuote, boolean inAttribute)
      Returns the content of the field, stripped of markup
      java.lang.String getContent()
      Returns the content of this field
      java.lang.String getContent​(java.lang.String boldOpenTag, java.lang.String boldCloseTag, java.lang.String separatorTag)
      Returns the content of this field, using the arguments as bolding tags
      java.lang.String getName()  
      java.lang.Object getOriginal()
      Fetch the object which (the String representation of) this HitField was built from.
      java.lang.String getRawContent()  
      java.util.List<FieldPart> getTokenizedContent()
      Get a list representation of the tokens in the content.
      java.util.ListIterator<FieldPart> listIterator()
      Return an iterator for the tokens, delimiters and markup elements of the field.
      void markDirty()  
      java.lang.String quotedContent​(boolean inAttribute)  
      java.lang.String quotedContent​(java.lang.String boldOpenTag, java.lang.String boldCloseTag, java.lang.String separatorTag, boolean inAttribute)
      Returns the content of this field, using the arguments as bolding tags, as an XML string
      void setOriginal​(java.lang.Object original)
      Optionally set the object which this HitField should represent.
      void setTokenizedContent​(java.util.List<FieldPart> list)
      Only FieldPart objects must be present in the list.
      java.util.ListIterator<FieldPart> tokenIterator()
      Return an iterator over the tokens of this field
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HitField

        public HitField​(java.lang.String fieldName,
                        java.lang.String content)
      • HitField

        public HitField​(java.lang.String fieldName,
                        XMLString content)
      • HitField

        public HitField​(java.lang.String fieldName,
                        java.lang.String content,
                        boolean cjk)
      • HitField

        public HitField​(java.lang.String fieldName,
                        XMLString content,
                        boolean cjk)
        Creates a hit field
        Parameters:
        cjk - true if the content is CJK text
      • HitField

        public HitField​(java.lang.String fieldname,
                        java.lang.String content,
                        boolean cjk,
                        boolean xmlProperty)
        Creates a hit field
        Parameters:
        fieldname - The field name
        content - The field content
        cjk - true if the content is CJK text
        xmlProperty - true if this should not quote XML syntax
    • Method Detail

      • getName

        public java.lang.String getName()
      • getRawContent

        public java.lang.String getRawContent()
      • getTokenizedContent

        public java.util.List<FieldPart> getTokenizedContent()
        Get a list representation of the tokens in the content. This is only a copy, changes here will not affect the HitField.
        Returns:
        a list containing the content in tokenized form.
      • listIterator

        public java.util.ListIterator<FieldPart> listIterator()
        Return an iterator for the tokens, delimiters and markup elements of the field.
      • tokenIterator

        public java.util.ListIterator<FieldPart> tokenIterator()
        Return an iterator over the tokens of this field
      • setTokenizedContent

        public void setTokenizedContent​(java.util.List<FieldPart> list)
        Only FieldPart objects must be present in the list.
        Parameters:
        list - contains the new content of this HitField in tokenized form.
      • getContent

        public java.lang.String getContent()
        Returns the content of this field
      • getContent

        public java.lang.String getContent​(java.lang.String boldOpenTag,
                                           java.lang.String boldCloseTag,
                                           java.lang.String separatorTag)
        Returns the content of this field, using the arguments as bolding tags
      • markDirty

        public void markDirty()
      • quotedContent

        public java.lang.String quotedContent​(boolean inAttribute)
        Parameters:
        inAttribute - whether to quote quotation marks
        Returns:
        the content of this field as an XML string
      • quotedContent

        public java.lang.String quotedContent​(java.lang.String boldOpenTag,
                                              java.lang.String boldCloseTag,
                                              java.lang.String separatorTag,
                                              boolean inAttribute)
        Returns the content of this field, using the arguments as bolding tags, as an XML string
      • bareContent

        public java.lang.String bareContent​(boolean XMLQuote,
                                            boolean inAttribute)
        Returns the content of the field, stripped of markup
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getOriginal

        public java.lang.Object getOriginal()
        Fetch the object which (the String representation of) this HitField was built from. This may be null as setting the original is optional.
      • setOriginal

        public void setOriginal​(java.lang.Object original)
        Optionally set the object which this HitField should represent.