Class ColumnName

java.lang.Object
app.babylon.table.column.ColumnName
All Implemented Interfaces:
Comparable<ColumnName>

public final class ColumnName extends Object implements Comparable<ColumnName>
Canonical, case-insensitive table column name.
  • Method Details

    • of

      public static ColumnName of(String s)
      Creates a column name from raw text.
      Parameters:
      s - source text
      Returns:
      column name
    • parse

      public static ColumnName parse(CharSequence s)
      Parses a column name, returning null for empty text.
      Parameters:
      s - source text
      Returns:
      parsed column name or null
    • of

      public static ColumnName[] of(Collection<String> v)
      Converts a collection of strings into column names.
      Parameters:
      v - source names
      Returns:
      column-name array
    • of

      public static ColumnName[] of(String[] v)
      Converts an array of strings into column names.
      Parameters:
      v - source names
      Returns:
      column-name array
    • of

      public static ColumnName[] of(String[] v, int startIndex)
      Converts a tail slice of a string array into column names.
      Parameters:
      v - source names
      startIndex - first index to include
      Returns:
      column-name array
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getValue

      public String getValue()
      Returns the exported display value of the column name.
      Returns:
      display value
    • getCanonical

      public String getCanonical()
      Returns the canonical comparison key.
      Returns:
      canonical key
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(ColumnName o)
      Specified by:
      compareTo in interface Comparable<ColumnName>
    • toSnake

      public String toSnake()
      Returns a snake-case representation of the name.
      Returns:
      snake-case text
    • toWords

      public Collection<String> toWords(Collection<String> words)
      Splits the name into camel-case words.
      Parameters:
      words - destination collection or null
      Returns:
      destination collection containing the words
    • toSqlIdentifier

      public String toSqlIdentifier()
      Returns a SQL-friendly identifier for the name.
      Returns:
      quoted SQL identifier
    • toCamelCaseUpper

      public String toCamelCaseUpper()
      Returns the CamelUpper representation of the name.
      Returns:
      CamelUpper text
    • toCamelCase

      public String toCamelCase()
      Returns the camelCase representation of the name.
      Returns:
      camelCase text
    • clean

      public static String clean(String s)
      Returns the canonical cleaned form of arbitrary column-name text.
      Parameters:
      s - source text
      Returns:
      cleaned canonical key
    • toStringArray

      public static String[] toStringArray(Collection<ColumnName> x)
      Converts column names back to their exported string values.
      Parameters:
      x - source column names
      Returns:
      string values or null