|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.storage.util.TypeMapping
public class 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 | |
|---|---|
long |
maxSize
The maximum size of the MMBase type to map. |
long |
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(TypeMapping o)
|
boolean |
equals(Object o)
|
String |
getType(Object... messageFormatArguments)
Returns the mappings type. |
int |
hashCode()
|
void |
setFixedSize(long 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(Object...) to obtain an expanded expression.
public String name
public long minSize
public long maxSize
| Constructor Detail |
|---|
public TypeMapping()
| Method Detail |
|---|
public void setFixedSize(long size)
size - the size to setpublic int compareTo(TypeMapping o)
compareTo in interface Comparable<TypeMapping>public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class ObjectObject.hashCode()public String getType(Object... messageFormatArguments)
messageFormatArguments - Argument to use as arugment for the used MessageFormat.format(String, Object...).
public String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||