Class Aliased

java.lang.Object
org.litebridge.db.spi.Aliased
Direct Known Subclasses:
Column, Table

public class Aliased extends Object
A name and an optional alias.

This class provides functionality to create and manage aliased entities. It is designed to be extended by other classes that require naming and optional aliasing.

  • Constructor Details

    • Aliased

      public Aliased(String name)
      Constructs a new Aliased instance with the specified name.
      Parameters:
      name - The target name.
    • Aliased

      public Aliased(String name, @Nullable String alias)
      Constructs a new Aliased instance with the specified name and alias.
      Parameters:
      name - The target name.
      alias - The target alias.
  • Method Details

    • name

      public String name()
      Retrieve the name of the aliased entity.
      Returns:
      the name of the aliased entity
    • alias

      public @Nullable String alias()
      Retrieve the alias of the aliased entity.
      Returns:
      the alias of the aliased entity, or null if no alias is set
    • aliasOrName

      public String aliasOrName()
      Retrieve the alias if it is set; otherwise, return the name.
      Returns:
      the alias of the entity if it exists, or the name if no alias is set
    • as

      public Aliased as(String alias)
      Set the alias for this entity and return the updated instance.
      Parameters:
      alias - the alias to assign to this entity; must not be null
      Returns:
      the updated instance of Aliased with the specified alias set
    • setAlias

      public final void setAlias(String alias)
      Set the alias for this entity.
      Parameters:
      alias - the alias to assign to this entity; must not be null
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • equalsIgnoreAlias

      public boolean equalsIgnoreAlias(Aliased aliased)
      Compares this instance with another Aliased instance, ignoring their aliases.
      Parameters:
      aliased - The other instance to compare with.
      Returns:
      true if the names are equal, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object