Class TopicStringifiers


  • public class TopicStringifiers
    extends Object
    PUBLIC: Creates stringifiers that extract strings representing names from topics, according to various criteria, including scope.
    • Method Detail

      • getDefaultStringifier

        public static Function<TopicIF,​String> getDefaultStringifier()
        PUBLIC: Gets a stringifier that will return a default name for each topic it is applied to.
        Returns:
        stringifierIF; the string this returns will be the display name of its given topic if present, otherwise the least constrained topic name.
      • getTopicNameStringifier

        public static Function<TopicIF,​String> getTopicNameStringifier​(Collection<TopicIF> scope)
        PUBLIC: Gets a stringifier that will return the topic name it determines to match the given scope best. There are no guarantees as to which topic name it will return if more than one topic name match equally well.
        Parameters:
        scope - collection of TopicIF objects; the given scope
        Returns:
        stringifierIF; the string this stringifier returns will be a topic name of its given topic, selected according to the logic in TopicNameGrabber.
      • getVariantNameStringifier

        public static Function<TopicIF,​String> getVariantNameStringifier​(Collection<TopicIF> scope)
        PUBLIC: Gets a stringifier that will return the variant that it determines to match the given scope best. There are no guarantees as to which variant name it will return if more than one variant name matches equally well.
        Parameters:
        scope - collection of TopicIF objects; the given scope
        Returns:
        stringifierIF; the string this stringifier returns will be a variant name of its given topic, selected according to the logic in VariantNameGrabber.
      • getSortNameStringifier

        public static Function<TopicIF,​String> getSortNameStringifier()
        PUBLIC: Gets a stringifier that will return the sort names of topics, when they have one. If the topics have no sort name, one of the topic names will be used instead.
        Returns:
        StringifierIF; the string this stringifier returns will be a variant name of its given topic, selected according to the logic in SortNameGrabber.
        Since:
        1.1
      • getFastSortNameStringifier

        public static Function<TopicIF,​String> getFastSortNameStringifier​(TopicMapIF tm)
        PUBLIC: Gets a fast stringifier that will return the sort names of topics, when they have one. If the topics have no sort name, one of the topic names will be used instead. This stringifier is the one used by tolog.
        Since:
        5.1.0
      • getStringifier

        public static Function<TopicIF,​String> getStringifier​(Collection<TopicIF> tnscope,
                                                                    Collection<TopicIF> vnscope)
        PUBLIC: Gets a stringifier that will return the name it determines matches the given scopes best. There is no guarantee as to which name it will return if more than one name matches equally well.
        Parameters:
        tnscope - collection of TopicIF objects; the scope applied to topic names
        vnscope - collection of TopicIF objects; the scope applied to variant names
        Returns:
        the configured stringifier
        Since:
        1.3.2
      • toString

        public static String toString​(TopicIF topic)
        PUBLIC: Returns the default name of the topic.
        Since:
        2.0
      • toString

        public static String toString​(TopicIF topic,
                                      TopicIF tntheme)
        PUBLIC: Returns the name of the topic given the specified topic name theme.
        Since:
        2.0
      • toString

        public static String toString​(TopicIF topic,
                                      Collection<TopicIF> tnscope)
        PUBLIC: Returns the name of the topic given the specified topic name theme.
        Since:
        2.0
      • toString

        public static String toString​(TopicIF topic,
                                      TopicIF tntheme,
                                      TopicIF vntheme)
        PUBLIC: Returns the name of the topic given the specified topic name and variant name themes.
        Since:
        2.0
      • toString

        public static String toString​(TopicIF topic,
                                      Collection<TopicIF> tnscope,
                                      TopicIF vntheme)
        PUBLIC: Returns the name of the topic given the specified topic name and variant name themes.
        Since:
        2.0