Class Category.NameSelector

  • All Implemented Interfaces:
    DataSelector, java.util.function.Predicate<Data>
    Enclosing class:
    Category

    public static class Category.NameSelector
    extends java.lang.Object
    implements DataSelector
    Select categories by their name.

    This selector can also be used to select category through their synonyms by using constructor NameSelector(String, String, boolean) with second argument set to true.

    Since:
    jcms-5.7
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String lang  
      protected boolean searchInSynonyms  
      protected java.lang.String text  
    • Constructor Summary

      Constructors 
      Constructor Description
      NameSelector​(java.lang.String text)
      Builds a new NameSelector to select categories matching the specified text.
      NameSelector​(java.lang.String text, java.lang.String lang)
      Builds a new NameSelector to select categories matching the specified text in the specified language.
      NameSelector​(java.lang.String text, java.lang.String lang, boolean searchInSynonyms)
      Builds a new NameSelector to select categories matching the specified text in the specified language.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isSelected​(Data data)
      Evaluates if a data must be selected or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Predicate

        and, negate, or
    • Field Detail

      • text

        protected java.lang.String text
      • lang

        protected java.lang.String lang
      • searchInSynonyms

        protected boolean searchInSynonyms
    • Constructor Detail

      • NameSelector

        public NameSelector​(java.lang.String text)
        Builds a new NameSelector to select categories matching the specified text.

        Selection is performed against the name of the category in the default site language, without searching in synonyms.

        Parameters:
        text - the text to search, if null or empty, no category will be selected
      • NameSelector

        public NameSelector​(java.lang.String text,
                            java.lang.String lang)
        Builds a new NameSelector to select categories matching the specified text in the specified language.

        Selection is performed without searching in synonyms.

        Parameters:
        text - the text to search, if null or empty, no category will be selected
        lang - the language of the Category's name in which the text should be checked, if null or empty, the default site language is used
      • NameSelector

        public NameSelector​(java.lang.String text,
                            java.lang.String lang,
                            boolean searchInSynonyms)
        Builds a new NameSelector to select categories matching the specified text in the specified language.
        Parameters:
        text - the text to search, if null or empty, no category will be selected
        lang - the language of the Category's name in which the text should be checked if null or empty, the default site language is used
        searchInSynonyms - set to true to also perform text selection in synonyms
        Since:
        jcms-7.1.3 jcms-8.0.2 JCMS-3337
    • Method Detail

      • isSelected

        public boolean isSelected​(Data data)
        Description copied from interface: DataSelector
        Evaluates if a data must be selected or not.
        Specified by:
        isSelected in interface DataSelector
        Parameters:
        data - the data to evaluate.
        Returns:
        true if the data is selected. False otherwise.