org.d2rq.db.renamer
Class TableRenamer

java.lang.Object
  extended by org.d2rq.db.renamer.Renamer
      extended by org.d2rq.db.renamer.TableRenamer

public class TableRenamer
extends Renamer

A Renamer that can be applied to various things in order to substitute some tables for other tables, e.g., substitute a base table by an alias.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
 
Fields inherited from class org.d2rq.db.renamer.Renamer
IDENTITY
 
Method Summary
 ColumnName applyTo(ColumnName original)
           
 TableName applyTo(TableName original)
           
static Renamer create(AliasOp alias)
           
static Renamer create(Collection<AliasOp> aliases)
          Creates a renamer that substitutes originals with aliases; for example, if an alias "T1 AS A1, T2 AS A2B, A2 AS A2C" is applied to "SELECT T1.X, A2.Y, Z FROM T1, T2 AS A2", it will yield: "SELECT A1.X, A2C.Y, Z FROM T1 AS A1, T2 AS A2C".
static Renamer create(Map<TableName,TableName> originalsToReplacements)
           
static Renamer create(TableName old, TableName replacement)
           
 String toString()
           
 
Methods inherited from class org.d2rq.db.renamer.Renamer
applyTo, applyTo, applyTo, applyTo, applyTo, applyTo, applyTo, applyToColumns, applyToJoinConditions, applyToNodeMakers, applyToProjections, applyToTabulars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Renamer create(TableName old,
                             TableName replacement)

create

public static Renamer create(Map<TableName,TableName> originalsToReplacements)

create

public static Renamer create(Collection<AliasOp> aliases)
Creates a renamer that substitutes originals with aliases; for example, if an alias "T1 AS A1, T2 AS A2B, A2 AS A2C" is applied to "SELECT T1.X, A2.Y, Z FROM T1, T2 AS A2", it will yield: "SELECT A1.X, A2C.Y, Z FROM T1 AS A1, T2 AS A2C". Aliases whose originals are not named have no effect.


create

public static Renamer create(AliasOp alias)

applyTo

public ColumnName applyTo(ColumnName original)
Specified by:
applyTo in class Renamer
Parameters:
original - A column name
Returns:
The renamed version of that column name, or the same column name if the renamer does not apply to this argument

applyTo

public TableName applyTo(TableName original)
Specified by:
applyTo in class Renamer
Parameters:
original - A table name
Returns:
The renamed version of that table name, or the original if the renamer does not apply to this argument

toString

public String toString()
Overrides:
toString in class Object