org.d2rq.db.renamer
Class Renamer

java.lang.Object
  extended by org.d2rq.db.renamer.Renamer
Direct Known Subclasses:
ColumnRenamer, TableRenamer

public abstract class Renamer
extends Object

Something that can rename tables and columns in various objects.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static Renamer IDENTITY
          An optimized ColumnRenamer that leaves every column unchanged
 
Constructor Summary
Renamer()
           
 
Method Summary
abstract  ColumnName applyTo(ColumnName original)
           
 Expression applyTo(Expression original)
           
 List<OrderOp.OrderSpec> applyTo(List<OrderOp.OrderSpec> orderSpecs)
           
 NodeMaker applyTo(NodeMaker nodeMaker)
           
 ProjectionSpec applyTo(ProjectionSpec original)
           
abstract  TableName applyTo(TableName original)
           
 ForeignKey applyTo(TableName table, ForeignKey foreignKey)
          Renames tables/columns in a ForeignKey.
 Identifier applyTo(TableName table, Identifier identifier)
           
 Key applyTo(TableName table, Key key)
           
 List<ColumnName> applyToColumns(List<ColumnName> columns)
           
 Set<ColumnListEquality> applyToJoinConditions(Set<ColumnListEquality> joins)
           
 Collection<ProjectionSpec> applyToProjections(Collection<ProjectionSpec> projections)
           
 Set<DatabaseOp> applyToTabulars(Set<DatabaseOp> originals)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY

public static final Renamer IDENTITY
An optimized ColumnRenamer that leaves every column unchanged

Constructor Detail

Renamer

public Renamer()
Method Detail

applyTo

public abstract ColumnName applyTo(ColumnName original)
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 abstract TableName applyTo(TableName original)
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

applyTo

public Expression applyTo(Expression original)
Parameters:
original - An expression
Returns:
An expression with all columns renamed according to this Renamer

applyTo

public Identifier applyTo(TableName table,
                          Identifier identifier)

applyTo

public ForeignKey applyTo(TableName table,
                          ForeignKey foreignKey)
Renames tables/columns in a ForeignKey.

Parameters:
table - The table on which the foreign key is defined
foreignKey - The foreign key to be renamed
Returns:
A foreign key with all columns renamed according to this Renamer

applyToJoinConditions

public Set<ColumnListEquality> applyToJoinConditions(Set<ColumnListEquality> joins)

applyTo

public Key applyTo(TableName table,
                   Key key)

applyTo

public ProjectionSpec applyTo(ProjectionSpec original)

applyToProjections

public Collection<ProjectionSpec> applyToProjections(Collection<ProjectionSpec> projections)

applyTo

public List<OrderOp.OrderSpec> applyTo(List<OrderOp.OrderSpec> orderSpecs)

applyToTabulars

public Set<DatabaseOp> applyToTabulars(Set<DatabaseOp> originals)

applyTo

public NodeMaker applyTo(NodeMaker nodeMaker)

applyToColumns

public List<ColumnName> applyToColumns(List<ColumnName> columns)