|
||||||||||
| 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. |
String |
name
The name of the MMBase type to map |
String |
type
The expression this type should translate to. |
| Constructor Summary | |
TypeMapping()
|
|
| Method Summary | |
int |
compareTo(Object o)
|
boolean |
equals(Object o)
|
String |
getType(int size)
Returns the mappings type. |
int |
hashCode()
|
void |
setFixedSize(int size)
Sets a fixed size for this TypeMapping. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public String type
getType(int) to obtain an expanded expression.
public 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(Object o)
compareTo in interface Comparablepublic boolean equals(Object o)
public int hashCode()
public String getType(int size)
public String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||