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 Summary

    Constructors
    Constructor
    Description
    The constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    createAlias(AbstractEntityClause<?,?,?> entityClause)
     
    io.github.mmm.entity.bean.EntityBean
     
    io.github.mmm.entity.bean.EntityBean
     
    io.github.mmm.value.PropertyPath<?>
    parse(io.github.mmm.scanner.CharStreamScanner scanner, String segment)
     
    io.github.mmm.entity.bean.EntityBean
    put(String alias, io.github.mmm.entity.bean.EntityBean entity)
     
    io.github.mmm.entity.bean.EntityBean
    remove(String alias)
     
    io.github.mmm.property.ReadableProperty<?>
    resolvePath(io.github.mmm.value.ReadablePath path)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.github.mmm.scanner.CharScannerParser

    parse, parse

    Methods inherited from interface io.github.mmm.property.criteria.PropertyPathParser

    parse
  • Constructor Details

    • AliasMap

      public AliasMap()
      The constructor.
  • Method Details

    • remove

      public io.github.mmm.entity.bean.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 io.github.mmm.entity.bean.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 io.github.mmm.entity.bean.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 io.github.mmm.entity.bean.EntityBean put(String alias, io.github.mmm.entity.bean.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.