Class DelimitedName


  • public final class DelimitedName
    extends Object
    A class which encapsulates delimiter. It parses a raw string into two parts: title and optional label, dividing by means of the delimiter. It also does a reverse operation, concatenation of two strings with the delimiter (method toString()).

    E.g. it divides a raw (concat) string as: - "org.eolang.text|0.1.0" into "org.eolang.text" and "0.1.0" - "org.eolang.text" into "org.eolang.text" and empty Optional

    It joins: - title "org.eolang.text" and label "0.1.0" into "org.eolang.text|0.1.0" - title "org.eolang.text" and an empty Optional label into "org.eolang.text"

    Since:
    0.33
    • Constructor Detail

      • DelimitedName

        public DelimitedName​(String concat)
        Ctor.
        Parameters:
        concat - Raw string.
      • DelimitedName

        public DelimitedName​(org.cactoos.Scalar<String> concat)
        Ctor.
        Parameters:
        concat - Raw string as scalar.
      • DelimitedName

        public DelimitedName​(String title,
                             String label)
        Ctor.
        Parameters:
        title - The title.
        label - The optional label
      • DelimitedName

        public DelimitedName​(String title,
                             Optional<String> label)
        Ctor.
        Parameters:
        title - The title.
        label - The optional label.
    • Method Detail

      • title

        public String title()
        The title.
        Returns:
        The title.
      • label

        public Optional<String> label()
        The optional label. Label can be absent.
        Returns:
        The label.