|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.codegen.merge.java.facade.ast.ASTNodeConverter.Converter
org.eclipse.emf.codegen.merge.java.facade.ast.ASTNodeConverter.TypeToEnumConverter
protected class ASTNodeConverter.TypeToEnumConverter
Converter of type to enum.
convert()
Field Summary | |
---|---|
protected org.eclipse.jdt.core.dom.AST |
ast
AST of the source and converted node |
protected java.util.Map<java.lang.String,ASTJField> |
fieldNamesMap
Map of field names to fields |
protected ASTJType |
type
Type that will be converted |
protected java.util.List<JNode> |
typeChildren
List of children of the type |
Constructor Summary | |
---|---|
ASTNodeConverter.TypeToEnumConverter(ASTJType type)
|
Method Summary | |
---|---|
ASTJEnum |
convert()
Converts type to the enum. |
protected ASTJNode<?> |
convertFieldToEnumConst(ASTJField field)
Converts given field to enum constant if possible. |
protected void |
setEnumConstantArgumentsAndBody(ASTJEnumConstant enumConstant,
ASTJField field)
Sets arguments and body of the enum constant from the initializer of the given field. |
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTNodeConverter.Converter |
---|
moveChildren, replaceNode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ASTJType type
protected org.eclipse.jdt.core.dom.AST ast
protected java.util.List<JNode> typeChildren
protected java.util.Map<java.lang.String,ASTJField> fieldNamesMap
Constructor Detail |
---|
public ASTNodeConverter.TypeToEnumConverter(ASTJType type)
type
- to convert to enumMethod Detail |
---|
public ASTJEnum convert()
Name, flags, comment, super interfaces of the enum are set from the type.
All children of the type is added to the enum.
Fields that are public static final
and have the same type are converted to
enum constants. Arguments of the enum constants are set from arguments of the initializer.
Arguments that match the name of any other field are replaced by initializer value of that field.
Conversion must be done only once for the same type.
convert
in class ASTNodeConverter.Converter
null
if conversion not possibleprotected ASTJNode<?> convertFieldToEnumConst(ASTJField field)
Field must be declared as public static final
field, and field must be of the same type
as its parent (e.g. type).
Enum constant arguments and body is set from the original initializer of the field.
field
- to convert
setEnumConstantArgumentsAndBody(ASTJEnumConstant, ASTJField)
protected void setEnumConstantArgumentsAndBody(ASTJEnumConstant enumConstant, ASTJField field)
Note that the original field's initializer node structure is used (e.g. if ASTJField.setInitializer(String)
has been called, this method will use the original initializer of the field).
enumConstant
- field
-
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |