public class TypeMapping extends Object implements ITypeMapping
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 and Description |
|---|
TypeMapping() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 typepublic List<TypeMappingEntry> getMapping()
public static String getStringForType(NRLDataType type)
NRLDataType. If it is not
one of the constants, returns "Unknown".type - the type valuepublic static NRLDataType getTypeFromString(String type)
getStringForType(NRLDataType). If it is not one of
this, returns NRLDataType.UNKNOWN.type - the stringpublic NRLDataType getType(IAttribute attr)
ITypeMappinggetType in interface ITypeMappingattr - the attributepublic NRLDataType getType(IModelElement element)
ITypeMappingNRLDataType.ELEMENT.getType in interface ITypeMappingelement - the elementpublic 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 nameCopyright © 2006-2013. All Rights Reserved.