|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.persist.constraints.Constraint
Abstract class for all query constraints. Remember, after creating one of these guys, you should add a line to the ConstraintFactory's static{} block.
Field Summary | |
protected java.lang.String |
columnName
|
protected static ObjectFormatter |
defaultObjectFormatter
|
protected ObjectFormatter |
objectFormatter
|
Constructor Summary | |
Constraint()
|
Method Summary | |
abstract boolean |
checkConstraint(java.lang.Object dataField,
java.lang.Object queryField)
Check to see if a given object passes this constraint. |
boolean |
checkConstraint(SQLQuery query,
Persistence poolElement,
java.lang.Object dataField,
java.lang.Object queryField)
|
protected static java.lang.Class |
classOfField(java.lang.String field,
java.lang.Object baseObj)
This is a handy method for formatting output and validating input for specific fields. |
java.lang.Object |
clone()
Publicize the clone method. |
abstract java.lang.String |
constructQueryString()
Return the string which will appear in the query string. |
boolean |
equals(java.lang.Object obj)
A rudimentary but effective equals() method for subclasses of Constraint. |
boolean |
findField(java.lang.String field)
|
protected java.lang.String |
formatString(java.lang.String input)
This is to abstract the need to get input in the correct format for a given field object, based on the class of the field indicated by getField() and getPersistence(). |
abstract void |
fromString(java.lang.String str)
Parse the string. |
java.lang.String |
getColumnName()
|
java.lang.String |
getField()
A given constraint instance will be associated with a field. |
boolean |
getNot()
Gets the Not attribute of the Constraint object |
ObjectFormatter |
getObjectFormatter()
|
Persistence |
getPersistence()
The field is specified as a field on a given persistent object. |
abstract java.util.Enumeration |
getStaticList()
Gets the StaticList attribute of the Constraint object |
abstract java.lang.String |
getType()
This is a unique, readable string identifying the constraint type (ex, anyof, null) |
boolean |
isComparisonValueFromPersistentObject()
|
boolean |
isUsingColumnName()
|
void |
setColumnName(java.lang.String colName)
|
void |
setField(java.lang.String field)
Sets the Field attribute of the Constraint object |
void |
setNot(boolean not)
Sets the Not attribute of the Constraint object |
void |
setObjectFormatter(ObjectFormatter value)
|
void |
setPersistence(Persistence p)
Sets the Persistence attribute of the Constraint object |
protected static java.lang.String |
sqlString(java.lang.String str)
Provide a generic method for converting a string to a SQL-type string: |
abstract void |
staticListInsert(java.lang.String field)
Each type of constraint will have a specific set of fields associated with it. |
abstract java.lang.String |
stringify()
Stringify the object. |
protected java.lang.Object |
stringToObject(java.lang.String str,
java.lang.Class classOfStr)
|
java.lang.String |
toString()
toString returns the stringified object. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static ObjectFormatter defaultObjectFormatter
protected java.lang.String columnName
protected transient ObjectFormatter objectFormatter
Constructor Detail |
public Constraint()
Method Detail |
protected static java.lang.Class classOfField(java.lang.String field, java.lang.Object baseObj) throws java.lang.NoSuchFieldException
field
- baseObj
-
java.lang.NoSuchFieldException
protected static java.lang.String sqlString(java.lang.String str)
str
-
public void setObjectFormatter(ObjectFormatter value)
value
- The new ObjectFormatter valuepublic void setField(java.lang.String field)
field
- The new Field valuepublic void setNot(boolean not)
not
- The new Not valuepublic void setPersistence(Persistence p)
p
- The new Persistence valuepublic void setColumnName(java.lang.String colName)
colName
- The new ColumnName valuepublic ObjectFormatter getObjectFormatter()
public java.lang.String getField()
public boolean getNot()
public Persistence getPersistence()
public abstract java.util.Enumeration getStaticList()
public abstract java.lang.String getType()
public boolean isComparisonValueFromPersistentObject()
public boolean isUsingColumnName()
public java.lang.String getColumnName()
public abstract boolean checkConstraint(java.lang.Object dataField, java.lang.Object queryField)
dataField
- queryField
-
public boolean checkConstraint(SQLQuery query, Persistence poolElement, java.lang.Object dataField, java.lang.Object queryField)
query
- poolElement
- dataField
- queryField
-
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public abstract java.lang.String constructQueryString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
public boolean findField(java.lang.String field)
field
-
public abstract void fromString(java.lang.String str) throws java.text.ParseException
str
-
java.text.ParseException
public abstract void staticListInsert(java.lang.String field)
field
- public abstract java.lang.String stringify()
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String formatString(java.lang.String input) throws java.lang.NoSuchFieldException, java.text.ParseException, java.lang.NumberFormatException
input
-
java.lang.NoSuchFieldException
java.text.ParseException
java.lang.NumberFormatException
protected java.lang.Object stringToObject(java.lang.String str, java.lang.Class classOfStr)
str
- java.lang.StringclassOfStr
- java.lang.Class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |