|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nrl.parser.type.TypeMapping
public class TypeMapping
A default type mapping implementation. The type mapping is completely empty and can be populated
using the add
methods before use.
Alternatively, a subclass with a serializer/deserializer method can be used to load and save the
mapping to a file, for example XmlTypeMapping
.
Constructor Summary | |
---|---|
TypeMapping()
|
Method Summary | |
---|---|
void |
addAll(TypeMapping other)
Add all entries from another mapping to this one. |
TypeMappingEntry |
addMapping(String packageName,
String typeName,
NRLDataType type)
Add a mapping from a type name, in a particular package, to an internal type. |
void |
clear()
Empty the mapping. |
boolean |
contains(String packageName,
String typeName)
Return true if this contains a mapping for a particular package and type name. |
List<TypeMappingEntry> |
getMapping()
Return the type mapping entries, in order. |
static String |
getStringForType(NRLDataType type)
Return a serializable string for the integer constant from NRLDataType . |
NRLDataType |
getType(IAttribute attr)
Map the type of an attribute to an internal abstract type. |
NRLDataType |
getType(IModelElement element)
Map a model element to an internal, abstract type. |
static NRLDataType |
getTypeFromString(String type)
Convert a string representation of a type back to an integer number. |
void |
remove(String packageName,
String modelElementName)
Remove a particular mapping |
void |
rename(String oldPackageName,
String oldModelElementName,
String newPackageName,
String newModelElementName)
Rename an entry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeMapping()
Method Detail |
---|
public void addAll(TypeMapping other)
other
- the mapping to addpublic TypeMappingEntry addMapping(String packageName, String typeName, NRLDataType type)
packageName
- the package name or "*"typeName
- the type (class/data type) nametype
- the target typepublic void clear()
public boolean contains(String packageName, String typeName)
packageName
- the packagetypeName
- the type
public List<TypeMappingEntry> getMapping()
public static String getStringForType(NRLDataType type)
NRLDataType
. If it is not
one of the constants, returns "Unknown".
type
- the type value
public static NRLDataType getTypeFromString(String type)
getStringForType(NRLDataType)
. If it is not one of
this, returns NRLDataType.UNKNOWN
.
type
- the string
public NRLDataType getType(IAttribute attr)
ITypeMapping
getType
in interface ITypeMapping
attr
- the attribute
public NRLDataType getType(IModelElement element)
ITypeMapping
NRLDataType.ELEMENT
.
getType
in interface ITypeMapping
element
- the element
public void remove(String packageName, String modelElementName)
packageName
- the package namemodelElementName
- the type namepublic void rename(String oldPackageName, String oldModelElementName, String newPackageName, String newModelElementName)
oldPackageName
- the old package nameoldModelElementName
- the old type namenewPackageName
- the new package namenewModelElementName
- new type name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |