Package org.eclipse.epsilon.emc.json
Class JsonModel
- All Implemented Interfaces:
AutoCloseable
,IModel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.epsilon.eol.models.IModel
IModel.AmbiguityCheckResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Object
protected File
static final String
static final String
protected String
static final String
static final String
static final char
static final String
static final String
static final String
protected String
protected String
Fields inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCache
Fields inherited from class org.eclipse.epsilon.eol.models.Model
aliases, ENV_PREFIX, name, PROPERTY_ALIASES, PROPERTY_NAME, PROPERTY_READONLOAD, PROPERTY_READONLY, PROPERTY_STOREONDISPOSAL, propertyGetter, propertySetter, readOnLoad, storeOnDisposal
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<Object>
protected Object
createInstanceInModel
(String type) static Object
protected boolean
deleteElementInModel
(Object instance) Returns true iff the given instance was deleted from the model.protected void
protected Collection<Object>
getAllOfKindFromModel
(String kind) protected Collection<Object>
getAllOfTypeFromModel
(String type) protected Collection<String>
getAllTypeNamesOf
(Object instance) Returns the fully qualified names of every type to which the given object conforms.protected Object
getCacheKeyForType
(String type) Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.getElementById
(String id) getElementId
(Object instance) getEnumerationValue
(String enumeration, String label) getFile()
getRoot()
getTypeNameOf
(Object instance) Returns a string representing the type of the instance object.getUri()
boolean
boolean
isInstantiable
(String type) boolean
isLoaded()
Convenience method for determining when a model has been loaded.void
load
(StringProperties properties, IRelativePathResolver resolver) protected void
boolean
Used to test whether an object is contained in this model.void
setElementId
(Object instance, String newId) void
void
void
Convenience method for loading the JSON content directly from a string, instead of loading it from a file or URI.void
setPassword
(String password) void
void
void
setUsername
(String username) boolean
store()
boolean
toString()
Methods inherited from class org.eclipse.epsilon.eol.models.CachedModel
addToCache, allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, initCaches, isCachingEnabled, isConcurrent, load, removeFromCache, setCachingEnabled, setConcurrent, wrap
Methods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, createInstance, getAliases, getFullyQualifiedTypeNameOf, getMetamodel, getName, getPropertyGetter, getPropertySetter, getTransactionSupport, getTypeOf, isModelElement, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, setName, setReadOnLoad, setStoredOnDisposal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.eol.models.IModel
checkAmbiguity, close
-
Field Details
-
JSON_ARRAY_TYPE
- See Also:
-
JSON_OBJECT_TYPE
- See Also:
-
PROPERTY_FILE
- See Also:
-
PROPERTY_URI
- See Also:
-
PROPERTY_USERNAME
- See Also:
-
PROPERTY_PASSWORD
- See Also:
-
PROPERTY_HEADER_PREFIX
- See Also:
-
PROPERTY_HEADER_SEPARATOR
public static final char PROPERTY_HEADER_SEPARATOR- See Also:
-
file
-
uri
-
username
-
password
-
headers
-
_root
-
-
Constructor Details
-
JsonModel
public JsonModel()
-
-
Method Details
-
getRoot
-
setRoot
-
setFile
-
getFile
-
setUri
-
getUri
-
setUsername
-
getUsername
-
setPassword
-
getPassword
-
getEnumerationValue
public Object getEnumerationValue(String enumeration, String label) throws EolEnumerationValueNotFoundException -
getTypeNameOf
Description copied from interface:IModel
Returns a string representing the 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.- Parameters:
instance
- The model object whose type is to be determined.- Returns:
- the name of the type of the model object, instance.
-
getElementById
-
getElementId
-
setElementId
-
owns
Description copied from interface:IModel
Used to test whether an object is contained in this model.- Parameters:
instance
- the Java object to test.- Returns:
- true if and only if instance is contained by this model.
-
isInstantiable
-
hasType
-
store
-
store
public boolean store() -
allContentsFromModel
- Specified by:
allContentsFromModel
in classCachedModel<Object>
-
getAllOfTypeFromModel
protected Collection<Object> getAllOfTypeFromModel(String type) throws EolModelElementTypeNotFoundException - Specified by:
getAllOfTypeFromModel
in classCachedModel<Object>
- Throws:
EolModelElementTypeNotFoundException
-
getAllOfKindFromModel
protected Collection<Object> getAllOfKindFromModel(String kind) throws EolModelElementTypeNotFoundException - Specified by:
getAllOfKindFromModel
in classCachedModel<Object>
- Throws:
EolModelElementTypeNotFoundException
-
createInstanceInModel
protected Object createInstanceInModel(String type) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException - Specified by:
createInstanceInModel
in classCachedModel<Object>
- Throws:
EolModelElementTypeNotFoundException
EolNotInstantiableModelElementTypeException
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException - Specified by:
load
in interfaceIModel
- Overrides:
load
in classCachedModel<Object>
- Throws:
EolModelLoadingException
-
loadModel
- Specified by:
loadModel
in classCachedModel<Object>
- Throws:
EolModelLoadingException
-
deepClone
-
disposeModel
protected void disposeModel()- Specified by:
disposeModel
in classCachedModel<Object>
-
deleteElementInModel
Description copied from class:CachedModel
Returns true iff the given instance was deleted from the model.- Specified by:
deleteElementInModel
in classCachedModel<Object>
- Throws:
EolRuntimeException
-
getCacheKeyForType
Description copied from class:CachedModel
Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.- Specified by:
getCacheKeyForType
in classCachedModel<Object>
- Throws:
EolModelElementTypeNotFoundException
-
getAllTypeNamesOf
Description copied from class:CachedModel
Returns the fully qualified names of every type to which the given object conforms. The values are used by byCachedModel
for the memoization of model elements by their kind (CachedModel.getAllOfKind(String)
).- Specified by:
getAllTypeNamesOf
in classCachedModel<Object>
-
isLoaded
public boolean isLoaded()Description copied from class:CachedModel
Convenience method for determining when a model has been loaded.- Overrides:
isLoaded
in classCachedModel<Object>
- Returns:
- Whether the cache has been populated.
-
getHeader
-
setHeader
-
toString
-
setJsonContent
Convenience method for loading the JSON content directly from a string, instead of loading it from a file or URI. The model will consider itself loaded.
-