|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.dataeditor.DataType
public class DataType
Represents a data-type. A type can be user defined and consist of other types.
Copyright Enough Software 2004 - 2011
history
18-Oct-2004 - rob creation
| Field Summary | |
|---|---|
static DataType |
ASCII_STRING
|
static int |
ASCII_STRING_ID
|
static DataType |
BOOLEAN
|
static int |
BOOLEAN_ID
|
static DataType |
BYTE
|
static int |
BYTE_ID
|
static DataType |
INTEGER
|
static int |
INTEGER_ID
|
static DataType |
LONG
|
static int |
LONG_ID
|
static DataType |
PNG_IMAGE
|
static int |
PNG_IMAGE_ID
|
static DataType |
SHORT
|
static int |
SHORT_ID
|
static DataType |
UNSIGNED_BYTE
|
static int |
UNSIGNED_BYTE_ID
|
static DataType |
UNSIGNED_SHORT
|
static int |
UNSIGNED_SHORT_ID
|
static int |
USER_DEFINED_ID
|
static DataType |
UTF_STRING
|
static int |
UTF_STRING_ID
|
| Constructor Summary | |
|---|---|
DataType(org.jdom.Element typeElement,
DataManager dataManager)
|
|
DataType(String name,
DataType[] subtypes)
Creates a new user defined type. |
|
DataType(String name,
int type,
int numberOfBytes)
Creates a new simple type. |
|
| Method Summary | |
|---|---|
void |
addCode(String count,
String paramName,
StringBuffer buffer)
Adds the Java code to load this type. |
void |
addInstanceDeclaration(String count,
String paramName,
StringBuffer buffer)
|
void |
addInternalClass(Map implementedTypes,
StringBuffer buffer)
|
static DataType[] |
getDefaultTypes()
|
Object |
getDefaultValue()
|
int |
getIntRepresentation(Object data)
Retrieves the INT representation for a given object. |
String |
getJavaType()
|
String |
getName()
Retrieves the name of this DataType. |
int |
getNumberOfBytes()
|
DataType[] |
getSubtypes()
|
int |
getType()
|
String |
getXmlRepresentation()
Retrieves the XML representation for this DataEntry. |
boolean |
isDynamic()
Determines when this type has a dynamic (i.e. |
boolean |
isUserDefined()
|
Object |
loadData(DataInputStream in)
Loads data for this type from the given input stream |
Object |
parseDataString(String value)
|
void |
saveData(Object value,
DataOutputStream out)
Saves the data for this type. |
String |
toString()
|
String |
toString(Object data)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int BYTE_ID
public static final int UNSIGNED_BYTE_ID
public static final int SHORT_ID
public static final int UNSIGNED_SHORT_ID
public static final int INTEGER_ID
public static final int LONG_ID
public static final int ASCII_STRING_ID
public static final int UTF_STRING_ID
public static final int BOOLEAN_ID
public static final int PNG_IMAGE_ID
public static final int USER_DEFINED_ID
public static final DataType BYTE
public static final DataType UNSIGNED_BYTE
public static final DataType SHORT
public static final DataType UNSIGNED_SHORT
public static final DataType INTEGER
public static final DataType LONG
public static final DataType ASCII_STRING
public static final DataType UTF_STRING
public static final DataType BOOLEAN
public static final DataType PNG_IMAGE
| Constructor Detail |
|---|
public DataType(String name,
int type,
int numberOfBytes)
name - the name of this typetype - the type-IDnumberOfBytes - the number of bytes which are needed to store this type, -1 if undefined
public DataType(String name,
DataType[] subtypes)
name - the name of this typesubtypes - the subtypes of this user defined type.
public DataType(org.jdom.Element typeElement,
DataManager dataManager)
typeElement - dataManager - | Method Detail |
|---|
public int getType()
public DataType[] getSubtypes()
public boolean isUserDefined()
public int getNumberOfBytes()
public Object getDefaultValue()
public String toString(Object data)
public Object parseDataString(String value)
public String getName()
DataType.
public int getIntRepresentation(Object data)
data - the data object to represent
public String getXmlRepresentation()
DataEntry. This is useful
e.g. for saving it into a file.
public String toString()
toString in class Objectpublic static DataType[] getDefaultTypes()
public boolean isDynamic()
public String getJavaType()
public void addInstanceDeclaration(String count,
String paramName,
StringBuffer buffer)
public void addCode(String count,
String paramName,
StringBuffer buffer)
count - the number of instances which should be loaded, can either
be a number or a term like "rows * cells".paramName - the name of the parameterbuffer - the string buffer to which the code should be added.
public void addInternalClass(Map implementedTypes,
StringBuffer buffer)
public Object loadData(DataInputStream in)
throws IOException
in - the input stream
IOException - when the data could not be read
public void saveData(Object value,
DataOutputStream out)
throws IOException
value - the valueout - the data output stream
IOException - when the data could not be stored
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||