org.d2rq.values
Class DecoratingValueMaker

java.lang.Object
  extended by org.d2rq.values.DecoratingValueMaker
All Implemented Interfaces:
ValueMaker

public class DecoratingValueMaker
extends Object
implements ValueMaker

Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
static interface DecoratingValueMaker.ValueConstraint
           
 
Field Summary
 
Fields inherited from interface org.d2rq.values.ValueMaker
NULL
 
Constructor Summary
DecoratingValueMaker(ValueMaker base, List<DecoratingValueMaker.ValueConstraint> constraints)
           
DecoratingValueMaker(ValueMaker base, List<DecoratingValueMaker.ValueConstraint> constraints, Translator translator)
           
 
Method Summary
static DecoratingValueMaker.ValueConstraint containsConstraint(String containsSubstring)
           
 void describeSelf(NodeSetFilter c)
           
 String makeValue(ResultRow row)
          Retrieves a value from a database row according to some rule or pattern.
 boolean matches(String value)
          Indicates whether the node maker is capable of producing a given value, as far as can be told without having access to the actual database.
static DecoratingValueMaker.ValueConstraint maxLengthConstraint(int maxLength)
           
 List<OrderOp.OrderSpec> orderSpecs(boolean ascending)
           
 Set<ProjectionSpec> projectionSpecs()
          Returns a set of all ProjectionSpecs containing data necessary for this ValueSource.
static DecoratingValueMaker.ValueConstraint regexConstraint(String regex)
           
 ValueMaker rename(Renamer renamer)
           
 String toString()
           
 Expression valueExpression(String value, DatabaseOp table, Vendor vendor)
          A SQL expression that selects only rows where this value maker produces the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DecoratingValueMaker

public DecoratingValueMaker(ValueMaker base,
                            List<DecoratingValueMaker.ValueConstraint> constraints)

DecoratingValueMaker

public DecoratingValueMaker(ValueMaker base,
                            List<DecoratingValueMaker.ValueConstraint> constraints,
                            Translator translator)
Method Detail

maxLengthConstraint

public static DecoratingValueMaker.ValueConstraint maxLengthConstraint(int maxLength)

containsConstraint

public static DecoratingValueMaker.ValueConstraint containsConstraint(String containsSubstring)

regexConstraint

public static DecoratingValueMaker.ValueConstraint regexConstraint(String regex)

makeValue

public String makeValue(ResultRow row)
Description copied from interface: ValueMaker
Retrieves a value from a database row according to some rule or pattern.

Specified by:
makeValue in interface ValueMaker
Parameters:
row - the database row
Returns:
a value created from the row

describeSelf

public void describeSelf(NodeSetFilter c)
Specified by:
describeSelf in interface ValueMaker

matches

public boolean matches(String value)
Description copied from interface: ValueMaker
Indicates whether the node maker is capable of producing a given value, as far as can be told without having access to the actual database.

Specified by:
matches in interface ValueMaker
Returns:
true iff this node maker is capable of producing the value

valueExpression

public Expression valueExpression(String value,
                                  DatabaseOp table,
                                  Vendor vendor)
Description copied from interface: ValueMaker
A SQL expression that selects only rows where this value maker produces the specified value. Expression.FALSE if this value maker is incapable of producing the value.

Specified by:
valueExpression in interface ValueMaker
Parameters:
value - A value
table - The table to which the expression will be applicable
vendor - A vendor instance for datatyping etc.
Returns:
An expression that selects rows that produce this value

projectionSpecs

public Set<ProjectionSpec> projectionSpecs()
Description copied from interface: ValueMaker
Returns a set of all ProjectionSpecs containing data necessary for this ValueSource.

Specified by:
projectionSpecs in interface ValueMaker
Returns:
a set of ProjectionSpecs

rename

public ValueMaker rename(Renamer renamer)
Specified by:
rename in interface ValueMaker

orderSpecs

public List<OrderOp.OrderSpec> orderSpecs(boolean ascending)
Specified by:
orderSpecs in interface ValueMaker

toString

public String toString()
Overrides:
toString in class Object