Class AliasMap

java.lang.Object
io.github.mmm.orm.statement.AliasMap
All Implemented Interfaces:
io.github.mmm.property.criteria.PropertyPathParser, io.github.mmm.scanner.CharScannerParser<io.github.mmm.value.PropertyPath<?>>

public class AliasMap extends Object implements io.github.mmm.property.criteria.PropertyPathParser
Class to map from alias to entity. A single AliasMap instance is used per DbStatement to ensure unique aliases.
Since:
1.0.0
  • Constructor Details

    • AliasMap

      public AliasMap()
      The constructor.
  • Method Details

    • remove

      public EntityBean remove(String alias)
      Parameters:
      alias - the alias to remove.
      Returns:
      the removed EntityBean or null if none was present or mapped.
    • contains

      public boolean contains(String alias)
      Parameters:
      alias - the alias to check.
      Returns:
      true if the given alias is currently mapped, false otherwise.
    • getEntity

      public EntityBean getEntity(String alias)
      Parameters:
      alias - the alias to get the mapping for.
      Returns:
      the mapped EntityBean that is associated with the given alias. May be null.
    • getRequiredEntity

      public EntityBean getRequiredEntity(String alias)
      Parameters:
      alias - the alias to get the mapping for.
      Returns:
      the mapped EntityBean that is associated with the given alias.
      Throws:
      IllegalArgumentException - if no such EntityBean could be found.
    • put

      public EntityBean put(String alias, EntityBean entity)
      Parameters:
      alias - the alias to bind.
      entity - the EntityBean to bind to.
      Returns:
      the previously mapped EntityBean or null.
    • createAlias

      public String createAlias(AbstractEntityClause<?,?,?> entityClause)
      Parameters:
      entityClause - the AbstractEntityClause.
      Returns:
      a unique alias generated for the given AbstractEntityClause.
    • parse

      public io.github.mmm.value.PropertyPath<?> parse(io.github.mmm.scanner.CharStreamScanner scanner, String segment)
      Specified by:
      parse in interface io.github.mmm.property.criteria.PropertyPathParser
    • resolvePath

      public io.github.mmm.property.ReadableProperty<?> resolvePath(io.github.mmm.value.ReadablePath path)
      Parameters:
      path - the ReadablePath to resolve (e.g. "alias.Property.ChildProperty").
      Returns:
      the WritableProperty traversed from the given path from its root segment as alias.