|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fuberlin.wiwiss.d2rq.map.RegexRestriction
Restriction which can be chained with another ValueSource
to state
that all its values match a certain regular expression. This is useful because the
query engine can exclude sources if a value doesn't match the expression.
History:
08-03-2004: Initial version of this class.
Field Summary | |
private java.util.regex.Pattern |
regex
|
private ValueSource |
valueSource
|
Constructor Summary | |
RegexRestriction(ValueSource valueSource,
java.lang.String regex)
|
Method Summary | |
java.lang.Object |
clone()
Make a shallow copy of this . |
boolean |
couldFit(java.lang.String value)
Checks if a given value fits this source without querying the database. |
java.util.Set |
getColumns()
Returns a set of all columns containing data necessary for this ValueSource. |
java.util.Map |
getColumnValues(java.lang.String value)
Returns a map of database fields and values corresponding to the argument. |
java.lang.String |
getValue(java.lang.String[] row,
java.util.Map columnNameNumberMap)
Retrieves a value from a database row according to some rule or pattern. |
void |
prefixTables(TablePrefixer prefixer)
Changes the fields in a newly created clone that are to be modified when making aliasses. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ValueSource valueSource
private java.util.regex.Pattern regex
Constructor Detail |
public RegexRestriction(ValueSource valueSource, java.lang.String regex)
Method Detail |
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Prefixable
this
.
General advice: Do not overwrite clone().
prefixTables() works best with shallow copy which Object implements.
Issues: I have not found a (preferred) static equivalent of clone().
Since Objects clone() method is protected, we cannot just declare
Cloneable
, if we want to call clone() from outside of that
class hierarchy. Instead it must be public and implemented in each
Prefixable class by a call to super.clone().
clone
in interface Prefixable
java.lang.CloneNotSupportedException
public void prefixTables(TablePrefixer prefixer)
Prefixable
prefixTables
in interface Prefixable
prefixer
- does the actual prefixing of simple and complex types.public boolean couldFit(java.lang.String value)
ValueSource
couldFit
in interface ValueSource
public java.util.Set getColumns()
ValueSource
getColumns
in interface ValueSource
public java.util.Map getColumnValues(java.lang.String value)
ValueSource
For example, a ValueSource that corresponds directly to a single DB column would return a single-entry map with that column as the key, and value as the value.
getColumnValues
in interface ValueSource
value
- a non-null value
Column
keys, and string values.public java.lang.String getValue(java.lang.String[] row, java.util.Map columnNameNumberMap)
ValueSource
getValue
in interface ValueSource
row
- the database rowcolumnNameNumberMap
- a map from Table.Column style column
names to Integer indices into the row array
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |