public final class Type extends Object
The type system implemented in Diva is semi-dynamic. There is a class SimpleData that is dynamically typed; the only data that it contains is the type that is associated with a particular recognized object. For all other objects with semantic information (e.g. TextType, which contains the recognized text), the type system uses Java's runtime type system. This is an implementation detail, and is transparent to the user.
There are two ways to get a handle to a type object. The static method Type.getType with a String name argument will return a static type if the name has been registered as static. Otherwise it will return a dynamic type. There is also a getType method with a Class object argument that can be used to create a static type.
TypedData
,
SimpleData
Modifier and Type | Field and Description |
---|---|
static Type |
NO_TYPE
The type to be associated with an unrecognized
piece of data.
|
Modifier and Type | Method and Description |
---|---|
static void |
addStaticType(String staticType)
Add a static type to the Type system.
|
boolean |
equals(Object o)
Return whether the given type object is equivalent to
this one.
|
String |
getID()
Return the type ID of this object.
|
Type |
getParent()
Return the parent type of this one.
|
int |
hashCode()
Override the hashCode() method so that
objects of the same type hash to the same
index.
|
static boolean |
isStaticType(String typeID)
Return whether the given type name has been
registered as a native type in this type
system.
|
static Type |
makeType(Class c)
Return the type object associated with the given
class and register it as static.
|
static Type |
makeType(String typeName)
Return the type object associated with the given
type name.
|
String |
toString()
Return a string representation of the type object.
|
public static final Type NO_TYPE
public static void addStaticType(String staticType) throws ClassNotFoundException
ClassNotFoundException
public boolean equals(Object o)
public String getID()
public Type getParent()
public int hashCode()
public static boolean isStaticType(String typeID)
public static Type makeType(String typeName)
public static Type makeType(Class c)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.