P
- the type of the supported PersistenceBackend
public abstract class AbstractDirectWriteStore<P extends PersistenceBackend> extends AbstractPersistentStore implements DirectWriteStore
DirectWriteStore
that redirects certain methods according to the instance of the encountered
EStructuralFeature
. If the subclass does not re-implement the inherited methods of EMF, the call is
automatically redirected to the associated method that begins with the same name.Modifier and Type | Field and Description |
---|---|
protected P |
backend
The persistence back-end used to store the model.
|
NO_INDEX
Constructor and Description |
---|
AbstractDirectWriteStore(Resource.Internal resource,
P backend)
Constructs a new
AbstractDirectWriteStore between the given resource and the backend . |
Modifier and Type | Method and Description |
---|---|
void |
add(InternalEObject internalObject,
EStructuralFeature feature,
int index,
Object value)
Adds the value at the index in the
content of the object's feature. |
protected void |
addAttribute(PersistentEObject object,
EAttribute attribute,
int index,
Object value)
Adds the
value at the index in the content of the attribute of the object . |
protected void |
addReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Adds the
value at the index in the content of the reference of the object . |
void |
clear(InternalEObject internalObject,
EStructuralFeature feature)
Removes all values form the
content of the object's feature |
protected void |
clearAttribute(PersistentEObject object,
EAttribute attribute)
Removes all values form the content of the
attribute of the object . |
protected void |
clearReference(PersistentEObject object,
EReference reference)
Removes all values form the content of the
reference of the object . |
boolean |
contains(InternalEObject internalObject,
EStructuralFeature feature,
Object value)
Returns whether the
content of the object's feature contains the given value. |
protected boolean |
containsAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns whether the content of the
attribute of the object contains the given value . |
protected boolean |
containsReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns whether the content of the
reference of the object contains the given value . |
EObject |
create(EClass eClass)
Creates a new instance of the class.
|
Object |
get(InternalEObject internalObject,
EStructuralFeature feature,
int index)
Returns the value at the index in the
content of the object's feature. |
protected Object |
getAttribute(PersistentEObject object,
EAttribute attribute,
int index)
Returns the value at the
index in the content of the attribute of the object . |
protected Object |
getReference(PersistentEObject object,
EReference reference,
int index)
Returns the value at the
index in the content of the reference of the object . |
int |
hashCode(InternalEObject internalObject,
EStructuralFeature feature)
Returns the hash code of the
content of the object's feature. |
int |
indexOf(InternalEObject internalObject,
EStructuralFeature feature,
Object value)
Returns the first index of the given value in the
content of the object's feature. |
protected int |
indexOfAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns the first index of the given
value in the content of the attribute of the object . |
protected int |
indexOfReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns the first index of the given
value in the content of the reference of the object . |
boolean |
isEmpty(InternalEObject internalObject,
EStructuralFeature feature)
Returns whether the
content of the object's feature is empty. |
boolean |
isSet(InternalEObject internalObject,
EStructuralFeature feature)
Returns whether the object's feature is considered set.
|
protected boolean |
isSetAttribute(PersistentEObject object,
EAttribute attribute)
Returns whether the
attribute of the object is considered set. |
protected boolean |
isSetReference(PersistentEObject object,
EReference reference)
Returns whether the
reference of the object is considered set. |
int |
lastIndexOf(InternalEObject internalObject,
EStructuralFeature feature,
Object value)
Returns the last index of the given value in the
content of the object's feature. |
protected int |
lastIndexOfAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns the last index of the given
value in the content of the attribute of the object . |
protected int |
lastIndexOfReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns the last index of the given
value in the content of the reference of the object . |
Object |
move(InternalEObject internalObject,
EStructuralFeature feature,
int targetIndex,
int sourceIndex)
Moves the value at the source index in the
content of the object's feature
to the target index. |
protected Object |
parseProperty(EAttribute attribute,
Object property)
Creates an instance of the
attribute . |
Object |
remove(InternalEObject internalObject,
EStructuralFeature feature,
int index)
Removes the value at the index in the
content of the object's feature. |
protected Object |
removeAttribute(PersistentEObject object,
EAttribute attribute,
int index)
Removes the value at the
index in the content of the attribute of the object . |
protected Object |
removeReference(PersistentEObject object,
EReference reference,
int index)
Removes the value at the
index in the content of the reference of the object . |
Resource.Internal |
resource()
Returns the
Resource to persist and access. |
void |
save()
Saves the modifications of the owned
EObject s in the persistence back-end. |
protected Object |
serializeToProperty(EAttribute attribute,
Object value)
Converts an instance of the
attribute to a string literal representation. |
Object |
set(InternalEObject internalObject,
EStructuralFeature feature,
int index,
Object value)
Sets the value at the index in the
content of the object's feature. |
protected Object |
setAttribute(PersistentEObject object,
EAttribute attribute,
int index,
Object value)
Sets the value at the
index in the content of the attribute of the object . |
protected Object |
setReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Sets the value at the
index in the content of the reference of the object . |
Object[] |
toArray(InternalEObject internalObject,
EStructuralFeature feature)
Returns a new array of the values in the
content of the object's feature. |
<T> T[] |
toArray(InternalEObject internalObject,
EStructuralFeature feature,
T[] array)
Returns an array of the values in the
content of the object's feature. |
void |
unset(InternalEObject internalObject,
EStructuralFeature feature)
Unsets the feature of the object.
|
protected void |
unsetAttribute(PersistentEObject object,
EAttribute attribute)
Unsets the
attribute of the object . |
protected void |
unsetReference(PersistentEObject object,
EReference reference)
Unsets the
reference of the object . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
eObject, getAllInstances
getContainer, getContainingFeature, size
protected final P extends PersistenceBackend backend
public AbstractDirectWriteStore(Resource.Internal resource, P backend)
AbstractDirectWriteStore
between the given resource
and the backend
.resource
- the resource to persist and accessbackend
- the persistence back-end used to store the modelpublic Resource.Internal resource()
PersistentStore
Resource
to persist and access.resource
in interface PersistentStore
public void save()
PersistentStore
EObject
s in the persistence back-end.save
in interface PersistentStore
public Object get(InternalEObject internalObject, EStructuralFeature feature, int index)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
get
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a feature of the object.index
- an index within the content or InternalEObject.EStore.NO_INDEX
.getAttribute(PersistentEObject, EAttribute, int)
,
getReference(PersistentEObject, EReference, int)
public Object set(InternalEObject internalObject, EStructuralFeature feature, int index, Object value)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
set
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a feature of the object.index
- an index within the content or InternalEObject.EStore.NO_INDEX
.value
- the new value.setAttribute(PersistentEObject, EAttribute, int, Object)
,
setReference(PersistentEObject, EReference, int, PersistentEObject)
public boolean isSet(InternalEObject internalObject, EStructuralFeature feature)
By default, calls the associated methods depending on the type of the feature
.
isSet
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a feature of the object.true
if the object's feature is considered set.isSetAttribute(PersistentEObject, EAttribute)
,
isSetReference(PersistentEObject, EReference)
public void unset(InternalEObject internalObject, EStructuralFeature feature)
By default, calls the associated methods depending on the type of the feature
.
unset
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a feature of the object.unsetAttribute(PersistentEObject, EAttribute)
,
unsetReference(PersistentEObject, EReference)
public boolean isEmpty(InternalEObject internalObject, EStructuralFeature feature)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature is empty.isEmpty
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.true
if the content of the object's feature is empty.public boolean contains(InternalEObject internalObject, EStructuralFeature feature, Object value)
content
of the object's feature contains the given value.
By default, calls the associated methods depending on the type of the feature
.
contains
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.value
- the value in question.true
if the content of the object's feature contains the given value.containsAttribute(PersistentEObject, EAttribute, Object)
,
containsReference(PersistentEObject, EReference, PersistentEObject)
public int indexOf(InternalEObject internalObject, EStructuralFeature feature, Object value)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
indexOf
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.value
- the value in question.indexOfAttribute(PersistentEObject, EAttribute, Object)
,
indexOfReference(PersistentEObject, EReference, PersistentEObject)
public int lastIndexOf(InternalEObject internalObject, EStructuralFeature feature, Object value)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
lastIndexOf
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.value
- the value in question.lastIndexOfAttribute(PersistentEObject, EAttribute, Object)
,
lastIndexOfReference(PersistentEObject, EReference, PersistentEObject)
public void add(InternalEObject internalObject, EStructuralFeature feature, int index, Object value)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
add
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- an index within the content.value
- the value to add.addAttribute(PersistentEObject, EAttribute, int, Object)
,
addReference(PersistentEObject, EReference, int, PersistentEObject)
public Object remove(InternalEObject internalObject, EStructuralFeature feature, int index)
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
remove
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- the index within the feature's content of the value to remove.removeAttribute(PersistentEObject, EAttribute, int)
,
removeReference(PersistentEObject, EReference, int)
public Object move(InternalEObject internalObject, EStructuralFeature feature, int targetIndex, int sourceIndex)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature
to the target index.move
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.targetIndex
- the index within the feature's content to which to move the value.sourceIndex
- the index within the feature's content of the value to move.public void clear(InternalEObject internalObject, EStructuralFeature feature)
content
of the object's feature
By default, calls the associated methods depending on the type of the feature
.
clear
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.clearAttribute(PersistentEObject, EAttribute)
,
clearReference(PersistentEObject, EReference)
public Object[] toArray(InternalEObject internalObject, EStructuralFeature feature)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature.toArray
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.public <T> T[] toArray(InternalEObject internalObject, EStructuralFeature feature, T[] array)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature.
The given array will be used, unless it's too small, in which case a new array of the same type is allocated instead.toArray
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.array
- the array to fill.public int hashCode(InternalEObject internalObject, EStructuralFeature feature)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature.hashCode
in interface InternalEObject.EStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.public EObject create(EClass eClass)
org.eclipse.emf.ecore.InternalEObject.EStore
create
in interface InternalEObject.EStore
eClass
- the class to instantiate.protected Object getAttribute(PersistentEObject object, EAttribute attribute, int index)
index
in the content of the attribute
of the object
.object
- the objectattribute
- an attribute of the object
index
- an index within the content or PersistentStore.NO_INDEX
get(InternalEObject, EStructuralFeature, int)
protected Object getReference(PersistentEObject object, EReference reference, int index)
index
in the content of the reference
of the object
.object
- the objectreference
- a reference of the object
index
- an index within the content or PersistentStore.NO_INDEX
get(InternalEObject, EStructuralFeature, int)
protected Object setAttribute(PersistentEObject object, EAttribute attribute, int index, Object value)
index
in the content of the attribute
of the object
.object
- the objectattribute
- an attribute of the object
index
- an index within the content or PersistentStore.NO_INDEX
value
- the new valueset(InternalEObject, EStructuralFeature, int, Object)
protected Object setReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
index
in the content of the reference
of the object
.object
- the objectreference
- a reference of the object
index
- an index within the content or PersistentStore.NO_INDEX
value
- the new valueset(InternalEObject, EStructuralFeature, int, Object)
protected boolean isSetAttribute(PersistentEObject object, EAttribute attribute)
attribute
of the object
is considered set.object
- the objectattribute
- an attribute of the object
true
if the attribute is considered setisSet(InternalEObject, EStructuralFeature)
protected boolean isSetReference(PersistentEObject object, EReference reference)
reference
of the object
is considered set.object
- the objectreference
- a reference of the object
true
if the reference is considered setisSet(InternalEObject, EStructuralFeature)
protected void unsetAttribute(PersistentEObject object, EAttribute attribute)
attribute
of the object
.object
- the objectattribute
- an attribute of the object
unset(InternalEObject, EStructuralFeature)
protected void unsetReference(PersistentEObject object, EReference reference)
reference
of the object
.object
- the objectreference
- a reference of the object
unset(InternalEObject, EStructuralFeature)
protected boolean containsAttribute(PersistentEObject object, EAttribute attribute, Object value)
attribute
of the object
contains the given value
.object
- the objectattribute
- a many-valued attribute of the object
value
- the value to look fortrue
if the attribute contains the given valuecontains(InternalEObject, EStructuralFeature, Object)
protected boolean containsReference(PersistentEObject object, EReference reference, PersistentEObject value)
reference
of the object
contains the given value
.object
- the objectreference
- a many-valued reference of the object
value
- the value to look fortrue
if the reference contains the given valuecontains(InternalEObject, EStructuralFeature, Object)
protected int indexOfAttribute(PersistentEObject object, EAttribute attribute, Object value)
value
in the content of the attribute
of the object
.object
- the objectattribute
- a many-valued attribute of the object
value
- the value to look forPersistentStore.NO_INDEX
if it is not foundindexOf(InternalEObject, EStructuralFeature, Object)
protected int indexOfReference(PersistentEObject object, EReference reference, PersistentEObject value)
value
in the content of the reference
of the object
.object
- the objectreference
- a many-valued reference of the object
value
- the value to look forPersistentStore.NO_INDEX
if it is not foundindexOf(InternalEObject, EStructuralFeature, Object)
protected int lastIndexOfAttribute(PersistentEObject object, EAttribute attribute, Object value)
value
in the content of the attribute
of the object
.object
- the objectattribute
- a many-valued attribute of the object
value
- the value to look forPersistentStore.NO_INDEX
if it is not foundlastIndexOf(InternalEObject, EStructuralFeature, Object)
protected int lastIndexOfReference(PersistentEObject object, EReference reference, PersistentEObject value)
value
in the content of the reference
of the object
.object
- the objectreference
- a many-valued reference of the object
value
- the value to look forPersistentStore.NO_INDEX
if it is notlastIndexOf(InternalEObject, EStructuralFeature, Object)
protected void addAttribute(PersistentEObject object, EAttribute attribute, int index, Object value)
value
at the index
in the content of the attribute
of the object
.object
- the objectattribute
- a many-valued attribute of the object
index
- an index within the contentvalue
- the value to addadd(InternalEObject, EStructuralFeature, int, Object)
protected void addReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
value
at the index
in the content of the reference
of the object
.object
- the objectreference
- a many-valued reference of the object
index
- an index within the contentvalue
- the value to addadd(InternalEObject, EStructuralFeature, int, Object)
protected Object removeAttribute(PersistentEObject object, EAttribute attribute, int index)
index
in the content of the attribute
of the object
.object
- the objectattribute
- a many-valued attribute of the object
index
- the index within the content of the value to removeremove(InternalEObject, EStructuralFeature, int)
protected Object removeReference(PersistentEObject object, EReference reference, int index)
index
in the content of the reference
of the object
.object
- the objectreference
- a many-valued reference of the object
index
- the index within the content of the value to removeremove(InternalEObject, EStructuralFeature, int)
protected void clearAttribute(PersistentEObject object, EAttribute attribute)
attribute
of the object
.object
- the objectattribute
- a many-valued attribute of the object
clear(InternalEObject, EStructuralFeature)
protected void clearReference(PersistentEObject object, EReference reference)
reference
of the object
.object
- the objectreference
- a many-valued reference of the object
clear(InternalEObject, EStructuralFeature)
protected Object parseProperty(EAttribute attribute, Object property)
attribute
.attribute
- the attribute to instantiateproperty
- the string value of the attributeEcoreUtil.createFromString(EDataType, String)
protected Object serializeToProperty(EAttribute attribute, Object value)
attribute
to a string literal representation.attribute
- the attribute to instantiatevalue
- a value of the attributeEcoreUtil.convertToString(EDataType, Object)
Copyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.