public class PrepareObjectBuilder extends RecoderModelTransformer
RecoderModelTransformer.FinalOuterVarsCollector, RecoderModelTransformer.TransformerCache
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<TypeDeclaration,ASTList<Statement>> |
class2fields |
static java.lang.String |
IMPLICIT_OBJECT_PREPARE |
static java.lang.String |
IMPLICIT_OBJECT_PREPARE_ENTER |
private ClassType |
javaLangObject |
cache, services
EQUIVALENCE, IDENTITY, NO_PROBLEM
Constructor and Description |
---|
PrepareObjectBuilder(CrossReferenceServiceConfiguration services,
RecoderModelTransformer.TransformerCache cache) |
Modifier and Type | Method and Description |
---|---|
ProblemReport |
analyze()
Two-pass transformation have to be strictly divided up into two
parts. the first part analyzes the model and collects all
necessary information.
|
MethodDeclaration |
createMethod(TypeDeclaration type)
creates the implicit
<prepare> method that
sets the fields of the given type to its default values |
MethodDeclaration |
createMethodPrepareEnter(TypeDeclaration type)
creates the implicit
<prepareEnter> method that
sets the fields of the given type to its default values |
protected StatementBlock |
createPrepareBody(ReferencePrefix prefix,
TypeDeclaration classType)
creates an implicit method called 'prepare', that sets all
attributes to their default values
|
private ASTList<Statement> |
defaultSettings(java.util.List<Field> fields)
creates the assignments of the field variables to their default values
and inserts them to the given body list
|
private java.util.List<Field> |
getFields(ClassDeclaration cd)
returns all fields of the class cd in source code order.
|
protected void |
makeExplicit(TypeDeclaration td)
entry method for the constructor normalform builder
|
assign, attach, attribute, classDeclarations, containingClass, containingMethod, declare, declare, getAllSupertypes, getDefaultValue, getId, getLocalClass2FinalVar, getUnits, isVisible, makeExplicit, transform
execute
attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsBody, attachAsCondition, attachAsGuard, attachAsInitializer, attachAsLabel, attachAsMessage, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsUpdate, detach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsBody, doAttachAsCondition, doAttachAsGuard, doAttachAsInitializer, doAttachAsLabel, doAttachAsMessage, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsUpdate, doDetach, doReplace, getChangeHistory, getCrossReferenceSourceInfo, getNameInfo, getProblemReport, getProgramFactory, getServiceConfiguration, getSourceFileRepository, getSourceInfo, replace, rollback, setProblemReport, setServiceConfiguration, toString
public static final java.lang.String IMPLICIT_OBJECT_PREPARE
public static final java.lang.String IMPLICIT_OBJECT_PREPARE_ENTER
private java.util.HashMap<TypeDeclaration,ASTList<Statement>> class2fields
private ClassType javaLangObject
public PrepareObjectBuilder(CrossReferenceServiceConfiguration services, RecoderModelTransformer.TransformerCache cache)
private java.util.List<Field> getFields(ClassDeclaration cd)
public ProblemReport analyze()
analyze
in class TwoPassTransformation
private ASTList<Statement> defaultSettings(java.util.List<Field> fields)
protected StatementBlock createPrepareBody(ReferencePrefix prefix, TypeDeclaration classType)
public MethodDeclaration createMethod(TypeDeclaration type)
<prepare>
method that
sets the fields of the given type to its default valuestype
- the TypeDeclaration for which the
<prepare>
is created<prepare>
methodpublic MethodDeclaration createMethodPrepareEnter(TypeDeclaration type)
<prepareEnter>
method that
sets the fields of the given type to its default valuestype
- the TypeDeclaration for which the
<prepare>
is created<prepare>
methodprotected void makeExplicit(TypeDeclaration td)
makeExplicit
in class RecoderModelTransformer
td
- the TypeDeclaration