Package org.alfresco.repo.domain.dialect
Class TypeNames
- java.lang.Object
-
- org.alfresco.repo.domain.dialect.TypeNames
-
public class TypeNames extends java.lang.ObjectThis class maps a type to names. Associations may be marked with a capacity. Calling the get() method with a type and actual size n will return the associated name with smallest capacity >= n, if available and an unmarked default type otherwise. Eg, settingnames.put(type, "TEXT" ); names.put(type, 255, "VARCHAR($l)" ); names.put(type, 65534, "LONGVARCHAR($l)" );will give you back the following:names.get(type) // --> "TEXT" (default) names.get(type, 100) // --> "VARCHAR(100)" (100 is in [0:255]) names.get(type, 1000) // --> "LONGVARCHAR(1000)" (1000 is in [256:65534]) names.get(type, 100000) // --> "TEXT" (default)
On the other hand, simply puttingnames.put(type, "VARCHAR($l)" );would result innames.get(type) // --> "VARCHAR($l)" (will cause trouble) names.get(type, 100) // --> "VARCHAR(100)" names.get(type, 10000) // --> "VARCHAR(10000)"
Class copied from patched hibernate 3.2.6- Since:
- 6.0
-
-
Constructor Summary
Constructors Constructor Description TypeNames()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringget(int typecode)get default type name for specified typejava.lang.Stringget(int typecode, int size, int precision, int scale)get type name for specified type and sizevoidput(int typecode, int capacity, java.lang.String value)set a type name for specified type key and capacityvoidput(int typecode, java.lang.String value)set a default type name for specified type key
-
-
-
Method Detail
-
get
public java.lang.String get(int typecode) throws java.lang.IllegalArgumentExceptionget default type name for specified type- Parameters:
typecode- the type key- Returns:
- the default type name associated with specified key
- Throws:
java.lang.IllegalArgumentException
-
get
public java.lang.String get(int typecode, int size, int precision, int scale) throws java.lang.IllegalArgumentExceptionget type name for specified type and size- Parameters:
typecode- the type keysize- the SQL lengthscale- the SQL scaleprecision- the SQL precision- Returns:
- the associated name with smallest capacity >= size, if available and the default type name otherwise
- Throws:
java.lang.IllegalArgumentException
-
put
public void put(int typecode, int capacity, java.lang.String value)set a type name for specified type key and capacity- Parameters:
typecode- the type key
-
put
public void put(int typecode, java.lang.String value)set a default type name for specified type key- Parameters:
typecode- the type key
-
-