|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fuberlin.wiwiss.d2rq.map.Pattern
A pattern that combines one or more database columns into a String. Often used as an UriPattern for generating URIs from a column's primary key.
(Note: The implementation makes some assumptions about the Column class to keep the code simple and fast. This means Pattern may not work with some hypothetical subclasses of Column.)
History:
08-03-2004: Initial version of this class.
Nested Class Summary | |
class |
Pattern.PartsIterator
|
Field Summary | |
private java.util.List |
columns
|
private java.util.Set |
columnsAsSet
|
private java.lang.String |
firstLiteralPart
|
private java.util.List |
literalParts
|
private java.lang.String |
pattern
|
Constructor Summary | |
Pattern(java.lang.String pattern)
Constructs a new Pattern instance from a pattern syntax string |
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)
Extracts column values according to the pattern from a value string. |
java.lang.String |
getValue(java.lang.String[] row,
java.util.Map columnNameNumberMap)
Constructs a String from the pattern using the given database row. |
java.lang.String |
joinPattern(java.lang.String joinOp)
|
void |
matchPatternIntoNodeConstraint(Pattern other,
NodeConstraint c)
|
private void |
parsePattern()
|
java.util.Iterator |
partsIterator()
|
void |
prefixTables(TablePrefixer prefixer)
Changes the fields in a newly created clone that are to be modified when making aliasses. |
java.lang.String |
reconstructPattern()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.lang.String pattern
private java.lang.String firstLiteralPart
private java.util.List columns
private java.util.List literalParts
private java.util.Set columnsAsSet
Constructor Detail |
public Pattern(java.lang.String pattern)
pattern
- a pattern syntax string
D2RQException
- on malformed patternMethod 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 void matchPatternIntoNodeConstraint(Pattern other, NodeConstraint c)
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)
Column
s, the values are strings.
getColumnValues
in interface ValueSource
value
- value to be checked.
ValueSource.getColumnValues(java.lang.String)
public java.lang.String getValue(java.lang.String[] row, java.util.Map columnNameNumberMap)
getValue
in interface ValueSource
row
- a database rowcolumnNameNumberMap
- a map from qualified column names to indices
into the row array
public java.lang.String reconstructPattern()
public java.lang.String joinPattern(java.lang.String joinOp)
public java.lang.String toString()
private void parsePattern()
public java.util.Iterator partsIterator()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |