com.jpattern.orm.query
Class OrmClassToolMapNameSolver

java.lang.Object
  extended by com.jpattern.orm.query.OrmClassToolMapNameSolver
All Implemented Interfaces:
NameSolver

public class OrmClassToolMapNameSolver
extends Object
implements NameSolver

Author:
Francesco Cina 22/giu/2011

Constructor Summary
OrmClassToolMapNameSolver(IOrmClassToolMap ormClassToolMap)
           
 
Method Summary
 String alias(Integer classId)
          Return the alias of a registered class
 void alwaysResolveWithoutAlias(boolean resolveWithoutAlias)
          If set to true always resolves the properties name without prepend the table name alias, even if the solvePropertyName is called DEFAULT is set to false.
 boolean getAlwaysResolveWithoutAlias()
          Return whether resolve the properties name without prepend the table name alias
<P> Integer
register(Class<P> clazz)
          Register a class and use the name of the class as alias to resolve the property name.
<P> Integer
register(Class<P> clazz, String alias)
          Register a class and use the passed alias parameter as alias to resolve the property name.
 String solvePropertyName(String property)
          Resolve a property in a query to his name in the database using the table alias as prefix.
 String solvePropertyName(String property, String defaultValue)
          Resolve a property in a query to his name in the database using the table alias as prefix.
 String solvePropertyNameWithoutAlias(String property)
          Resolve a property in a query to his column's related name in the database without using the table alias as prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrmClassToolMapNameSolver

public OrmClassToolMapNameSolver(IOrmClassToolMap ormClassToolMap)
Method Detail

solvePropertyName

public String solvePropertyName(String property)
                         throws OrmException
Description copied from interface: NameSolver
Resolve a property in a query to his name in the database using the table alias as prefix.

Specified by:
solvePropertyName in interface NameSolver
Returns:
Throws:
OrmException

solvePropertyName

public String solvePropertyName(String property,
                                String defaultValue)
                         throws OrmException
Description copied from interface: NameSolver
Resolve a property in a query to his name in the database using the table alias as prefix. If the property cannot be solved then the default value is returned.

Specified by:
solvePropertyName in interface NameSolver
Returns:
Throws:
OrmException

register

public <P> Integer register(Class<P> clazz)
                 throws OrmException
Description copied from interface: NameSolver
Register a class and use the name of the class as alias to resolve the property name.

Specified by:
register in interface NameSolver
Returns:
the registered class id
Throws:
OrmException

register

public <P> Integer register(Class<P> clazz,
                            String alias)
                 throws OrmException
Description copied from interface: NameSolver
Register a class and use the passed alias parameter as alias to resolve the property name.

Specified by:
register in interface NameSolver
Returns:
the registered class id
Throws:
OrmException

alias

public String alias(Integer classId)
             throws OrmException
Description copied from interface: NameSolver
Return the alias of a registered class

Specified by:
alias in interface NameSolver
Returns:
Throws:
OrmException

solvePropertyNameWithoutAlias

public String solvePropertyNameWithoutAlias(String property)
                                     throws OrmException
Description copied from interface: NameSolver
Resolve a property in a query to his column's related name in the database without using the table alias as prefix.

Specified by:
solvePropertyNameWithoutAlias in interface NameSolver
Returns:
Throws:
OrmException

alwaysResolveWithoutAlias

public void alwaysResolveWithoutAlias(boolean resolveWithoutAlias)
Description copied from interface: NameSolver
If set to true always resolves the properties name without prepend the table name alias, even if the solvePropertyName is called DEFAULT is set to false.

Specified by:
alwaysResolveWithoutAlias in interface NameSolver

getAlwaysResolveWithoutAlias

public boolean getAlwaysResolveWithoutAlias()
Description copied from interface: NameSolver
Return whether resolve the properties name without prepend the table name alias

Specified by:
getAlwaysResolveWithoutAlias in interface NameSolver
Returns:


Copyright © 2013. All Rights Reserved.