e4s.db.dict
Class E4DBType
java.lang.Object
e4s.util.E4Object
e4s.db.dict.E4DBGeneratedClass
e4s.db.dict.E4DBType
- All Implemented Interfaces:
- java.lang.Comparable
public class E4DBType
- extends E4DBGeneratedClass
- implements java.lang.Comparable
Part of the datadictionary: information for a user defined datatype.
A user defined datatype is a name associated with a datatype and in the case of a E4String or e4s.util.StringImage a length.
Datatypes can be used in tables or views for getters or setters. For each datatype definition, a Java source file
will be created in your system dictionary-source path (defined by E4Settings.
By definition, these datatypes may be nullable or not. A datatype may also contain constant definitions. When instanciating a new object of
this datatype, there are thre possibilities identified by getInstanceMode():
INSTANCE_MODE_NEW means that there can be new instances created, which should be the default. Either by the new operator or by the
newInstance() method provided in the generated class. Use this whenever you expect a wider number of different values but with only a view
references (e.g. an article number in a commercial application).
INSTANCE_MODE_GET means that there is no free possibility to instanciate a new object, but there will be a getInstance() method
available in the created class that either gives back the reference to an existing definition or creates a new definition and holds this
definition in a Hashtable for further use. As long as there is no way to change the content of such a type, you also can use for comparison
the == operator because your program now only treats references to that kind of type.
INSTANCE_MODE_CONSTANTS_ONLY means that there cannot be any instanciation of this type and there are only the
constants available that have been defined (example: a datatype that holds values for Mr. or Mrs. does not need any
other values, so you cannot create new instances).
The structure E4DBTypes holds a collection of all datatypes in your project. The datatype meta-dictionary information
is stored in an XML file, propably this will be dict_app_*.xml in your dictionary definition path.
- Since:
- JDK 1.4
- See Also:
E4DBTypes,
E4Long,
E4String,
E4StringImage,
E4DBTypeUsage
|
Constructor Summary |
E4DBType()
|
E4DBType(java.lang.String name,
java.lang.String rem)
|
| Methods inherited from class e4s.db.dict.E4DBGeneratedClass |
_getSVNVersionString, getCreated, getDeprecated, getGenerationOutputPath, getGenerationOutputPath, getModified, getPackage, getPackagePath, getPlugins, hasChanged, isSystem, printGenerateHeader, resetChanged, setCreated, setDeprecated, setHasChanged, setModified, setPackage, setSystem, toXml_Package |
| Methods inherited from class e4s.util.E4Object |
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_XML_TAG_TYPE
public static final java.lang.String _XML_TAG_TYPE
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_NAME
public static final java.lang.String _XML_ATTR_TYPE_NAME
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_SYSTEM
public static final java.lang.String _XML_ATTR_TYPE_SYSTEM
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_LENGTH
public static final java.lang.String _XML_ATTR_TYPE_LENGTH
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_DATATYPE
public static final java.lang.String _XML_ATTR_TYPE_DATATYPE
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_NULLABLE
public static final java.lang.String _XML_ATTR_TYPE_NULLABLE
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_INSTANCE_GET
public static final java.lang.String _XML_ATTR_TYPE_INSTANCE_GET
- See Also:
- Constant Field Values
_XML_ATTR_TYPE_IMPLEMENTS
public static final java.lang.String _XML_ATTR_TYPE_IMPLEMENTS
- See Also:
- Constant Field Values
_XML_ATTR_USERDEFINED_CODE_DETECTED
public static final java.lang.String _XML_ATTR_USERDEFINED_CODE_DETECTED
- See Also:
- Constant Field Values
INSTANCE_MODE_CONSTANTS_ONLY
public static final char INSTANCE_MODE_CONSTANTS_ONLY
- See Also:
- Constant Field Values
INSTANCE_MODE_GET
public static final char INSTANCE_MODE_GET
- See Also:
- Constant Field Values
INSTANCE_MODE_NEW
public static final char INSTANCE_MODE_NEW
- See Also:
- Constant Field Values
_XML_TAG_CONSTANT
public static final java.lang.String _XML_TAG_CONSTANT
- See Also:
- Constant Field Values
_XML_ATTR_CONST_NAME
public static final java.lang.String _XML_ATTR_CONST_NAME
- See Also:
- Constant Field Values
_XML_ATTR_CONST_VAL
public static final java.lang.String _XML_ATTR_CONST_VAL
- See Also:
- Constant Field Values
_XML_ATTR_CONST_LABEL
public static final java.lang.String _XML_ATTR_CONST_LABEL
- See Also:
- Constant Field Values
E4DBType
public E4DBType()
E4DBType
public E4DBType(java.lang.String name,
java.lang.String rem)
getName
public E4DBColumnType getName()
getNullable
public boolean getNullable()
setNullable
public void setNullable(boolean nullable)
getLen
public int getLen()
setLen
public void setLen(int len)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRem
public java.lang.String getRem()
setRem
public void setRem(java.lang.String rem)
getConstants
public java.util.Hashtable getConstants()
addConstant
public void addConstant(java.lang.String id,
long val,
java.lang.String label)
throws java.lang.Exception
- Throws:
java.lang.Exception
addConstant
public void addConstant(java.lang.String id,
java.lang.String val,
java.lang.String label)
throws java.lang.Exception
- Throws:
java.lang.Exception
findConstant
public E4DBType.E4DBTypeConst findConstant(java.lang.String id)
throws java.lang.Exception
- Throws:
java.lang.Exception
is_E4String
public boolean is_E4String()
equals
public boolean equals(E4DBType type)
is_E4Long
public boolean is_E4Long()
is_E4Date
public boolean is_E4Date()
is_E4StringImage
public boolean is_E4StringImage()
getDatatype
public java.lang.Class getDatatype()
setDatatype
public void setDatatype(java.lang.Class datatype)
throws java.lang.Exception
- Throws:
java.lang.Exception
setDatatype
public void setDatatype(java.lang.String datatype)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDatatypeStrClass
public java.lang.String getDatatypeStrClass()
- Return datatype and length as String.
- Returns:
- the class name of the datatype and propably the length, if length is relevant
- See Also:
getDatatypeStr()
generateClass
public void generateClass()
throws E4DBException
- Throws:
E4DBException
generateClass
public void generateClass(java.lang.String path)
throws E4DBException
- Throws:
E4DBException
generateClass_E4String
public void generateClass_E4String(java.lang.String path)
throws E4DBException
- Throws:
E4DBException
deleteClass
public void deleteClass()
throws java.io.IOException
- Throws:
java.io.IOException
getUsage
public java.util.Vector getUsage()
throws java.lang.Exception
- Throws:
java.lang.Exception
getUsage
public java.util.Vector getUsage(boolean include_views)
throws E4DBException
- Throws:
E4DBException
generateClass_E4Long
public void generateClass_E4Long(java.lang.String path)
throws E4DBException
- Throws:
E4DBException
generateClass_E4Date
public void generateClass_E4Date(java.lang.String path)
throws E4DBException
- Throws:
E4DBException
getConstantsArray
public E4DBType.E4DBTypeConst[] getConstantsArray()
toXml
public void toXml(E4PrintStream pstr)
throws java.lang.Exception
- Writs the current database object into the given XML stream.
- Parameters:
pstr - a stream, opened in write mode
- Throws:
java.lang.Exception- See Also:
E4DBDict.readDictionary(),
E4DBTypes.toXml(java.lang.String, e4s.util.E4PrintStream)
toString
public java.lang.String toString()
- Overrides:
toString in class E4Object
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo in interface java.lang.Comparable
Escape
public static java.lang.String Escape(java.lang.String s)
- Escapes the double quote character (") by backslash followed by double quote.
- Parameters:
s - the string where single quotes need to be replaced
- Returns:
- the string with the replacements
- See Also:
E4DBFilter.Escape(String)
getDatatypeStrShort
public java.lang.String getDatatypeStrShort()
getDatatypeStr
public java.lang.String getDatatypeStr()
isSystemType
public boolean isSystemType()
setSystemType
public void setSystemType(boolean mode)
removeClass
public void removeClass()
renameColumn
public boolean renameColumn(E4DBTableName tablename,
E4DBColumnName from,
E4DBColumnName to)
setName
public void setName(E4DBColumnType newname)
setInstanceMode
public void setInstanceMode(char mode)
getInstanceMode
public char getInstanceMode()
getImplementsInterface
public java.lang.Class[] getImplementsInterface()
throws java.lang.Exception
- Throws:
java.lang.Exception
setImplementsInterface
public void setImplementsInterface(java.lang.String implements_interface)
throws java.lang.Exception
- Set interfaces for the type.
- Parameters:
implements_interface - is a comma (,) seperated list of class names including full qualified package names
- Throws:
java.lang.Exception
setUserDefinedCode
public void setUserDefinedCode(int modules)