Annotation Interface IndexField


@Retention(RUNTIME) @Target(METHOD) @Documented public @interface IndexField

Annotation that can be used on a public getter method to indicate that its return value or object should be indexed. If a name is specified, the value of the name will be used as the indexing field. If name is missing, the name of the getter method is used without the 'get' or 'is' part and the first letter lowercased. Thus for example

 
     public class NewsBean extends BaseBean{

         @IndexField
         public  String getAuthor() {
             // return author
         }
     }
 
 
Would result in an index field 'author'

 
     public class NewsBean extends BaseBean{

         @IndexField(name="writer")
         public  String getAuthor() {
             // return author
         }
     }
 
 
would result in a index field 'writer'

Expert

Adding ignoreInCompound = true Makes it possible to annotate a method that should not be indexed for compound ContentBeans. For example when you have the bean structure below, you do not need the getPath, canonicalUUID, etc etc from the Author to be indexed. By adding this (ignoreInCompound = true) to the IndexField annotation, the method will be skipped when indexing a compound bean into its container bean Default, ignoreInCompound is false when not specified

 
     public class NewsBean implements IdendifiableContentBean {

         public  String getPath() {
             // return path
         }

        public  void setPath(String path) {
            // set path
        }
        @IndexField
        public Author getAuthor() {
            // return author
        }

     }

     // the Compound
     public class Author implements IdendifiableContentBean {

         public  String getPath() {
             // return path
         }

         public  void setPath(String path) {
            // set path
         }

         @IndexField
         public String getName() {
             // return name
         }

     }


     public interface IdendifiableContentBean {

        @IndexField(name="id", ignoreInCompound = true)
        public String getPath();

        public void setPath(String path);

     }

 
 
In the above example, when indexing getAuthor for NewsBean, it won't index the getPath for author in that case because of the ignoreInCompound = true
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
     
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Field Details

  • Element Details

    • name

      String name
      Returns:
      Returns the field name.
      Default:
      "#default"
    • ignoreInCompound

      boolean ignoreInCompound
      Default:
      false