Class GenericStoExSerialiserImpl
java.lang.Object
org.palladiosimulator.commons.stoex.api.impl.generic.GenericStoExSerialiserImpl
- All Implemented Interfaces:
GenericStoExSerialiser
- Direct Known Subclasses:
PlainStoExSerialiserImpl
Wrapper for an serialize for StoEx expressions.
-
Constructor Summary
ConstructorDescriptionGenericStoExSerialiserImpl
(javax.inject.Provider<org.eclipse.xtext.serializer.ISerializer> serialiserProvider) Constructs new serialiser instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected <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)
.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
-
Constructor Details
-
GenericStoExSerialiserImpl
public GenericStoExSerialiserImpl(javax.inject.Provider<org.eclipse.xtext.serializer.ISerializer> serialiserProvider) Constructs new serialiser instance.
-
-
Method Details
-
serialise
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
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
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
Undoes the changes done bycreateStoexElementCopy(EObject)
.- Parameters:
copy
- The stoex element copy.
-