|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.cams.access.AbstractResourcePattern
Provides a generic implementation of ResourcePattern methods for
extension by resource-specific base classes. Base classes must implement the
abstract "matches(ResourceRequest r)" method and may override the
"setPattern(String pattern)" method to interpret resource-specific patterns.
| Field Summary | |
protected int |
hashcode
The hashcode of the ResourcePattern. |
protected String |
pattern
The overall Resource ID pattern. |
protected ResourcePatternInfo |
rpInfo
The ResourcePatternInfo containing field-level metadata. |
protected BigDecimal |
score
The specificality score. |
| Constructor Summary | |
AbstractResourcePattern()
|
|
| Method Summary | |
int |
compareTo(Object o)
Compares two ResourcePatterns and determines if a ResourcePattern is less than, equals to, or greater than another ResourcePattern. |
abstract boolean |
equals(Object obj)
Determine if two ResourcePattern objects are equal. |
FieldInfo[] |
getFieldInfo()
Get information about ResourcePattern fields. |
FieldInfo |
getFieldInfo(String fieldName)
Get information about a specific ResourcePattern field. |
abstract Object |
getFieldValue(String fieldName)
Get the value associated with a ResourcePattern field. |
String |
getPattern()
Get the pattern. |
int |
hashCode()
Compute the Hashcode for the ResourcePattern. |
abstract boolean |
match(ResourceRequest resourceReq)
Determine if a ResourceRequest matches this ResourcePattern. |
BigDecimal |
score()
Get the specificality score. |
abstract void |
setFieldValue(String fieldName,
Object fieldValue)
Set the value associated with a ResourcePattern field. |
abstract void |
setPattern(String pattern)
Set the Resource Identifier pattern. |
String |
toString()
Get a String Representation of the pattern. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected String pattern
protected ResourcePatternInfo rpInfo
protected BigDecimal score
protected int hashcode
| Constructor Detail |
public AbstractResourcePattern()
| Method Detail |
public String getPattern()
getPattern in interface ResourcePattern
public abstract void setPattern(String pattern)
throws ResourcePatternException
setPattern in interface ResourcePatternpattern - a string that represents a pattern of Resource identifiers.
ResourcePatternException - if the overall resource identifier
pattern is invalid.public FieldInfo[] getFieldInfo()
getFieldInfo in interface ResourcePatternpublic FieldInfo getFieldInfo(String fieldName)
getFieldInfo in interface ResourcePatternfieldName - the name of the Field.
public abstract Object getFieldValue(String fieldName)
getFieldValue in interface ResourcePatternfieldName - the name of the Field.
public abstract void setFieldValue(String fieldName,
Object fieldValue)
throws ResourcePatternException
setFieldValue in interface ResourcePatternfieldName - the name of the Field.fieldValue - the value to be be assigned to the Field.
ResourcePatternException - if the specified field is unknown
or the field value is invalid.public abstract boolean match(ResourceRequest resourceReq)
match in interface ResourcePatternresourceReq - the ResourceRequest to be checked against this
ResourcePattern.
public abstract boolean equals(Object obj)
The equals method implements an equivalence relation:
x,
x.equals(x) should return true.
x and
y, x.equals(y) should return
true if and only if y.equals(x) returns
true.
x,
y, and z, if x.equals(y)
returns true and y.equals(z) returns
true, then x.equals(z) should return
true.
x
and y, multiple invocations of x.equals(y)
consistently return true or consistently return
false, provided no information used in
equals comparisons on the object is modified.
x,
x.equals(null) should return false.
equals in class Objectobj - the reference object with which to compare.
public String toString()
toString in class Objectpublic BigDecimal score()
This method calculates how specific a ResourcePattern is. Because, the ResourcePattern is aware of the various FieldValuePatterns that compose itself it can determine how specific a pattern is. The score is calculated using an algorithm that is implementation specific.
score in interface ResourcePatternpublic int hashCode()
hashCode in class Objectpublic int compareTo(Object o)
compareTo in interface Comparableo - the Object to be compared.
NullPointerException - if o is null.
ClassCastException - if the specified object's type prevents it
from being compared to this Object.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||