Package org.faktorips.fl
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
ConstructorsConstructorDescriptionAbstractCompilationResult(org.faktorips.runtime.Message message, T codeFragment) Creates a CompilationResult that contains the given message and source code fragment.AbstractCompilationResult(T codeFragment) 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 TypeMethodDescriptionvoidadd(CompilationResult<T> result) Appends the given compilation result's source code fragment and messages to this result's source code fragment.voidaddCodeFragment(String code) Adds the code fragment to the result ones.voidaddCodeFragment(T code) Adds the code fragment to the result ones.voidaddMessage(org.faktorips.runtime.Message msg) Adds the message to the result.voidaddMessages(org.faktorips.runtime.MessageList list) Adds the message list to the result.booleanbooleanfailed()Returnstrueif the compilation has failed, otherwisefalse.Returns the generated source code.org.faktorips.datatype.DatatypeReturns the compiled expression's data type.final org.faktorips.datatype.Datatype[]getDatatypes(CompilationResult<T>[] results) Extracts the datatypes from an array of compilation results.org.faktorips.runtime.MessageListReturns the messages generated during compilation.inthashCode()voidsetCodeFragment(T code) Sets the code fragment.voidsetDatatype(org.faktorips.datatype.Datatype newType) Sets the result's data type.booleanReturnstrueif the compilation was successful, otherwisefalse.toString()
-
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
Creates a CompilationResult that contains the given source code fragment and data type. -
AbstractCompilationResult
Creates a CompilationResult that contains the given message and source code fragment.- Throws:
IllegalArgumentException- if message is null.
-
AbstractCompilationResult
Creates a CompilationResult that contains the given source code fragment.
-
-
Method Details
-
add
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
Returns the generated source code.- Specified by:
getCodeFragmentin interfaceCompilationResult<T extends org.faktorips.codegen.CodeFragment>
-
setCodeFragment
Sets the code fragment. -
addCodeFragment
Adds the code fragment to the result ones. -
addCodeFragment
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:
getDatatypein interfaceCompilationResult<T extends org.faktorips.codegen.CodeFragment>
-
getMessages
public org.faktorips.runtime.MessageList getMessages()Returns the messages generated during compilation.- Specified by:
getMessagesin interfaceCompilationResult<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:CompilationResultReturnstrueif the compilation was successful, otherwisefalse.- Specified by:
successfullin interfaceCompilationResult<T extends org.faktorips.codegen.CodeFragment>
-
failed
public boolean failed()Description copied from interface:CompilationResultReturnstrueif the compilation has failed, otherwisefalse. If the method returnstrue, there is a least one errorMessagein themessage list.- Specified by:
failedin interfaceCompilationResult<T extends org.faktorips.codegen.CodeFragment>
-
hashCode
public int hashCode() -
equals
-
toString
-
getDatatypes
Extracts the datatypes from an array of compilation results.
-