Package org.eclipse.epsilon.eol.models
Class Model
- java.lang.Object
-
- org.eclipse.epsilon.eol.models.Model
-
- All Implemented Interfaces:
AutoCloseable
,IModel
- Direct Known Subclasses:
CachedModel
,CompositeModel
,EmptyModel
,HutnModel
,JavaModel
,JavaObjectModel
,ModelGroup
,MuddleModel
,PatternMatchModel
,SpreadsheetModel
public abstract class Model extends Object implements IModel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.epsilon.eol.models.IModel
IModel.AmbiguityCheckResult
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
aliases
protected static String
ENV_PREFIX
Used for acquiring properties externally (e.g.protected String
name
static String
PROPERTY_ALIASES
static String
PROPERTY_NAME
static String
PROPERTY_READONLOAD
static String
PROPERTY_READONLY
Indicates that the model will not be modified.static String
PROPERTY_STOREONDISPOSAL
protected IPropertyGetter
propertyGetter
protected IPropertySetter
propertySetter
protected boolean
readOnLoad
protected boolean
storeOnDisposal
-
Constructor Summary
Constructors Constructor Description Model()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<?>
allInstances()
Object
createInstance(String type, Collection<Object> parameters)
void
dispose()
List<String>
getAliases()
String
getFullyQualifiedTypeNameOf(Object instance)
Returns a string representing the fully-qualified type of the instance object.Metamodel
getMetamodel(StringProperties properties, IRelativePathResolver resolver)
String
getName()
IPropertyGetter
getPropertyGetter()
IPropertySetter
getPropertySetter()
IModelTransactionSupport
getTransactionSupport()
Object
getTypeOf(Object instance)
boolean
isModelElement(Object instance)
Used to test whether a Java object can be contained by this model.boolean
isOfKind(Object instance, String metaClass)
boolean
isOfType(Object instance, String metaClass)
boolean
isPropertySet(Object instance, String property)
Returnstrue
if this instance has an explicit value for this property.boolean
isReadOnLoad()
boolean
isStoredOnDisposal()
boolean
knowsAboutProperty(Object instance, String property)
Returnstrue
if this instance could have this property at some point.void
load(StringProperties properties)
void
load(StringProperties properties, String basePath)
void
load(StringProperties properties, IRelativePathResolver resolver)
void
setName(String name)
void
setReadOnLoad(boolean readOnLoad)
void
setStoredOnDisposal(boolean storedOnDisposal)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.epsilon.eol.models.IModel
allContents, checkAmbiguity, close, createInstance, deleteElement, getAllOfKind, getAllOfType, getElementById, getElementId, getEnumerationValue, getTypeNameOf, hasType, isInstantiable, load, owns, setElementId, store, store
-
-
-
-
Field Detail
-
PROPERTY_NAME
public static final String PROPERTY_NAME
- See Also:
- Constant Field Values
-
PROPERTY_READONLOAD
public static final String PROPERTY_READONLOAD
- See Also:
- Constant Field Values
-
PROPERTY_STOREONDISPOSAL
public static final String PROPERTY_STOREONDISPOSAL
- See Also:
- Constant Field Values
-
PROPERTY_ALIASES
public static final String PROPERTY_ALIASES
- See Also:
- Constant Field Values
-
PROPERTY_READONLY
public static final String PROPERTY_READONLY
Indicates that the model will not be modified.- Since:
- 1.6
- See Also:
- Constant Field Values
-
ENV_PREFIX
protected static final String ENV_PREFIX
Used for acquiring properties externally (e.g. from environment variables)- Since:
- 1.6
- See Also:
- Constant Field Values
-
name
protected String name
-
storeOnDisposal
protected boolean storeOnDisposal
-
readOnLoad
protected boolean readOnLoad
-
propertyGetter
protected IPropertyGetter propertyGetter
- Since:
- 1.6
-
propertySetter
protected IPropertySetter propertySetter
- Since:
- 1.6
-
-
Method Detail
-
getAliases
public List<String> getAliases()
- Specified by:
getAliases
in interfaceIModel
-
load
public void load(StringProperties properties, String basePath) throws EolModelLoadingException
- Specified by:
load
in interfaceIModel
- Throws:
EolModelLoadingException
-
load
public void load(StringProperties properties) throws EolModelLoadingException
- Specified by:
load
in interfaceIModel
- Throws:
EolModelLoadingException
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException
- Specified by:
load
in interfaceIModel
- Throws:
EolModelLoadingException
-
createInstance
public Object createInstance(String type, Collection<Object> parameters) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException
- Specified by:
createInstance
in interfaceIModel
- Throws:
EolModelElementTypeNotFoundException
EolNotInstantiableModelElementTypeException
-
allInstances
public Collection<?> allInstances()
-
isOfKind
public boolean isOfKind(Object instance, String metaClass) throws EolModelElementTypeNotFoundException
- Specified by:
isOfKind
in interfaceIModel
- Throws:
EolModelElementTypeNotFoundException
-
isOfType
public boolean isOfType(Object instance, String metaClass) throws EolModelElementTypeNotFoundException
- Specified by:
isOfType
in interfaceIModel
- Throws:
EolModelElementTypeNotFoundException
-
getFullyQualifiedTypeNameOf
public String getFullyQualifiedTypeNameOf(Object instance)
Description copied from interface:IModel
Returns a string representing the fully-qualified type of the instance object. The value returned by this function can be passed to createInstance to instantiate another object of the same type as instance.- Specified by:
getFullyQualifiedTypeNameOf
in interfaceIModel
- Parameters:
instance
- The model object whose type is to be determined.- Returns:
- the name of the type of the model object, instance.
-
isModelElement
public boolean isModelElement(Object instance)
Description copied from interface:IModel
Used to test whether a Java object can be contained by this model. For example, EMF models can contain instances of EObject, but not instances of just Object.- Specified by:
isModelElement
in interfaceIModel
- Parameters:
instance
- the Java object to test.- Returns:
- true if and only if instance can be contained by this model.
-
isReadOnLoad
public boolean isReadOnLoad()
- Specified by:
isReadOnLoad
in interfaceIModel
-
isStoredOnDisposal
public boolean isStoredOnDisposal()
- Specified by:
isStoredOnDisposal
in interfaceIModel
-
setReadOnLoad
public void setReadOnLoad(boolean readOnLoad)
- Specified by:
setReadOnLoad
in interfaceIModel
-
setStoredOnDisposal
public void setStoredOnDisposal(boolean storedOnDisposal)
- Specified by:
setStoredOnDisposal
in interfaceIModel
-
getPropertyGetter
public IPropertyGetter getPropertyGetter()
- Specified by:
getPropertyGetter
in interfaceIModel
-
getPropertySetter
public IPropertySetter getPropertySetter()
- Specified by:
getPropertySetter
in interfaceIModel
-
knowsAboutProperty
public boolean knowsAboutProperty(Object instance, String property)
Description copied from interface:IModel
Returnstrue
if this instance could have this property at some point.- Specified by:
knowsAboutProperty
in interfaceIModel
-
getTransactionSupport
public IModelTransactionSupport getTransactionSupport()
- Specified by:
getTransactionSupport
in interfaceIModel
-
getMetamodel
public Metamodel getMetamodel(StringProperties properties, IRelativePathResolver resolver)
- Specified by:
getMetamodel
in interfaceIModel
-
isPropertySet
public boolean isPropertySet(Object instance, String property) throws EolRuntimeException
Description copied from interface:IModel
Returnstrue
if this instance has an explicit value for this property. This would be equivalent to eIsSet in EMF.- Specified by:
isPropertySet
in interfaceIModel
- Throws:
EolRuntimeException
-
-