public abstract class AbstractEmfModel extends CachedModel<org.eclipse.emf.ecore.EObject>
Modifier and Type | Field and Description |
---|---|
protected boolean |
expand |
protected org.eclipse.emf.ecore.resource.Resource |
modelImpl |
static String |
PROPERTY_EXPAND
One of the keys used to construct the first argument to
Model.load(StringProperties, String) . |
static String |
PROPERTY_PARALLELALLOF
Whether to perform getAllOfKind and getAllOfType operations in parallel.
|
protected org.eclipse.emf.ecore.EPackage.Registry |
registry |
protected EmfModelTransactionSupport |
transactionSupport |
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCache
aliases, ENV_PREFIX, name, PROPERTY_ALIASES, PROPERTY_NAME, PROPERTY_READONLOAD, PROPERTY_READONLY, PROPERTY_STOREONDISPOSAL, propertyGetter, propertySetter, readOnLoad, storeOnDisposal
Constructor and Description |
---|
AbstractEmfModel() |
Modifier and Type | Method and Description |
---|---|
void |
addMetamodelUri(String nsUri) |
protected Collection<org.eclipse.emf.ecore.EObject> |
allContentsFromModel() |
org.eclipse.emf.ecore.EClass |
classForName(String name) |
protected org.eclipse.emf.ecore.EClass |
classForName(String name,
boolean absolute,
org.eclipse.emf.ecore.EPackage pkg) |
protected org.eclipse.emf.ecore.EClass |
classForName(String name,
org.eclipse.emf.ecore.EPackage.Registry registry) |
protected org.eclipse.emf.ecore.EObject |
createInstanceInModel(String type) |
protected boolean |
deleteElementInModel(Object instance)
Returns true iff the given instance was deleted from the model.
|
void |
disposeModel() |
protected Collection<org.eclipse.emf.ecore.EObject> |
getAllOfKindFromModel(String kind) |
protected Collection<org.eclipse.emf.ecore.EObject> |
getAllOfTypeFromModel(String type) |
Collection<String> |
getAllTypeNamesOf(Object instance)
Returns the fully qualified names of every type to which the
given object conforms.
|
Object |
getCacheKeyForType(String type)
Returns an identity for the given type,
which will be used by
CachedModel
as a key for the memoization of model elements
by type. |
Object |
getContainerOf(Object object) |
Object |
getElementById(String id) |
String |
getElementId(Object instance) |
Object |
getEnumerationValue(String enumeration,
String label) |
protected String |
getFullyQualifiedName(org.eclipse.emf.ecore.EClassifier eClassifier) |
String |
getFullyQualifiedTypeNameOf(Object instance)
Returns a string representing the fully-qualified type of the instance object.
|
protected InputStream |
getInputStream(String file) |
org.eclipse.emf.ecore.resource.Resource |
getModelImpl()
Deprecated.
Use
getResource() instead |
protected org.eclipse.emf.ecore.EPackage.Registry |
getPackageRegistry()
Get the (cached) package registry belonging to the model implementation,
if no registry is available the global one is provided
|
org.eclipse.emf.ecore.resource.Resource |
getResource() |
protected List<org.eclipse.emf.ecore.resource.Resource> |
getResources() |
IModelTransactionSupport |
getTransactionSupport() |
String |
getTypeNameOf(Object instance)
Returns a string representing the type of the instance object.
|
Object |
getTypeOf(Object instance) |
protected boolean |
hasAdapter(Class<? extends org.eclipse.emf.ecore.util.EContentAdapter> adapterType)
Determines whether this model has an adapter matching the specified type.
|
boolean |
hasType(String type) |
protected void |
initCaches()
Sets the caches based on this model's properties.
|
boolean |
isExpand() |
boolean |
isInstantiable(String type) |
boolean |
isLoaded()
Convenience method for determining when a model has been loaded.
|
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 |
isParallelAllOf() |
boolean |
isPropertySet(Object instance,
String property)
Returns
true if this instance has an explicit value for this property. |
protected boolean |
knowsAboutProperty(org.eclipse.emf.ecore.EObject instance,
String property) |
boolean |
knowsAboutProperty(Object instance,
String property)
Returns
true if this instance could have this property at some point. |
void |
load(StringProperties properties,
IRelativePathResolver resolver) |
boolean |
owns(Object instance)
Used to test whether an object is contained in this model.
|
void |
setElementId(Object instance,
String newId) |
void |
setExpand(boolean expand) |
void |
setModelImpl(org.eclipse.emf.ecore.resource.Resource modelImpl)
Deprecated.
Use
setResource(Resource) instead |
void |
setParallelAllOf(boolean parallel) |
void |
setResource(org.eclipse.emf.ecore.resource.Resource resource) |
boolean |
store(OutputStream os) |
boolean |
store(String fileName) |
boolean |
store(org.eclipse.emf.common.util.URI uri) |
addToCache, allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, isCachingEnabled, isConcurrent, load, loadModel, removeFromCache, setCachingEnabled, setConcurrent, wrap
allInstances, createInstance, getAliases, getMetamodel, getName, getPropertyGetter, getPropertySetter, isReadOnLoad, isStoredOnDisposal, load, load, setName, setReadOnLoad, setStoredOnDisposal
public static final String PROPERTY_EXPAND
Model.load(StringProperties, String)
.
When paired with "true", external references will be resolved during loading.
Otherwise, external references are not resolved.
Paired with "true" by default.public static final String PROPERTY_PARALLELALLOF
protected org.eclipse.emf.ecore.resource.Resource modelImpl
protected boolean expand
protected org.eclipse.emf.ecore.EPackage.Registry registry
protected EmfModelTransactionSupport transactionSupport
protected void initCaches()
CachedModel
CachedModel.cachingEnabled
or CachedModel.concurrent
)
as the caches will be reset.initCaches
in class CachedModel<org.eclipse.emf.ecore.EObject>
protected InputStream getInputStream(String file) throws IOException
IOException
public void addMetamodelUri(String nsUri)
protected org.eclipse.emf.ecore.EPackage.Registry getPackageRegistry()
public Object getEnumerationValue(String enumeration, String label) throws EolEnumerationValueNotFoundException
public boolean knowsAboutProperty(Object instance, String property)
IModel
true
if this instance could have this property at some point.knowsAboutProperty
in interface IModel
knowsAboutProperty
in class Model
protected boolean knowsAboutProperty(org.eclipse.emf.ecore.EObject instance, String property)
public boolean isPropertySet(Object instance, String property) throws EolRuntimeException
IModel
true
if this instance has an explicit value for this property.
This would be equivalent to eIsSet in EMF.isPropertySet
in interface IModel
isPropertySet
in class Model
EolRuntimeException
protected Collection<org.eclipse.emf.ecore.EObject> getAllOfTypeFromModel(String type) throws EolModelElementTypeNotFoundException
getAllOfTypeFromModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolModelElementTypeNotFoundException
protected Collection<org.eclipse.emf.ecore.EObject> getAllOfKindFromModel(String kind) throws EolModelElementTypeNotFoundException
getAllOfKindFromModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolModelElementTypeNotFoundException
public Object getCacheKeyForType(String type) throws EolModelElementTypeNotFoundException
CachedModel
CachedModel
as a key for the memoization of model elements
by type.getCacheKeyForType
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolModelElementTypeNotFoundException
public org.eclipse.emf.ecore.EClass classForName(String name) throws EolModelElementTypeNotFoundException
protected org.eclipse.emf.ecore.EClass classForName(String name, org.eclipse.emf.ecore.EPackage.Registry registry)
protected org.eclipse.emf.ecore.EClass classForName(String name, boolean absolute, org.eclipse.emf.ecore.EPackage pkg)
protected Collection<org.eclipse.emf.ecore.EObject> allContentsFromModel()
allContentsFromModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
protected org.eclipse.emf.ecore.EObject createInstanceInModel(String type) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException
createInstanceInModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolModelElementTypeNotFoundException
EolNotInstantiableModelElementTypeException
public IModelTransactionSupport getTransactionSupport()
getTransactionSupport
in interface IModel
getTransactionSupport
in class Model
protected boolean deleteElementInModel(Object instance) throws EolRuntimeException
CachedModel
deleteElementInModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolRuntimeException
public boolean owns(Object instance)
IModel
instance
- the Java object to test.public boolean store(String fileName)
public boolean store(org.eclipse.emf.common.util.URI uri)
public boolean store(OutputStream os)
public void disposeModel()
disposeModel
in class CachedModel<org.eclipse.emf.ecore.EObject>
public org.eclipse.emf.ecore.resource.Resource getResource()
public void setResource(org.eclipse.emf.ecore.resource.Resource resource)
@Deprecated public org.eclipse.emf.ecore.resource.Resource getModelImpl()
getResource()
insteadpublic void setModelImpl(org.eclipse.emf.ecore.resource.Resource modelImpl)
setResource(Resource)
insteadprotected List<org.eclipse.emf.ecore.resource.Resource> getResources()
public String getTypeNameOf(Object instance)
IModel
instance
- The model object whose type is to be determined.public String getFullyQualifiedTypeNameOf(Object instance)
IModel
getFullyQualifiedTypeNameOf
in interface IModel
getFullyQualifiedTypeNameOf
in class Model
instance
- The model object whose type is to be determined.public Collection<String> getAllTypeNamesOf(Object instance)
CachedModel
CachedModel
for the memoization of
model elements by their kind (CachedModel.getAllOfKind(String)
).getAllTypeNamesOf
in class CachedModel<org.eclipse.emf.ecore.EObject>
public boolean isInstantiable(String type)
public boolean hasType(String type)
protected boolean hasAdapter(Class<? extends org.eclipse.emf.ecore.util.EContentAdapter> adapterType)
adapterType
- The adapter class.true
if this model's adapters contains the specified adapter type.protected String getFullyQualifiedName(org.eclipse.emf.ecore.EClassifier eClassifier)
public boolean isModelElement(Object instance)
IModel
isModelElement
in interface IModel
isModelElement
in class Model
instance
- the Java object to test.public boolean isOfKind(Object instance, String metaClass) throws EolModelElementTypeNotFoundException
isOfKind
in interface IModel
isOfKind
in class Model
EolModelElementTypeNotFoundException
public boolean isOfType(Object instance, String metaClass) throws EolModelElementTypeNotFoundException
isOfType
in interface IModel
isOfType
in class Model
EolModelElementTypeNotFoundException
public boolean isExpand()
public void setExpand(boolean expand)
public void setParallelAllOf(boolean parallel)
parallel
- public boolean isParallelAllOf()
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException
load
in interface IModel
load
in class CachedModel<org.eclipse.emf.ecore.EObject>
EolModelLoadingException
public boolean isLoaded()
CachedModel
isLoaded
in class CachedModel<org.eclipse.emf.ecore.EObject>
Copyright © 2020. All rights reserved.