Class GenericStoExSerialiserImpl
- java.lang.Object
-
- org.palladiosimulator.commons.stoex.api.impl.generic.GenericStoExSerialiserImpl
-
- All Implemented Interfaces:
GenericStoExSerialiser
- Direct Known Subclasses:
PlainStoExSerialiserImpl
public abstract class GenericStoExSerialiserImpl extends Object implements GenericStoExSerialiser
Wrapper for an serialize for StoEx expressions.
-
-
Constructor Summary
Constructors Constructor Description GenericStoExSerialiserImpl(javax.inject.Provider<org.eclipse.xtext.serializer.ISerializer> serialiserProvider)
Constructs new serialiser instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends EObject>
TcreateStoexElementCopy(T eobject)
Creates a copy of the given stoex element that will be contained in anXtextResource
.protected <T extends EObject>
voidremoveStoexElementCopy(T copy)
Undoes the changes done bycreateStoexElementCopy(EObject)
.String
serialise(Expression expression)
Serialises anExpression
to a human readable text.protected String
serialiseWithoutTypeCheck(EObject stoexElement)
Serialises the givenEObject
assuming that the serialiser can handle that particular type of element.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.palladiosimulator.commons.stoex.api.impl.generic.GenericStoExSerialiser
serialise
-
-
-
-
Method Detail
-
serialise
public String serialise(Expression expression) throws NotSerializableException
Description copied from interface:GenericStoExSerialiser
Serialises anExpression
to a human readable text.- Specified by:
serialise
in interfaceGenericStoExSerialiser
- Parameters:
expression
- The expression to serialise.- Returns:
- The concrete syntax representation of the given expression.
- Throws:
NotSerializableException
- In case of an error during serialisation. This is usually caused by an invalid expression.
-
serialiseWithoutTypeCheck
protected String serialiseWithoutTypeCheck(EObject stoexElement) throws NotSerializableException
Serialises the givenEObject
assuming that the serialiser can handle that particular type of element.- Parameters:
stoexElement
- The stoex element to seriale.- Returns:
- The serialised representation of the stoex element.
- Throws:
NotSerializableException
- thrown if the serialisation fails.
-
createStoexElementCopy
protected <T extends EObject> T createStoexElementCopy(T eobject)
Creates a copy of the given stoex element that will be contained in anXtextResource
. This is necessary because the serialiser demands the expression to be in such a resource. Please note that this implementation changes theResourceSet
that transitively contains the stoex element. Therefore, the effect has to be undone as soon as the copy is not required anymore by callingremoveStoexElementCopy(EObject)
.- Parameters:
eobject
- The stoex element to copy.- Returns:
- The copy of the stoex element.
- See Also:
removeStoexElementCopy(EObject)
-
removeStoexElementCopy
protected <T extends EObject> void removeStoexElementCopy(T copy)
Undoes the changes done bycreateStoexElementCopy(EObject)
.- Parameters:
copy
- The stoex element copy.
-
-