|
EGF Engine Release 0.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.egf.pattern.ecore.AnnotationHandler
public class AnnotationHandler
The annotation handler translates a pattern methods annotations to java code annotations.
It also provides with a parsing of the methods annotations.
Nested Class Summary | |
---|---|
protected class |
AnnotationHandler.AnnotationCodeAppender
Annotation code appender. |
protected class |
AnnotationHandler.JavaCodeAppender
Java code append to existing pattern operation code. |
protected class |
AnnotationHandler.PatternCodeAppender
Pattern code appender to existing pattern operation. |
protected class |
AnnotationHandler.UnbufferedJavaCodeAppender
A java code appender that is not prefixed by a call to the string builder. |
Field Summary | |
---|---|
protected static String |
JAVA_CODE_ANNOTATION_SOURCE
Java code annotation source. |
protected static String |
JAVA_CODE_APPEND_TO_STRING_BUILDER
Append to string builder. |
protected static String |
JAVA_CODE_CREATE_STRING_BUILDER
Create string builder. |
protected static String |
JAVA_CODE_GET_STRING_BUILDER_RESULT
Return string builder result. |
protected static String |
JAVA_CODE_READ_FILE_CALL_PREFIX
Read file method call prefix. |
protected static String |
JAVA_CODE_SUPER_CALL_PREFIX
Super method call prefix. |
protected static String |
OPERATION_ANNOTATION_BODY
Operation annotation body. |
static String |
PATTERN_CODE_ANNOTATION_SOURCE
Pattern code annotation source. |
protected static String |
PATTERN_METHOD_ID_PREFIX
Pattern method id prefix. |
static String |
PATTERN_PRODUCTION_ANNOTATION_BODY_BUFFER_MODIFICATION
Pattern production buffer modification annotation body. |
static String |
PATTERN_PRODUCTION_ANNOTATION_BODY_COMPILATION
Pattern production compilation annotation body. |
static String |
PATTERN_PRODUCTION_ANNOTATION_BODY_PATH
Pattern production path annotation body. |
static String |
PATTERN_PRODUCTION_ANNOTATION_SOURCE
Pattern production annotation source. |
protected static String |
UID_ANNOTATION_SOURCE
UID annotation source. |
Constructor Summary | |
---|---|
AnnotationHandler()
|
Method Summary | |
---|---|
protected void |
addCallMethodJavaCode(EOperation operation_p,
String methodName_p)
Add call method (java code) for given operation and method name. |
void |
addCallMethodPatternCode(EOperation operation_p,
String methodName_p)
Add call method (pattern code) for given operation and method name. |
protected void |
addGenerateOtherPatternJavaCode(EOperation operation_p,
String patternFullId_p)
TODO Guillaume Specific to JET templates. |
void |
addGenerateOtherPatternPatternCode(EOperation operation_p,
String patternFullId_p)
Add generate identified pattern (pattern code) for given operation and pattern full id. |
boolean |
addProductionAnnotation(Pattern pattern_p,
PatternHandler.ProductionOptionsHandler productionHandler_p)
Add/replace pattern production annotation based on given production handler values. |
protected void |
addReadFileJavaCode(EOperation operation_p,
String fileRelativePath_p)
Add read file (java code) for given operation and file relative path. |
void |
addReadFilePatternCode(EOperation operation_p,
String fileRelativePath_p)
Add read file (pattern code) for given operation and file relative path. |
protected void |
addSuperMethodCallJavaCode(EOperation operation_p,
String methodName_p)
Add call to super method (java code) for given operation and method name. |
void |
addSuperMethodCallPatternCode(EOperation operation_p,
String methodName_p)
Add call to super method (pattern code) for given operation and method name. |
String |
addUidAnnotation(EOperation operation_p)
Add UID annotation to given operation. |
protected void |
doAppendPatternCode(String operationName_p,
String parameter_p,
StringBuilder existingCode_p)
Append operation to given string builder of pattern code. |
protected boolean |
doTranslateAnnotation(EOperation operation_p)
Do translate annotation for given operation. |
protected void |
explore(Tree tree_p,
List<Couple<String,String>> actions_p)
Explore current tree level, and fill given pattern code actions list accordingly. |
protected void |
exploreAndTranslate(Tree tree_p,
EOperation operation_p)
Explore annotation abstract syntax tree and translate accordingly. |
protected void |
finalizeJavaCode(EOperation operation_p)
Finalize java code for given operation. |
protected Couple<String,String> |
getActionAndParameter(Tree tree_p)
Get a couple composed of the top action (and its parameter) of given tree. |
List<String> |
getCalledPatternIDs(EOperation operation_p)
Get pattern IDs that are called through this operation. |
protected String |
getCallOtherPatternTemplateCode(String patternFullId_p)
TODO Guillaume Specific to JET templates. |
protected String |
getFirstChild(Tree tree_p)
Get first child of given tree as a string. |
protected EAnnotation |
getOrCreateAnnotation(EOperation operation_p,
String sourceAnnotation_p,
boolean forceCreation_p)
Get annotation for given operation and source. |
protected EAnnotation |
getOrCreateJavaCodeAnnotation(EOperation operation_p)
Get or create java code annotation for given operation. |
protected EAnnotation |
getOrCreatePatternCodeAnnotation(EOperation operation_p,
boolean forceCreation_p)
Get or create pattern code annotation for given operation. |
List<Couple<String,String>> |
getOrderedActionsFor(EOperation operation_p)
Get ordered list of pattern code actions for given pattern operation. |
protected String |
getPatternCode(EOperation operation_p)
Get pattern code for given operation. |
protected CommonTree |
getTree(String patternCode_p)
Get abstract syntax tree out of given pattern code. |
String |
getUid(EOperation operation_p)
Get operation UID. |
boolean |
hasPatternCode(EOperation operation_p)
Is given operation referencing pattern code ? |
protected void |
initializeJavaCode(EOperation operation_p)
Initialize java code for given operation. |
void |
recomputeAnnotationFromActions(EOperation operation_p,
List<Couple<String,String>> actions_p)
Recompute pattern code annotation for given method using given actions. |
List<Couple<String,String>> |
removeActionsFor(String parameterValue_p,
List<Couple<String,String>> actions_p)
Deprecated. |
EAnnotation |
removeProductionAnnotation(Pattern pattern_p)
Remove production annotation from given pattern, if any. |
void |
replaceParameter(String oldParameterValue_p,
String newParameterValue_p,
List<Couple<String,String>> actions_p)
Replace old parameter value with new one, everywhere it is used in given actions list. |
boolean |
translateAnnotations(List<EOperation> operations_p)
Translate annotations from pattern code to java code for given pattern operations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String JAVA_CODE_SUPER_CALL_PREFIX
protected static final String JAVA_CODE_READ_FILE_CALL_PREFIX
protected static final String JAVA_CODE_CREATE_STRING_BUILDER
protected static final String JAVA_CODE_APPEND_TO_STRING_BUILDER
protected static final String JAVA_CODE_GET_STRING_BUILDER_RESULT
protected static final String OPERATION_ANNOTATION_BODY
protected static final String UID_ANNOTATION_SOURCE
protected static final String JAVA_CODE_ANNOTATION_SOURCE
public static final String PATTERN_CODE_ANNOTATION_SOURCE
public static final String PATTERN_PRODUCTION_ANNOTATION_SOURCE
public static final String PATTERN_PRODUCTION_ANNOTATION_BODY_PATH
public static final String PATTERN_PRODUCTION_ANNOTATION_BODY_COMPILATION
public static final String PATTERN_PRODUCTION_ANNOTATION_BODY_BUFFER_MODIFICATION
protected static final String PATTERN_METHOD_ID_PREFIX
Constructor Detail |
---|
public AnnotationHandler()
Method Detail |
---|
protected CommonTree getTree(String patternCode_p)
patternCode_p
-
public List<Couple<String,String>> getOrderedActionsFor(EOperation operation_p)
operation_p
-
public List<String> getCalledPatternIDs(EOperation operation_p)
operation_p
-
public void replaceParameter(String oldParameterValue_p, String newParameterValue_p, List<Couple<String,String>> actions_p)
oldParameterValue_p
- newParameterValue_p
- As a result, given actions list remains unmodified, but its contained actions are (unless no modification happened).public List<Couple<String,String>> removeActionsFor(String parameterValue_p, List<Couple<String,String>> actions_p)
parameterValue_p
- actions_p
-
List
of removed actions.public void recomputeAnnotationFromActions(EOperation operation_p, List<Couple<String,String>> actions_p)
operation_p
- actions_p
- public String addUidAnnotation(EOperation operation_p)
operation_p
-
public boolean addProductionAnnotation(Pattern pattern_p, PatternHandler.ProductionOptionsHandler productionHandler_p)
pattern_p
- productionHandler_p
-
public EAnnotation removeProductionAnnotation(Pattern pattern_p)
pattern_p
-
public String getUid(EOperation operation_p)
operation_p
-
protected Couple<String,String> getActionAndParameter(Tree tree_p)
tree_p
-
protected void explore(Tree tree_p, List<Couple<String,String>> actions_p)
tree_p
- actions_p
- public boolean translateAnnotations(List<EOperation> operations_p)
operations_p
-
public boolean hasPatternCode(EOperation operation_p)
operation_p
-
protected boolean doTranslateAnnotation(EOperation operation_p)
operation_p
-
protected void exploreAndTranslate(Tree tree_p, EOperation operation_p)
tree_p
- operation_p
- protected String getFirstChild(Tree tree_p)
tree_p
-
protected String getPatternCode(EOperation operation_p)
operation_p
-
protected void initializeJavaCode(EOperation operation_p)
operation_p
- protected void finalizeJavaCode(EOperation operation_p)
operation_p
- public void addGenerateOtherPatternPatternCode(EOperation operation_p, String patternFullId_p)
operation_p
- patternFullId_p
- protected void addGenerateOtherPatternJavaCode(EOperation operation_p, String patternFullId_p)
operation_p
- patternFullId_p
- protected String getCallOtherPatternTemplateCode(String patternFullId_p)
patternFullId_p
- The pattern to call full id.
public void addReadFilePatternCode(EOperation operation_p, String fileRelativePath_p)
operation_p
- fileRelativePath_p
- protected void addReadFileJavaCode(EOperation operation_p, String fileRelativePath_p)
operation_p
- fileRelativePath_p
- public void addCallMethodPatternCode(EOperation operation_p, String methodName_p)
operation_p
- methodName_p
- protected void addCallMethodJavaCode(EOperation operation_p, String methodName_p)
operation_p
- methodName_p
- public void addSuperMethodCallPatternCode(EOperation operation_p, String methodName_p)
operation_p
- methodName_p
- protected void addSuperMethodCallJavaCode(EOperation operation_p, String methodName_p)
operation_p
- methodName_p
- Can be null, the given operation name is used instead.protected EAnnotation getOrCreateJavaCodeAnnotation(EOperation operation_p)
operation_p
-
protected EAnnotation getOrCreatePatternCodeAnnotation(EOperation operation_p, boolean forceCreation_p)
operation_p
- forceCreation_p
-
protected EAnnotation getOrCreateAnnotation(EOperation operation_p, String sourceAnnotation_p, boolean forceCreation_p)
operation_p
- sourceAnnotation_p
- forceCreation_p
- Should an annotation be created if none could be found ?
protected void doAppendPatternCode(String operationName_p, String parameter_p, StringBuilder existingCode_p)
operationName_p
- Operation to use.parameter_p
- Operation parameter. Always a String
. May be null.existingCode_p
- a not null StringBuilder
containing existing pattern code.
|
EGF Engine Release 0.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) Thales Corporate Services S.A.S, 2009.
This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.