|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.storage.util.TypeMapping
The TypeMapping class helps translating MMBase types to storage-specific type descriptions.
Examples of type mappings are mappings that convert to database field types.
I.e., a STRING with size 0-255 could be configured to translate to 'varchar({0})', '{0}, in this case,.
being the size of the actual field.
TypeMapping is a comparable class, which allows it to be used in a sorted map, set or list.
However, Typemapping needs fuzzy matching so it is easy to locate the appropriate type-mapping for a field.
As such, it's natural ordering is NOT consistent with equals. A typemapping may be considered 'equal' while still having
a different ordering position in the class.
This allows for an easy search on a sorted list of TypeMappings: By using 'IndexOf' you can quickly find a TypeMapping in a list,
even if the min or max sizes for the type do not completely match.
You typically use this if you searxh for a TypeMapping whose size you set with 'getSize()', rather than setting a specific range
(using the minSize/maxSize properties).
| Field Summary | |
int |
maxSize
The maximum size of the MMBase type to map. |
int |
minSize
The minimum size of the MMBase type to map. |
java.lang.String |
name
The name of the MMBase type to map |
java.lang.String |
type
The expression this type should translate to. |
| Constructor Summary | |
TypeMapping()
|
|
| Method Summary | |
int |
compareTo(java.lang.Object o)
|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getType(int size)
Returns the mappings type. |
void |
setFixedSize(int size)
Sets a fixed size for this TypeMapping. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public java.lang.String type
getType(int) to obtain an expanded expression.
public java.lang.String name
public int minSize
public int maxSize
| Constructor Detail |
public TypeMapping()
| Method Detail |
public void setFixedSize(int size)
size - the size to setpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparablepublic boolean equals(java.lang.Object o)
public java.lang.String getType(int size)
public java.lang.String toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||