Class AbstractCompilationResult<T extends org.faktorips.codegen.CodeFragment>

java.lang.Object
org.faktorips.fl.AbstractCompilationResult<T>
All Implemented Interfaces:
CompilationResult<T>
Direct Known Subclasses:
CompilationResultImpl

public abstract class AbstractCompilationResult<T extends org.faktorips.codegen.CodeFragment> extends Object implements CompilationResult<T>
Basic implementation of the CompilationResult interface, independent of compilation target language.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractCompilationResult(org.faktorips.runtime.Message message, T codeFragment)
    Creates a CompilationResult that contains the given message and source code fragment.
    Creates a CompilationResult that contains the given source code fragment.
    AbstractCompilationResult(T sourcecode, org.faktorips.datatype.Datatype datatype)
    Creates a CompilationResult that contains the given source code fragment and data type.
    AbstractCompilationResult(T sourcecode, org.faktorips.datatype.Datatype datatype, org.faktorips.runtime.MessageList messages)
    Creates a CompilationResult with the given parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends the given compilation result's source code fragment and messages to this result's source code fragment.
    void
    Adds the code fragment to the result ones.
    void
    Adds the code fragment to the result ones.
    void
    addMessage(org.faktorips.runtime.Message msg)
    Adds the message to the result.
    void
    addMessages(org.faktorips.runtime.MessageList list)
    Adds the message list to the result.
    boolean
     
    boolean
    Returns true if the compilation has failed, otherwise false.
    Returns the generated source code.
    org.faktorips.datatype.Datatype
    Returns the compiled expression's data type.
    final org.faktorips.datatype.Datatype[]
    Extracts the datatypes from an array of compilation results.
    org.faktorips.runtime.MessageList
    Returns the messages generated during compilation.
    int
     
    void
    Sets the code fragment.
    void
    setDatatype(org.faktorips.datatype.Datatype newType)
    Sets the result's data type.
    boolean
    Returns true if the compilation was successful, otherwise false.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractCompilationResult

      public AbstractCompilationResult(T sourcecode, org.faktorips.datatype.Datatype datatype, org.faktorips.runtime.MessageList messages)
      Creates a CompilationResult with the given parameters.
    • AbstractCompilationResult

      public AbstractCompilationResult(T sourcecode, org.faktorips.datatype.Datatype datatype)
      Creates a CompilationResult that contains the given source code fragment and data type.
    • AbstractCompilationResult

      public AbstractCompilationResult(org.faktorips.runtime.Message message, T codeFragment)
      Creates a CompilationResult that contains the given message and source code fragment.
      Throws:
      IllegalArgumentException - if message is null.
    • AbstractCompilationResult

      public AbstractCompilationResult(T codeFragment)
      Creates a CompilationResult that contains the given source code fragment.
  • Method Details

    • add

      public void add(CompilationResult<T> result)
      Appends the given compilation result's source code fragment and messages to this result's source code fragment. This result's data type remains unchanged.
    • getCodeFragment

      public T getCodeFragment()
      Returns the generated source code.
      Specified by:
      getCodeFragment in interface CompilationResult<T extends org.faktorips.codegen.CodeFragment>
    • setCodeFragment

      public void setCodeFragment(T code)
      Sets the code fragment.
    • addCodeFragment

      public void addCodeFragment(T code)
      Adds the code fragment to the result ones.
    • addCodeFragment

      public void addCodeFragment(String code)
      Adds the code fragment to the result ones.
    • setDatatype

      public void setDatatype(org.faktorips.datatype.Datatype newType)
      Sets the result's data type.
    • getDatatype

      public org.faktorips.datatype.Datatype getDatatype()
      Returns the compiled expression's data type.
      Specified by:
      getDatatype in interface CompilationResult<T extends org.faktorips.codegen.CodeFragment>
    • getMessages

      public org.faktorips.runtime.MessageList getMessages()
      Returns the messages generated during compilation.
      Specified by:
      getMessages in interface CompilationResult<T extends org.faktorips.codegen.CodeFragment>
    • addMessage

      public void addMessage(org.faktorips.runtime.Message msg)
      Adds the message to the result.
      Throws:
      IllegalArgumentException - if the given message is null.
    • addMessages

      public void addMessages(org.faktorips.runtime.MessageList list)
      Adds the message list to the result.
      Throws:
      IllegalArgumentException - if list is null.
    • successfull

      public boolean successfull()
      Description copied from interface: CompilationResult
      Returns true if the compilation was successful, otherwise false.
      Specified by:
      successfull in interface CompilationResult<T extends org.faktorips.codegen.CodeFragment>
    • failed

      public boolean failed()
      Description copied from interface: CompilationResult
      Returns true if the compilation has failed, otherwise false. If the method returns true, there is a least one error Message in the message list.
      Specified by:
      failed in interface CompilationResult<T extends org.faktorips.codegen.CodeFragment>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDatatypes

      public final org.faktorips.datatype.Datatype[] getDatatypes(CompilationResult<T>[] results)
      Extracts the datatypes from an array of compilation results.