Class StreamTracer
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.AbstractWriter
-
- net.ssehub.easy.instantiation.core.model.expressions.StreamTracer
-
- All Implemented Interfaces:
ITracer
- Direct Known Subclasses:
StreamTracer
public abstract class StreamTracer extends AbstractWriter implements ITracer
Implements a simple stream-based execution tracer. Produces normalized sequences of collections in order to facilitate easy comparison. Does not support filtering.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]baseFolderprivate java.util.Stack<java.lang.String>callStackprivate RuntimeEnvironment<?,?>environmentprivate java.util.Localelocaleprotected static IStringValueProvider.StringComparatorNORMALIZERThe normalizer for this tracer.
-
Constructor Summary
Constructors Constructor Description StreamTracer(java.io.Writer out, java.lang.String... baseFolder)Creates a new stream tracer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidfailedAt(Expression expression)Is called when the evaluation of an expression caused an execution failure.java.util.LocalegetLocale()Returns the current locale for evaluation.RuntimeEnvironment<?,?>getRuntimeEnvironment()Returns the actual runtime environment.protected abstract ExpressionWritergetWriter(java.io.Writer out)Returns the writer for emitting expressions.protected java.lang.StringmakeRelative(java.lang.Object object)Makes a string value obtained from theStringValueHelperrelative.protected java.lang.StringmakeRelative(java.lang.String string)Aims at making the given string relative to the base folders stored in this instance.protected java.lang.StringmakeRelative(java.net.URI uri)Aims at making the given URI relative to the base folders stored in this instance.voidsetLocale(java.util.Locale locale)Changes the current locale.voidsetRuntimeEnvironment(RuntimeEnvironment<?,?> environment)Defines the actual runtime environment.private java.util.Map<?,?>skipImplicitArguments(java.util.Map<?,?> inMap)Skips the implicit named arguments frominMap.voidvisitedCallExpression(OperationDescriptor descriptor, CallExpression.CallType callType, java.lang.Object[] args, java.lang.Object result)Is called after a resolved call expression is actually executed.voidvisitingCallExpression(OperationDescriptor descriptor, CallExpression.CallType callType, java.lang.Object[] args)Is called before a resolved call expression is actually executed.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.AbstractWriter
decreaseIndentation, flush, getOut, increaseIndentation, print, print, print, print, printIndentation, printJavaEscaped, println, println, println, println, println, printWhitespace, setIndentation
-
-
-
-
Field Detail
-
NORMALIZER
protected static final IStringValueProvider.StringComparator NORMALIZER
The normalizer for this tracer.
-
locale
private java.util.Locale locale
-
baseFolder
private java.lang.String[] baseFolder
-
environment
private RuntimeEnvironment<?,?> environment
-
callStack
private java.util.Stack<java.lang.String> callStack
-
-
Method Detail
-
makeRelative
protected java.lang.String makeRelative(java.lang.Object object)
Makes a string value obtained from theStringValueHelperrelative.- Parameters:
object- the object to be made relative- Returns:
- the relative string (where applicable)
-
makeRelative
protected java.lang.String makeRelative(java.lang.String string)
Aims at making the given string relative to the base folders stored in this instance.- Parameters:
string- the string to be made relative (may be null)- Returns:
- the relative string
-
makeRelative
protected java.lang.String makeRelative(java.net.URI uri)
Aims at making the given URI relative to the base folders stored in this instance.- Parameters:
uri- the URI to be made relative- Returns:
- the relative string
-
visitingCallExpression
public void visitingCallExpression(OperationDescriptor descriptor, CallExpression.CallType callType, java.lang.Object[] args)
Description copied from interface:ITracerIs called before a resolved call expression is actually executed. Do not modify the parameters!- Specified by:
visitingCallExpressionin interfaceITracer- Parameters:
descriptor- the descriptor to be calledcallType- the type of the callargs- the actual arguments
-
visitedCallExpression
public void visitedCallExpression(OperationDescriptor descriptor, CallExpression.CallType callType, java.lang.Object[] args, java.lang.Object result)
Description copied from interface:ITracerIs called after a resolved call expression is actually executed. Do not modify the parameters!- Specified by:
visitedCallExpressionin interfaceITracer- Parameters:
descriptor- the descriptor to be calledcallType- the type of the callargs- the actual argumentsresult- the result of the call
-
skipImplicitArguments
private java.util.Map<?,?> skipImplicitArguments(java.util.Map<?,?> inMap)
Skips the implicit named arguments frominMap.- Parameters:
inMap- the map to be processed- Returns:
- a copy of
inMapwithout implicit arguments
-
failedAt
public void failedAt(Expression expression)
Description copied from interface:ITracerIs called when the evaluation of an expression caused an execution failure.
-
getWriter
protected abstract ExpressionWriter getWriter(java.io.Writer out)
Returns the writer for emitting expressions.- Parameters:
out- the output target- Returns:
- the writer
-
getLocale
public java.util.Locale getLocale()
Description copied from interface:ITracerReturns the current locale for evaluation.
-
setLocale
public void setLocale(java.util.Locale locale)
Description copied from interface:ITracerChanges the current locale.
-
setRuntimeEnvironment
public void setRuntimeEnvironment(RuntimeEnvironment<?,?> environment)
Description copied from interface:ITracerDefines the actual runtime environment.- Specified by:
setRuntimeEnvironmentin interfaceITracer- Parameters:
environment- the environment
-
getRuntimeEnvironment
public RuntimeEnvironment<?,?> getRuntimeEnvironment()
Description copied from interface:ITracerReturns the actual runtime environment.- Specified by:
getRuntimeEnvironmentin interfaceITracer- Returns:
- registry the runtime environment (may be null if not currently executing)
-
-