org.araneaframework.backend.list.helper.naming
Class NopNamingStrategy

java.lang.Object
  extended byorg.araneaframework.backend.list.helper.naming.NopNamingStrategy
All Implemented Interfaces:
NamingStrategy

public class NopNamingStrategy
extends Object
implements NamingStrategy

NamingStrategy implementation which does not alter the names.

Since:
1.1
Author:
Rein Raudjärv

Field Summary
protected static NamingStrategy INSTANCE
           
 
Constructor Summary
protected NopNamingStrategy()
           
 
Method Summary
 String beanFieldToResultSetColumnName(String beanField)
           
 String fieldToColumnAlias(String variableName)
          Converts field name into database column alias.
 String fieldToColumnName(String variableName)
          Converts field name into database column name.
static NamingStrategy getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

protected static final NamingStrategy INSTANCE
Constructor Detail

NopNamingStrategy

protected NopNamingStrategy()
Method Detail

getInstance

public static NamingStrategy getInstance()

beanFieldToResultSetColumnName

public String beanFieldToResultSetColumnName(String beanField)

fieldToColumnAlias

public String fieldToColumnAlias(String variableName)
Description copied from interface: NamingStrategy
Converts field name into database column alias.

When two or more tables are used in SELECT with the same column name they must be distinguishable. Thus each column name must be followed by a unique alias which is referred later in WHERE and ORDER BY clause and also in the result set.

In ORDER BY expressions cannot be used like COUNT(points) instead these expressions must be defined together with aliases in the column list right after SELECT.

An alias must not contain dots neither it can be a SQL expression.

E.g.
description -> DESCRIPTION
mother.firstName -> MOTHER_FIRST_NAME
father.firstName -> FATHER_FIRST_NAME
total -> TOTAL

Specified by:
fieldToColumnAlias in interface NamingStrategy
Parameters:
variableName - field name of the list.
Returns:
corresponding database column alias used in SQL query.

fieldToColumnName

public String fieldToColumnName(String variableName)
Description copied from interface: NamingStrategy
Converts field name into database column name.

E.g.
firstName -> FIRST_NAME
group.name -> G.NAME
name -> FIRSTNAME || " " || LASTNAME total -> sum(POINTS)

Specified by:
fieldToColumnName in interface NamingStrategy
Parameters:
variableName - field name of the list.
Returns:
corresponding database column name used in SQL query.