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 Details

    • GenericStoExSerialiserImpl

      public GenericStoExSerialiserImpl(javax.inject.Provider<org.eclipse.xtext.serializer.ISerializer> serialiserProvider)
      Constructs new serialiser instance.
  • Method Details

    • serialise

      public String serialise(Expression expression) throws NotSerializableException
      Description copied from interface: GenericStoExSerialiser
      Serialises an Expression to a human readable text.
      Specified by:
      serialise in interface GenericStoExSerialiser
      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 given EObject 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 an XtextResource. This is necessary because the serialiser demands the expression to be in such a resource. Please note that this implementation changes the ResourceSet that transitively contains the stoex element. Therefore, the effect has to be undone as soon as the copy is not required anymore by calling removeStoexElementCopy(EObject).
      Parameters:
      eobject - The stoex element to copy.
      Returns:
      The copy of the stoex element.
      See Also:
    • removeStoexElementCopy

      protected <T extends EObject> void removeStoexElementCopy(T copy)
      Undoes the changes done by createStoexElementCopy(EObject).
      Parameters:
      copy - The stoex element copy.