Author: spagop
Date: 2008-08-28 15:50:10 -0400 (Thu, 28 Aug 2008)
New Revision: 479
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java
Removed:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ReferenceFieldMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleFieldMetadata.java
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java
Log:
more type support and some utils / refactory
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -26,6 +26,7 @@
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
+import org.eclipse.jdt.core.dom.ArrayType;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.FieldDeclaration;
@@ -44,6 +45,7 @@
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.jboss.dna.sequencer.java.metadata.ArrayTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.ClassMetadata;
import org.jboss.dna.sequencer.java.metadata.ConstructorMetadata;
import org.jboss.dna.sequencer.java.metadata.FieldMetadata;
@@ -56,10 +58,9 @@
import org.jboss.dna.sequencer.java.metadata.ModifierMetadata;
import org.jboss.dna.sequencer.java.metadata.NormalAnnotationMetadata;
import org.jboss.dna.sequencer.java.metadata.PackageMetadata;
-import org.jboss.dna.sequencer.java.metadata.ParameterizedFieldMetadata;
+import org.jboss.dna.sequencer.java.metadata.ParameterizedTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.PrimitiveFieldMetadata;
-import org.jboss.dna.sequencer.java.metadata.ReferenceFieldMetadata;
-import org.jboss.dna.sequencer.java.metadata.SimpleFieldMetadata;
+import org.jboss.dna.sequencer.java.metadata.SimpleTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.SingleImportMetadata;
import org.jboss.dna.sequencer.java.metadata.SingleMemberAnnotationMetadata;
import org.jboss.dna.sequencer.java.metadata.TypeMetadata;
@@ -285,9 +286,9 @@
methodMetadata.setReturnType(primitive);
}
if (type.isSimpleType()) {
- ReferenceFieldMetadata referenceFieldMetadata = new
ReferenceFieldMetadata();
-
referenceFieldMetadata.setType(JavaMetadataUtil.getName(((SimpleType)type).getName()));
- methodMetadata.setReturnType(referenceFieldMetadata);
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata = new
SimpleTypeFieldMetadata();
+
simpleTypeFieldMetadata.setType(JavaMetadataUtil.getName(((SimpleType)type).getName()));
+ methodMetadata.setReturnType(simpleTypeFieldMetadata);
}
}
@@ -326,15 +327,15 @@
// TODO
}
if (type.isQualifiedType()) {
-
+ // TODO
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
- SimpleFieldMetadata simpleFieldMetadata = new SimpleFieldMetadata();
-
simpleFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata = new
SimpleTypeFieldMetadata();
+
simpleTypeFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
Variable variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
- simpleFieldMetadata.getVariables().add(variable);
+ simpleTypeFieldMetadata.getVariables().add(variable);
List<IExtendedModifier> extendedModifiers =
singleVariableDeclaration.modifiers();
for (IExtendedModifier extendedModifier2 : extendedModifiers) {
ModifierMetadata modifierMetadata = new ModifierMetadata();
@@ -343,10 +344,10 @@
} else {
Modifier modifier = (Modifier)extendedModifier2;
modifierMetadata.setName(modifier.getKeyword().toString());
- simpleFieldMetadata.getModifiers().add(modifierMetadata);
+ simpleTypeFieldMetadata.getModifiers().add(modifierMetadata);
}
}
- methodMetadata.getParameters().add(simpleFieldMetadata);
+ methodMetadata.getParameters().add(simpleTypeFieldMetadata);
}
if (type.isArrayType()) {
// TODO
@@ -386,22 +387,22 @@
Type type = fieldDeclaration.getType();
// Primitive type
if (type.isPrimitiveType()) {
- PrimitiveFieldMetadata primitiveFieldMetadata =
processPrimitiveType(fieldDeclaration, type);
+ PrimitiveFieldMetadata primitiveFieldMetadata =
processPrimitiveType(fieldDeclaration);
return primitiveFieldMetadata;
}
// ParameterizedType
if (type.isParameterizedType()) {
- ParameterizedFieldMetadata referenceFieldMetadata =
processParameterizedType(fieldDeclaration, type);
+ ParameterizedTypeFieldMetadata referenceFieldMetadata =
processParameterizedType(fieldDeclaration);
return referenceFieldMetadata;
}
// SimpleType
if (type.isSimpleType()) {
- SimpleFieldMetadata simpleFieldMetadata =
processSimpleType(fieldDeclaration, type);
- return simpleFieldMetadata;
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata =
processSimpleType(fieldDeclaration);
+ return simpleTypeFieldMetadata;
}
// ArrayType
if (type.isArrayType()) {
- // TODO
+ ArrayTypeFieldMetadata arrayFieldMetadata =
processArrayTypeFrom(fieldDeclaration);
}
// QualifiedType
if (type.isQualifiedType()) {
@@ -417,35 +418,51 @@
}
/**
+ * Process a {@link FieldDeclaration} to win information for an array type.
+ *
+ * @param fieldDeclaration - field declaration
+ * @return an ArrayTypeFieldMetadata, that contains information about an array type.
+ */
+ private ArrayTypeFieldMetadata processArrayTypeFrom( FieldDeclaration
fieldDeclaration ) {
+ ArrayType arrayType = (ArrayType)fieldDeclaration.getType();
+
+ // the element type is never an array type
+ Type type = arrayType.getElementType();
+ // can't be an array type
+ if(type.isSimpleType()) {
+
+ }
+
+
+ return null;
+ }
+
+ /**
* Process the simple type of a {@link FieldDeclaration}.
*
* @param fieldDeclaration - the field declaration.
- * @param type - the type.
- * @return SimpleFieldMetadata.
+ * @return SimpleTypeFieldMetadata.
*/
- protected SimpleFieldMetadata processSimpleType( FieldDeclaration fieldDeclaration,
- Type type ) {
- SimpleType simpleType = (SimpleType)type;
- SimpleFieldMetadata simpleFieldMetadata = new SimpleFieldMetadata();
- simpleFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
+ protected SimpleTypeFieldMetadata processSimpleType( FieldDeclaration
fieldDeclaration ) {
+ SimpleType simpleType = (SimpleType)fieldDeclaration.getType();
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata = new SimpleTypeFieldMetadata();
+ simpleTypeFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
// modifiers
- processModifiersOfFieldDeclaration(fieldDeclaration, simpleFieldMetadata);
- processVariablesOfVariableDeclarationFragment(fieldDeclaration,
simpleFieldMetadata);
- return simpleFieldMetadata;
+ processModifiersOfFieldDeclaration(fieldDeclaration, simpleTypeFieldMetadata);
+ processVariablesOfVariableDeclarationFragment(fieldDeclaration,
simpleTypeFieldMetadata);
+ return simpleTypeFieldMetadata;
}
/**
* Process the parameterized type of a {@link FieldDeclaration}.
*
* @param fieldDeclaration - the field declaration.
- * @param type - the type.
- * @return ParameterizedFieldMetadata.
+ * @return ParameterizedTypeFieldMetadata.
*/
- protected ParameterizedFieldMetadata processParameterizedType( FieldDeclaration
fieldDeclaration,
- Type type ) {
- ParameterizedType parameterizedType = (ParameterizedType)type;
+ protected ParameterizedTypeFieldMetadata processParameterizedType( FieldDeclaration
fieldDeclaration ) {
+ ParameterizedType parameterizedType =
(ParameterizedType)fieldDeclaration.getType();
Type typeOfParameterizedType = parameterizedType.getType(); // type may be a
simple type or a qualified type.
- ParameterizedFieldMetadata referenceFieldMetadata =
(ParameterizedFieldMetadata)createParameterizedFieldMetadataFrom(typeOfParameterizedType);
+ ParameterizedTypeFieldMetadata referenceFieldMetadata =
(ParameterizedTypeFieldMetadata)createParameterizedFieldMetadataFrom(typeOfParameterizedType);
// modifiers
processModifiersOfFieldDeclaration(fieldDeclaration, referenceFieldMetadata);
// variables
@@ -457,12 +474,10 @@
* Process the primitive type of a {@link FieldDeclaration}.
*
* @param fieldDeclaration - the field declaration.
- * @param type - the type.
* @return PrimitiveFieldMetadata.
*/
- protected PrimitiveFieldMetadata processPrimitiveType( FieldDeclaration
fieldDeclaration,
- Type type ) {
- PrimitiveType primitiveType = (PrimitiveType)type;
+ protected PrimitiveFieldMetadata processPrimitiveType( FieldDeclaration
fieldDeclaration ) {
+ PrimitiveType primitiveType = (PrimitiveType)fieldDeclaration.getType();
PrimitiveFieldMetadata primitiveFieldMetadata = new PrimitiveFieldMetadata();
primitiveFieldMetadata.setType(primitiveType.getPrimitiveTypeCode().toString());
// modifiers
@@ -524,14 +539,14 @@
* @return the specific type of <code>FieldMetadata</code>
*/
protected FieldMetadata createParameterizedFieldMetadataFrom( Type type ) {
- ParameterizedFieldMetadata parameterizedFieldMetadata = null;
+ ParameterizedTypeFieldMetadata parameterizedTypeFieldMetadata = null;
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
- parameterizedFieldMetadata = new ParameterizedFieldMetadata();
-
parameterizedFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
+ parameterizedTypeFieldMetadata = new ParameterizedTypeFieldMetadata();
+
parameterizedTypeFieldMetadata.setType(JavaMetadataUtil.getName(simpleType.getName()));
}
// TODO also process QualifiedType
- return parameterizedFieldMetadata;
+ return parameterizedTypeFieldMetadata;
}
/**
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -26,8 +26,9 @@
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.jboss.dna.common.monitor.ProgressMonitor;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.JcrUtil;
import org.jboss.dna.sequencer.java.metadata.AnnotationMetadata;
+import org.jboss.dna.sequencer.java.metadata.ArrayTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.ClassMetadata;
import org.jboss.dna.sequencer.java.metadata.ConstructorMetadata;
import org.jboss.dna.sequencer.java.metadata.FieldMetadata;
@@ -40,8 +41,10 @@
import org.jboss.dna.sequencer.java.metadata.ModifierMetadata;
import org.jboss.dna.sequencer.java.metadata.NormalAnnotationMetadata;
import org.jboss.dna.sequencer.java.metadata.PackageMetadata;
+import org.jboss.dna.sequencer.java.metadata.ParameterizedTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.PrimitiveFieldMetadata;
-import org.jboss.dna.sequencer.java.metadata.ReferenceFieldMetadata;
+import org.jboss.dna.sequencer.java.metadata.QualifiedTypeFieldMetadata;
+import org.jboss.dna.sequencer.java.metadata.SimpleTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.SingleImportMetadata;
import org.jboss.dna.sequencer.java.metadata.SingleMemberAnnotationMetadata;
import org.jboss.dna.sequencer.java.metadata.TypeMetadata;
@@ -54,43 +57,43 @@
import org.jboss.dna.spi.sequencers.StreamSequencer;
/**
- * A sequencer that processes a compilation unit, extracts the meta data for the
compilation unit, and then writes these
+ * A Java sequencer that processes a compilation unit, extracts the meta data for the
compilation unit, and then writes these
* informations to the repository.
* <p>
* The structural representation of the informations from the compilation unit looks like
this:
* <ul>
* <li><strong>java:compilationUnit</strong> node of type
<code>java:compilationUnit</code>
* <ul>
- * <li> <strong>java:package</strong> - optional child node that
represents the package child node of the compilation unit
+ * <li> <strong>java:package</strong> - optional child node that
represents the package child node of the compilation unit.
* <ul>
- * <li> <strong>java:packageDeclaration</strong> -
+ * <li> <strong>java:packageDeclaration</strong> - the package
declaration.
* <ul>
- * <li><strong>java:packageName</strong></li>
+ * <li><strong>java:packageName</strong></li> - the package
name.
* </ul>
* </li>
* </ul>
* </li>
* <li> <strong>java:import</strong> - optional child node that
represents the import declaration of the compilation unit
* <ul>
- * <li> <strong>java:importDeclaration</strong> -
+ * <li> <strong>java:importDeclaration</strong> - the import
declaration
* <ul>
+ * <li><strong>java:singleImport</strong>
+ * <ul>
* <li> <strong>java:singleTypeImportDeclaration</strong>
* <ul>
- * <li> <strong>java:packageDeclaration</strong> -
- * <ul>
- * <li><strong>java:typeName</strong></li>
+ * <li> <strong>java:singleTypeImportkeyword</strong> - the keyword
"import"
+ * <li><strong>java:singleImportName</strong></li> - the name of
a single import. </li>
* </ul>
* </li>
* </ul>
* </li>
+ * <li><strong>java:importOnDemand</strong>
* <li> <strong>java:typeImportOnDemandDeclaration</strong>
* <ul>
- * <li> <strong>java:packageDeclaration</strong> -
- * <ul>
- * <li><strong>java:typeName</strong></li>
+ * <li> <strong>java:onDemandImportKeyword</strong> - the keyword
"import"
+ * <li><strong>java:onDemandImportName</strong></li> - the name
of the on demand import. </li>
* </ul>
* </li>
- * </ul>
* </li>
* </ul>
* </li>
@@ -102,121 +105,72 @@
* <li> <strong>java:classDeclaration</strong> - optional child node
that represents the class declaration of the compilation
* unit
* <ul>
- * <li> <strong>java:normalClass</strong> -
+ * <li> <strong>java:normalClass</strong> - the normal class.
* <ul>
- * <li> <strong>java:normalClassDeclaration</strong> -
+ * <li> <strong>java:normalClassDeclaration</strong> - the normal class
declaration
* <ul>
- * <li> <strong>java:modifier</strong> - </li>
- * <li> <strong>java:name</strong> - </li>
- * <li> <strong>java:field</strong> - </li>
- * <li> <strong>java:method</strong> - </li>
- * <li> <strong>java:constructor</strong> - </li>
+ * <li> <strong>java:modifier</strong> - modifier child node.
+ * <ul>
+ * <li><strong>java:modifierDeclaration</strong> - the modifier
declaration.
+ * <ul>
+ * <li><strong>java:modifierName</strong> - modifier name.</li>
* </ul>
* </li>
* </ul>
* </li>
+ * <li> <strong>java:normalClassName</strong> - class name.</li>
+ * <li> <strong>java:field</strong> - field child node.
+ * <ul>
+ * <li><strong>java:fieldType</strong> - field type child node.
+ * <ul>
+ * <li><strong>java:type</strong> - type child node.
+ * <ul>
+ * <li>[java:primitiveType, java:simpleType, java:parameterizedType] - can be
primitive type or simple type and or parameterized
+ * type<.</li>
* </ul>
* </li>
* </ul>
* </li>
* </ul>
+ * </li>
+ * <li> <strong>java:constructor</strong> - the constructor child node
+ * <ul>
+ * <li><strong>java:constructorDeclaration</strong> - the constructor
declaration.
+ * <ul>
+ * <li><strong>java:constructorName</strong> - constructor name.
</li>
+ * <li><strong>java:modifier </strong> - the modifier child
node.</li> +
+ * <li><strong>java:parameter </strong> - the parameter child
node</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * <li> <strong>java:method</strong> - method child node.
+ * <ul>
+ * <li></strong>java:methodDeclaration</strong> - method declaration.
+ * <ul>
+ * <li><strong>java:methodName </strong> - method name. </li>
+ * <li><strong>java:modifier </strong> - the modifier child
node.</li> +
+ * <li><strong>java:resultType </strong> - the result type child node
</li> +
+ * <li><strong>java:parameter </strong> - the parameter child
node</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * </ul>
* </p>
*
* @author Serge Pagop
*/
-public class JavaMetadataSequencer implements StreamSequencer {
+public class JavaMetadataSequencer implements JavaSourceCndDefinition, StreamSequencer {
- private static final String SLASH = "/";
-
- public static final String JAVA_COMPILATION_UNIT_NODE =
"java:compilationUnit";
- public static final String JAVA_COMPILATION_UNIT_PRIMARY_TYPE =
"jcr:primaryType";
-
- // package declaration
- public static final String JAVA_PACKAGE_CHILD_NODE = "java:package";
- public static final String JAVA_PACKAGE_DECLARATION_CHILD_NODE =
"java:packageDeclaration";
- public static final String JAVA_PACKAGE_NAME = "java:packageName";
-
- // Annnotation declaration
- public static final String JAVA_ANNOTATION_CHILD_NODE = "java:annotation";
- public static final String JAVA_ANNOTATION_DECLARATION_CHILD_NODE =
"java:annotationDeclaration";
- public static final String JAVA_ANNOTATION_TYPE_CHILD_NODE =
"java:annotationType";
-
- // Marker annotation
- public static final String JAVA_MARKER_ANNOTATION_CHILD_NODE =
"java:markerAnnotation";
- public static final String JAVA_MARKER_ANNOTATION_NAME
="java:markerAnnotationName ";
-
- // Normal annotation
- public static final String JAVA_NORMAL_ANNOTATION_CHILD_NODE =
"java:normalAnnotation";
- public static final String JAVA_NORMALANNOTATION_NAME
="java:normalAnnotationName";
-
- // Single element annotation
- public static final String JAVA_SINGLE_ELEMENT_ANNOTATION_CHILD_NODE =
"java:singleElementAnnotation";
- public static final String JAVA_SINGLE_ANNOTATION_NAME
="java:singleElementAnnotationName";
-
- // Import declaration
- public static final String JAVA_IMPORT_CHILD_NODE = "java:import";
- public static final String JAVA_IMPORT_DECLARATION_CHILD_NODE =
"java:importDeclaration";
-
- // Single import declaration
- public static final String JAVA_SINGLE_IMPORT_CHILD_NODE =
"java:singleImport";
- public static final String JAVA_SINGLE_IMPORT_TYPE_DECLARATION_CHILD_NODE =
"java:singleTypeImportDeclaration";
- public static final String JAVA_SINGLE_IMPORT_NAME = "java:singleImportName
";
-
-
- // OnDemand import declaration
- public static final String JAVA_ON_DEMAND_IMPORT_CHILD_NODE =
"java:importOnDemand";
- public static final String JAVA_ON_DEMAND_IMPORT_TYPE_DECLARATION_CHILD_NODE =
"java:typeImportOnDemandDeclaration";
- public static final String JAVA_ON_DEMAND_IMPORT_NAME
="java:onDemandImportName";
-
-
- // Class declaration
- public static final String JAVA_UNIT_TYPE_CHILD_NODE = "java:unitType";
- public static final String JAVA_CLASS_DECLARATION_CHILD_NODE =
"java:classDeclaration";
-
- // Normal class declaration
- public static final String JAVA_NORMAL_CLASS_CHILD_NODE =
"java:normalClass";
- public static final String JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE =
"java:normalClassDeclaration";
- public static final String JAVA_NORMAL_CLASS_NAME =
"java:normalClassName";
-
- // Modifier declaration
- public static final String JAVA_MODIFIER_CHILD_NODE = "java:modifier";
- public static final String JAVA_MODIFIER_DECLARATION_CHILD_NODE =
"java:modifierDeclaration";
- public static final String JAVA_MODIFIER_NAME = "java:modifierName";
-
- // Variable declaration
- public static final String JAVA_VARIABLE = "java:variable";
- public static final String JAVA_VARIABLE_NAME = "java:variableName";
-
- // Primitive type
- public static final String JAVA_FIELD_CHILD_NODE = "java:field";
- public static final String JAVA_FIELD_TYPE_CHILD_NODE = "java:fieldType";
- public static final String JAVA_TYPE_CHILD_NODE = "java:type";
- public static final String JAVA_PRIMITIVE_TYPE_CHILD_NODE =
"java:primitiveType";
- public static final String
JAVA_PRIMITIVE_TYPE_NAME="java:primitiveTypeName";
-
- // Reference type
- public static final String JAVA_REFERENCE_TYPE_CHILD_NODE =
"java:referenceType";
-
- // method declaration
- public static final String JAVA_METHOD_CHILD_NODE = "java:method";
- public static final String JAVA_METHOD_DECLARATION_CHILD_NODE =
"java:methodDeclaration";
- public static final String JAVA_METHOD_NAME = "java:methodName";
-
- // constructor
- public static final String JAVA_CONSTRUCTOR_CHILD_NODE =
"java:constructor";
- public static final String JAVA_CONSTRUCTOR_DECLARATION_CHILD_NODE =
"java:constructorDeclaration";
- public static final String JAVA_CONSTRUCTOR_NAME = "java:constructorName";
-
- // parameter
- public static final String JAVA_PARAMETER = "java:parameter";
- public static final String JAVA_FORMAL_PARAMETER = "java:formalParameter";
- public static final String JAVA_PARAMETER_NAME = "java:parameterName";
-
- public static final String JAVA_RETURN_TYPE = "java:resultType";
-
-
-
-
/**
* {@inheritDoc}
*
@@ -376,18 +330,26 @@
// process fields of the class unit.
int primitiveIndex = 1;
+ int simpleIndex = 1;
+ int parameterizedIndex = 1;
for (FieldMetadata fieldMetadata : classMetadata.getFields()) {
if (fieldMetadata instanceof PrimitiveFieldMetadata) {
+ // primitive type
PrimitiveFieldMetadata primitiveFieldMetadata =
(PrimitiveFieldMetadata)fieldMetadata;
- String primitiveFieldRootPath =
createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
- +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
- +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE
- + SLASH +
JAVA_FIELD_CHILD_NODE + SLASH
- +
JAVA_FIELD_TYPE_CHILD_NODE + SLASH
- +
JAVA_TYPE_CHILD_NODE + SLASH
- +
JAVA_PRIMITIVE_TYPE_CHILD_NODE, primitiveIndex);
+ String primitiveFieldRootPath =
JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+ +
SLASH
+ +
JAVA_UNIT_TYPE_CHILD_NODE
+ +
SLASH
+ +
JAVA_CLASS_DECLARATION_CHILD_NODE
+ +
SLASH
+ +
JAVA_NORMAL_CLASS_CHILD_NODE
+ +
SLASH
+ +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE
+ +
SLASH + JAVA_FIELD_CHILD_NODE + SLASH
+ +
JAVA_FIELD_TYPE_CHILD_NODE + SLASH
+ +
JAVA_TYPE_CHILD_NODE + SLASH
+ +
JAVA_PRIMITIVE_TYPE_CHILD_NODE,
+
primitiveIndex);
// type
Path primitiveTypeChildNode =
pathFactory.create(primitiveFieldRootPath);
output.setProperty(primitiveTypeChildNode,
@@ -396,34 +358,133 @@
// modifiers
List<ModifierMetadata> modifiers =
primitiveFieldMetadata.getModifiers();
int primitiveModifierIndex = 1;
- for (ModifierMetadata modifierMetadata2 : modifiers) {
- String modifierPath =
createPathWithIndex(primitiveFieldRootPath + SLASH
- +
JAVA_MODIFIER_CHILD_NODE + SLASH
- +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
-
primitiveModifierIndex);
+ for (ModifierMetadata modifierMetadata : modifiers) {
+ String modifierPath =
JcrUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ +
JAVA_MODIFIER_CHILD_NODE + SLASH
+ +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
primitiveModifierIndex);
Path modifierChildNode =
pathFactory.create(modifierPath);
output.setProperty(modifierChildNode,
nameFactory.create(JAVA_MODIFIER_NAME),
- modifierMetadata2.getName());
+ modifierMetadata.getName());
primitiveModifierIndex++;
}
// variables
List<Variable> variables =
primitiveFieldMetadata.getVariables();
int primitiveVariableIndex = 1;
for (Variable variable : variables) {
- String variablePath =
createPathWithIndex(primitiveFieldRootPath.toString() + SLASH
- +
JAVA_VARIABLE,
-
primitiveVariableIndex).toString();
+ String variablePath =
JcrUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ +
JAVA_PRIMITIVE_TYPE_VARIABLE + SLASH
+ +
JAVA_VARIABLE, primitiveVariableIndex);
Path primitiveChildNode =
pathFactory.create(variablePath);
- output.setProperty(primitiveChildNode,
nameFactory.create(JAVA_VARIABLE_NAME), variable.getName());
+ sequenceTheVariable(output, nameFactory, variable,
primitiveChildNode);
primitiveVariableIndex++;
}
primitiveIndex++;
}
- if (fieldMetadata instanceof ReferenceFieldMetadata) {
- // ReferenceFieldMetadata parameterizedFieldMetadata =
(ReferenceFieldMetadata)fieldMetadata;
- // TODO
+
+ // Array type
+ if (fieldMetadata instanceof ArrayTypeFieldMetadata) {
+ ArrayTypeFieldMetadata arrayTypeFieldMetadata =
(ArrayTypeFieldMetadata)fieldMetadata;
}
+
+ // Simple type
+ if (fieldMetadata instanceof SimpleTypeFieldMetadata) {
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata =
(SimpleTypeFieldMetadata)fieldMetadata;
+ String simpleTypeFieldRootPath =
JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+
+ SLASH
+
+ JAVA_UNIT_TYPE_CHILD_NODE
+
+ SLASH
+
+ JAVA_CLASS_DECLARATION_CHILD_NODE
+
+ SLASH
+
+ JAVA_NORMAL_CLASS_CHILD_NODE
+
+ SLASH
+
+ JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE
+
+ SLASH + JAVA_FIELD_CHILD_NODE + SLASH
+
+ JAVA_FIELD_TYPE_CHILD_NODE + SLASH
+
+ JAVA_TYPE_CHILD_NODE + SLASH
+
+ JAVA_SIMPLE_TYPE_CHILD_NODE,
+
simpleIndex);
+ Path simpleTypeFieldChildNode =
pathFactory.create(simpleTypeFieldRootPath);
+ output.setProperty(simpleTypeFieldChildNode,
+
nameFactory.create(JAVA_SIMPLE_TYPE_NAME),
+ simpleTypeFieldMetadata.getType());
+
+ // Simple type modifies
+ List<ModifierMetadata> simpleModifiers =
simpleTypeFieldMetadata.getModifiers();
+ int simpleTypeModifierIndex = 1;
+ for (ModifierMetadata modifierMetadata : simpleModifiers) {
+ String simpleTypeModifierPath =
JcrUtil.createPathWithIndex(simpleTypeFieldRootPath
+
+ SLASH
+
+ JAVA_SIMPLE_TYPE_MODIFIER_CHILD_NODE
+
+ SLASH
+
+ JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
simpleTypeModifierIndex);
+ Path simpleTypeModifierChildNode =
pathFactory.create(simpleTypeModifierPath);
+ output.setProperty(simpleTypeModifierChildNode,
+
nameFactory.create(JAVA_MODIFIER_NAME),
+ modifierMetadata.getName());
+ simpleTypeModifierIndex++;
+ }
+
+ // Simple type variables
+ List<Variable> variables =
simpleTypeFieldMetadata.getVariables();
+ int simpleTypeVariableIndex = 1;
+ for (Variable variable : variables) {
+ String variablePath =
JcrUtil.createPathWithIndex(simpleTypeFieldRootPath + SLASH
+ +
JAVA_SIMPLE_TYPE_VARIABLE + SLASH
+ +
JAVA_VARIABLE, simpleTypeVariableIndex);
+ Path primitiveChildNode =
pathFactory.create(variablePath);
+ sequenceTheVariable(output, nameFactory, variable,
primitiveChildNode);
+ simpleTypeVariableIndex++;
+ }
+
+ simpleIndex++;
+ }
+
+ // Qualified type
+ if (fieldMetadata instanceof QualifiedTypeFieldMetadata) {
+ QualifiedTypeFieldMetadata qualifiedTypeFieldMetadata =
(QualifiedTypeFieldMetadata)fieldMetadata;
+
+ }
+
+ // Parameterized type
+ if (fieldMetadata instanceof ParameterizedTypeFieldMetadata) {
+ ParameterizedTypeFieldMetadata parameterizedTypeFieldMetadata
= (ParameterizedTypeFieldMetadata)fieldMetadata;
+ String parameterizedTypeFieldRootPath =
ParameterizedTypeFieldMetadataSequencer.getParameterizedTypeFieldRootPath(parameterizedIndex);
+
ParameterizedTypeFieldMetadataSequencer.sequenceTheParameterizedTypeName(parameterizedTypeFieldMetadata,
+
parameterizedTypeFieldRootPath,
+
pathFactory,
+
nameFactory,
+
output);
+ // Parameterized type modifiers
+ List<ModifierMetadata> parameterizedTypeModifiers =
parameterizedTypeFieldMetadata.getModifiers();
+ int parameterizedTypeModifierIndex = 1;
+ for (ModifierMetadata modifierMetadata :
parameterizedTypeModifiers) {
+ String parameterizedTypeModifierPath =
ParameterizedTypeFieldMetadataSequencer.getParameterizedTypeFieldRModifierPath(parameterizedTypeFieldRootPath,
+
parameterizedTypeModifierIndex);
+
ParameterizedTypeFieldMetadataSequencer.sequenceTheParameterizedTypeModifier(modifierMetadata,
+
parameterizedTypeModifierPath,
+
pathFactory,
+
nameFactory,
+
output);
+ parameterizedTypeModifierIndex++;
+ }
+ // Parameterized type variables
+ List<Variable> parameterizedTypeVariables =
parameterizedTypeFieldMetadata.getVariables();
+ int parameterizedTypeVariableIndex = 1;
+ for (Variable variable : parameterizedTypeVariables) {
+
+ Path parameterizedTypeVariableChildNode =
ParameterizedTypeFieldMetadataSequencer.getParameterizedTypeFieldVariablePath(pathFactory,
+
parameterizedTypeFieldRootPath,
+
parameterizedTypeVariableIndex);
+ sequenceTheVariable(output, nameFactory, variable,
parameterizedTypeVariableChildNode);
+ parameterizedTypeVariableIndex++;
+ }
+
+ parameterizedIndex++;
+ }
+
}
// process methods of the unit.
@@ -432,16 +493,17 @@
int constructorIndex = 1;
for (MethodMetadata methodMetadata : methods) {
if (methodMetadata.isContructor()) {
- // process contructor
+ // process constructor
ConstructorMetadata constructorMetadata =
(ConstructorMetadata)methodMetadata;
- String constructorRootPath =
createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
- +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
- +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_CONSTRUCTOR_CHILD_NODE + SLASH
- +
JAVA_CONSTRUCTOR_DECLARATION_CHILD_NODE,
-
constructorIndex);
+ String constructorRootPath =
JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE
+ +
SLASH + JAVA_CONSTRUCTOR_CHILD_NODE
+ +
SLASH
+ +
JAVA_CONSTRUCTOR_DECLARATION_CHILD_NODE,
+
constructorIndex);
Path constructorChildNode =
pathFactory.create(constructorRootPath);
output.setProperty(constructorChildNode,
nameFactory.create(JAVA_CONSTRUCTOR_NAME),
@@ -450,10 +512,13 @@
// modifiers
int constructorModifierIndex = 1;
for (ModifierMetadata modifierMetadata : modifiers) {
- String contructorModifierPath =
createPathWithIndex(constructorRootPath + SLASH
- +
JAVA_MODIFIER_CHILD_NODE + SLASH
- +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
-
constructorModifierIndex);
+ String contructorModifierPath =
JcrUtil.createPathWithIndex(constructorRootPath
+
+ SLASH
+
+ JAVA_MODIFIER_CHILD_NODE
+
+ SLASH
+
+ JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
constructorModifierIndex);
+
Path constructorModifierChildNode =
pathFactory.create(contructorModifierPath);
output.setProperty(constructorModifierChildNode,
nameFactory.create(JAVA_MODIFIER_NAME),
@@ -463,38 +528,46 @@
// constructor parameters
int constructorParameterIndex = 1;
- for (FieldMetadata fieldMetadata2 :
constructorMetadata.getParameters()) {
+ for (FieldMetadata fieldMetadata :
constructorMetadata.getParameters()) {
- String constructorParameterRootPath =
createPathWithIndex(constructorRootPath + SLASH
-
+ JAVA_PARAMETER + SLASH
-
+ JAVA_FORMAL_PARAMETER,
-
constructorParameterIndex);
+ String constructorParameterRootPath =
JcrUtil.createPathWithIndex(constructorRootPath + SLASH
+
+ JAVA_PARAMETER + SLASH
+
+ JAVA_FORMAL_PARAMETER,
+
constructorParameterIndex);
+ // primitive type
+ if (fieldMetadata instanceof PrimitiveFieldMetadata) {
- if (fieldMetadata2 instanceof PrimitiveFieldMetadata) {
+ PrimitiveFieldMetadata primitiveMetadata =
(PrimitiveFieldMetadata)fieldMetadata;
+ String constructPrimitiveFormalParamRootPath =
MethodMetadataSequencer.createMethodParamRootPath(constructorParameterRootPath);
+ // type
+ Path constructorPrimitiveTypeParamChildNode =
pathFactory.create(constructPrimitiveFormalParamRootPath);
+
output.setProperty(constructorPrimitiveTypeParamChildNode,
+
nameFactory.create(JAVA_PRIMITIVE_TYPE_NAME),
+ primitiveMetadata.getType());
- PrimitiveFieldMetadata primitive =
(PrimitiveFieldMetadata)fieldMetadata2;
- String constructPrimitiveFormalParamRootPath =
createPath(constructorParameterRootPath
-
+ SLASH + JAVA_TYPE_CHILD_NODE
-
+ SLASH
-
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
- String constructorPrimitiveParamVariablePath =
createPath(constructPrimitiveFormalParamRootPath
-
+ SLASH + JAVA_VARIABLE);
- Path constructorParamChildNode =
pathFactory.create(constructorPrimitiveParamVariablePath);
+ Path constructorPrimitiveParamChildNode =
MethodMetadataSequencer.createMethodParamPath(pathFactory,
+
constructPrimitiveFormalParamRootPath);
// variables
- for (Variable variable : primitive.getVariables()) {
- output.setProperty(constructorParamChildNode,
-
nameFactory.create(JAVA_VARIABLE_NAME),
- variable.getName());
+ for (Variable variable :
primitiveMetadata.getVariables()) {
+ sequenceTheVariable(output, nameFactory,
variable, constructorPrimitiveParamChildNode);
}
- // type
- Path constructPrimitiveTypeParamChildNode =
pathFactory.create(constructPrimitiveFormalParamRootPath);
-
output.setProperty(constructPrimitiveTypeParamChildNode,
-
nameFactory.create(JAVA_PRIMITIVE_TYPE_NAME),
- primitive.getType());
}
+ // Simple type
+ if (fieldMetadata instanceof SimpleTypeFieldMetadata) {
+ processMethodFormalParamOfSimpleType(output,
+ nameFactory,
+ pathFactory,
+ fieldMetadata,
+
constructorParameterRootPath);
- // TODO parameter reference types
+ }
+ // parameterized type
+ if (fieldMetadata instanceof
ParameterizedTypeFieldMetadata) {
+ ParameterizedTypeFieldMetadata
parameterizedTypeFieldMetadata = (ParameterizedTypeFieldMetadata)fieldMetadata;
+ }
+ // TODO support for more types
+
constructorParameterIndex++;
}
@@ -503,13 +576,13 @@
// normal method
MethodTypeMemberMetadata methodTypeMemberMetadata =
(MethodTypeMemberMetadata)methodMetadata;
- String methodRootPath =
createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
- +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
- +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
- +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE + SLASH
- +
JAVA_METHOD_CHILD_NODE + SLASH
- +
JAVA_METHOD_DECLARATION_CHILD_NODE, methodIndex);
+ String methodRootPath =
JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE
+ + SLASH +
JAVA_METHOD_CHILD_NODE + SLASH
+ +
JAVA_METHOD_DECLARATION_CHILD_NODE, methodIndex);
Path methodChildNode = pathFactory.create(methodRootPath);
output.setProperty(methodChildNode,
nameFactory.create(JAVA_METHOD_NAME),
@@ -518,9 +591,10 @@
// method modifiers
int methodModierIndex = 1;
for (ModifierMetadata modifierMetadata :
methodTypeMemberMetadata.getModifiers()) {
- String methodModifierPath =
createPathWithIndex(methodRootPath + SLASH + JAVA_MODIFIER_CHILD_NODE
- + SLASH +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
-
methodModierIndex);
+ String methodModifierPath =
JcrUtil.createPathWithIndex(methodRootPath + SLASH
+ +
JAVA_MODIFIER_CHILD_NODE + SLASH
+ +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
methodModierIndex);
Path methodModifierChildNode =
pathFactory.create(methodModifierPath);
output.setProperty(methodModifierChildNode,
nameFactory.create(JAVA_MODIFIER_NAME),
@@ -531,27 +605,25 @@
int methodParameterIndex = 1;
for (FieldMetadata fieldMetadata :
methodMetadata.getParameters()) {
- String methodPrimitiveParamRootPath =
createPathWithIndex(methodRootPath + SLASH + JAVA_PARAMETER
-
+ SLASH + JAVA_FORMAL_PARAMETER,
-
methodParameterIndex);
+ String methodParamRootPath =
JcrUtil.createPathWithIndex(methodRootPath + SLASH + JAVA_PARAMETER
+
+ SLASH + JAVA_FORMAL_PARAMETER,
+
methodParameterIndex);
if (fieldMetadata instanceof PrimitiveFieldMetadata) {
PrimitiveFieldMetadata primitive =
(PrimitiveFieldMetadata)fieldMetadata;
- String methodPrimitiveFormalParamRootPath =
createPath(methodPrimitiveParamRootPath + SLASH
-
+ JAVA_TYPE_CHILD_NODE + SLASH
-
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
+ String methodPrimitiveFormalParamRootPath =
JcrUtil.createPath(methodParamRootPath
+
+ SLASH
+
+ JAVA_TYPE_CHILD_NODE
+
+ SLASH
+
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
- String methodPrimitiveParamVariablePath =
createPath(methodPrimitiveFormalParamRootPath
-
+ SLASH + JAVA_VARIABLE);
-
- Path methodParamChildNode =
pathFactory.create(methodPrimitiveParamVariablePath);
+ Path methodParamChildNode =
MethodMetadataSequencer.createMethodParamPath(pathFactory,
+
methodPrimitiveFormalParamRootPath);
// variables
for (Variable variable : primitive.getVariables()) {
- output.setProperty(methodParamChildNode,
-
nameFactory.create(JAVA_VARIABLE_NAME),
- variable.getName());
+ sequenceTheVariable(output, nameFactory,
variable, methodParamChildNode);
}
// type
Path methodPrimitiveTypeParamChildNode =
pathFactory.create(methodPrimitiveFormalParamRootPath);
@@ -561,6 +633,14 @@
}
+ if (fieldMetadata instanceof SimpleTypeFieldMetadata) {
+ processMethodFormalParamOfSimpleType(output,
+ nameFactory,
+ pathFactory,
+ fieldMetadata,
+
methodParamRootPath);
+ }
+
// TODO parameter reference types
methodParameterIndex++;
@@ -571,9 +651,9 @@
if (methodReturnType instanceof PrimitiveFieldMetadata) {
PrimitiveFieldMetadata methodReturnPrimitiveType =
(PrimitiveFieldMetadata)methodReturnType;
- String methodReturnPrimitiveTypePath =
createPath(methodRootPath.toString() + SLASH
- +
JAVA_RETURN_TYPE + SLASH
- +
JAVA_PRIMITIVE_TYPE_CHILD_NODE);
+ String methodReturnPrimitiveTypePath =
JcrUtil.createPath(methodRootPath + SLASH
+
+ JAVA_RETURN_TYPE + SLASH
+
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
Path methodReturnPrimitiveTypeChildNode =
pathFactory.create(methodReturnPrimitiveTypePath);
output.setProperty(methodReturnPrimitiveTypeChildNode,
nameFactory.create(JAVA_PRIMITIVE_TYPE_NAME),
@@ -597,29 +677,46 @@
}
/**
- * Create a path for the tree with index.
+ * Process formal parameter of type simple type .
*
- * @param path the path.
- * @param index the index begin with 1.
- * @return the string
- * @throws IllegalArgumentException if the path is null, blank or empty, or if the
index is not a positive value
+ * @param output - the {@link SequencerOutput}.
+ * @param nameFactory - The {@link NameFactory}.
+ * @param pathFactory - the {@link PathFactory}.
+ * @param fieldMetadata - the meta data.
+ * @param methodParamRootPath - base path of the parameter.
*/
- private String createPathWithIndex( String path,
- int index ) {
- ArgCheck.isNotEmpty(path, "path");
- ArgCheck.isPositive(index, "index");
- return path + "[" + index + "]";
+ private void processMethodFormalParamOfSimpleType( SequencerOutput output,
+ NameFactory nameFactory,
+ PathFactory pathFactory,
+ FieldMetadata fieldMetadata,
+ String methodParamRootPath ) {
+ SimpleTypeFieldMetadata simpleTypeFieldMetadata =
(SimpleTypeFieldMetadata)fieldMetadata;
+ String methodSimpleTypeFormalParamRootPath =
SimpleTypeMetadataSequencer.createRootPath(methodParamRootPath);
+
SimpleTypeMetadataSequencer.sequenceConstructorSimpleTypeName(simpleTypeFieldMetadata,
+
methodSimpleTypeFormalParamRootPath,
+ output,
+ nameFactory,
+ pathFactory);
+ Path constructorSimpleTypeParamChildNode =
SimpleTypeMetadataSequencer.createSimpleTypeParamPath(pathFactory,
+
methodSimpleTypeFormalParamRootPath);
+ for (Variable variable : simpleTypeFieldMetadata.getVariables()) {
+ sequenceTheVariable(output, nameFactory, variable,
constructorSimpleTypeParamChildNode);
+ }
}
/**
- * Create a path for the tree without index.
+ * Sequence a variable.
*
- * @param path - the path.
- * @return the string
- * @throws IllegalArgumentException if the path is null, blank or empty
+ * @param output - the {@link SequencerOutput}.
+ * @param nameFactory - the {@link NameFactory}.
+ * @param variable - the variable to be added in the tree.
+ * @param path - the path
*/
- private String createPath( String path ) {
- ArgCheck.isNotEmpty(path, "path");
- return path;
+ private void sequenceTheVariable( SequencerOutput output,
+ NameFactory nameFactory,
+ Variable variable,
+ Path path ) {
+ output.setProperty(path, nameFactory.create(JAVA_VARIABLE_NAME),
variable.getName());
}
+
}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaSourceCndDefinition.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java;
+
+/**
+ * JavaSourceCndDefinition defines each elements and sub elements, that must be found in
the java source cnd document.
+ *
+ * @author Serge Pagop
+ */
+public interface JavaSourceCndDefinition {
+
+ public static final String SLASH = "/";
+
+ public static final String JAVA_COMPILATION_UNIT_NODE =
"java:compilationUnit";
+ public static final String JAVA_COMPILATION_UNIT_PRIMARY_TYPE =
"jcr:primaryType";
+
+ // package declaration
+ public static final String JAVA_PACKAGE_CHILD_NODE = "java:package";
+ public static final String JAVA_PACKAGE_DECLARATION_CHILD_NODE =
"java:packageDeclaration";
+ public static final String JAVA_PACKAGE_NAME = "java:packageName";
+
+ // Annnotation declaration
+ public static final String JAVA_ANNOTATION_CHILD_NODE = "java:annotation";
+ public static final String JAVA_ANNOTATION_DECLARATION_CHILD_NODE =
"java:annotationDeclaration";
+ public static final String JAVA_ANNOTATION_TYPE_CHILD_NODE =
"java:annotationType";
+
+ // Marker annotation
+ public static final String JAVA_MARKER_ANNOTATION_CHILD_NODE =
"java:markerAnnotation";
+ public static final String JAVA_MARKER_ANNOTATION_NAME =
"java:markerAnnotationName ";
+
+ // Normal annotation
+ public static final String JAVA_NORMAL_ANNOTATION_CHILD_NODE =
"java:normalAnnotation";
+ public static final String JAVA_NORMALANNOTATION_NAME =
"java:normalAnnotationName";
+
+ // Single element annotation
+ public static final String JAVA_SINGLE_ELEMENT_ANNOTATION_CHILD_NODE =
"java:singleElementAnnotation";
+ public static final String JAVA_SINGLE_ANNOTATION_NAME =
"java:singleElementAnnotationName";
+
+ // Import declaration
+ public static final String JAVA_IMPORT_CHILD_NODE = "java:import";
+ public static final String JAVA_IMPORT_DECLARATION_CHILD_NODE =
"java:importDeclaration";
+
+ // Single import declaration
+ public static final String JAVA_SINGLE_IMPORT_CHILD_NODE =
"java:singleImport";
+ public static final String JAVA_SINGLE_IMPORT_TYPE_DECLARATION_CHILD_NODE =
"java:singleTypeImportDeclaration";
+ public static final String JAVA_SINGLE_IMPORT_NAME = "java:singleImportName
";
+
+ // OnDemand import declaration
+ public static final String JAVA_ON_DEMAND_IMPORT_CHILD_NODE =
"java:importOnDemand";
+ public static final String JAVA_ON_DEMAND_IMPORT_TYPE_DECLARATION_CHILD_NODE =
"java:typeImportOnDemandDeclaration";
+ public static final String JAVA_ON_DEMAND_IMPORT_NAME =
"java:onDemandImportName";
+
+ // Class declaration
+ public static final String JAVA_UNIT_TYPE_CHILD_NODE = "java:unitType";
+ public static final String JAVA_CLASS_DECLARATION_CHILD_NODE =
"java:classDeclaration";
+
+ // Normal class declaration
+ public static final String JAVA_NORMAL_CLASS_CHILD_NODE =
"java:normalClass";
+ public static final String JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE =
"java:normalClassDeclaration";
+ public static final String JAVA_NORMAL_CLASS_NAME =
"java:normalClassName";
+
+ // Modifier declaration
+ public static final String JAVA_MODIFIER_CHILD_NODE = "java:modifier";
+ public static final String JAVA_MODIFIER_DECLARATION_CHILD_NODE =
"java:modifierDeclaration";
+ public static final String JAVA_MODIFIER_NAME = "java:modifierName";
+
+ // Variable declaration
+ public static final String JAVA_VARIABLE = "java:variable";
+ public static final String JAVA_VARIABLE_NAME = "java:variableName";
+
+ // Primitive type
+ public static final String JAVA_FIELD_CHILD_NODE = "java:field";
+ public static final String JAVA_FIELD_TYPE_CHILD_NODE = "java:fieldType";
+ public static final String JAVA_TYPE_CHILD_NODE = "java:type";
+ public static final String JAVA_PRIMITIVE_TYPE_CHILD_NODE =
"java:primitiveType";
+ public static final String JAVA_PRIMITIVE_TYPE_NAME =
"java:primitiveTypeName";
+ public static final String JAVA_PRIMITIVE_TYPE_VARIABLE =
"java:primitiveVariable";
+
+ // Method declaration
+ public static final String JAVA_METHOD_CHILD_NODE = "java:method";
+ public static final String JAVA_METHOD_DECLARATION_CHILD_NODE =
"java:methodDeclaration";
+ public static final String JAVA_METHOD_NAME = "java:methodName";
+
+ // Constructor
+ public static final String JAVA_CONSTRUCTOR_CHILD_NODE =
"java:constructor";
+ public static final String JAVA_CONSTRUCTOR_DECLARATION_CHILD_NODE =
"java:constructorDeclaration";
+ public static final String JAVA_CONSTRUCTOR_NAME = "java:constructorName";
+
+ // Parameter
+ public static final String JAVA_PARAMETER = "java:parameter";
+ public static final String JAVA_FORMAL_PARAMETER = "java:formalParameter";
+ public static final String JAVA_PARAMETER_NAME = "java:parameterName";
+
+ public static final String JAVA_RETURN_TYPE = "java:resultType";
+
+ // Simple type
+ public static final String JAVA_SIMPLE_TYPE_CHILD_NODE =
"java:simpleType";
+ public static final String JAVA_SIMPLE_TYPE_DESCRIPTION =
"java:simpleTypeDescription";
+ public static final String JAVA_SIMPLE_TYPE_NAME = "java:simpleTypeName";
+ public static final String JAVA_SIMPLE_TYPE_VARIABLE =
"java:simpleTypeVariable";
+ public static final String JAVA_SIMPLE_TYPE_MODIFIER_CHILD_NODE =
"java:simpleTypeModifier";
+
+ // Parameterized type
+ public static final String
JAVA_PARAMETERIZED_TYPE_CHILD_NODE="java:parameterizedType";
+ public static final String JAVA_PARAMETERIZED_TYPE_DESCRIPTION
="java:parameterizedTypeDescription";
+ public static final String JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE
="java:parameterizedTypeModifier";
+ public static final String JAVA_PARAMETERIZED_TYPE_NAME
="java:parameterizedTypeName";
+ public static final String JAVA_PARAMETERIZED_TYPE_VARIABLE
="java:parameterizedTypeVariable";
+
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.jboss.dna.common.util.JcrUtil;
+import org.jboss.dna.sequencer.java.metadata.MethodMetadata;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.PathFactory;
+
+/**
+ * Sequencer for a {@link MethodMetadata}.
+ *
+ * @author Serge PAgop
+ *
+ */
+public class MethodMetadataSequencer implements JavaSourceCndDefinition {
+
+ /**
+ * Create a path of method/constructor parameter.
+ * @param pathFactory - {@link PathFactory}.
+ * @param rootPath - Root path of the method/constructor.
+ * @return the path of the parameter.
+ */
+ public static Path createMethodParamPath( PathFactory pathFactory,
+ String rootPath ) {
+ String methodPrimitiveParamVariablePath = JcrUtil.createPath(rootPath
+ + SLASH
+ +
JAVA_PRIMITIVE_TYPE_VARIABLE
+ + SLASH +
JAVA_VARIABLE);
+ Path methodParamChildNode =
pathFactory.create(methodPrimitiveParamVariablePath);
+ return methodParamChildNode;
+ }
+
+ /**
+ * create a root path for method parameter.
+ *
+ * @param constructorParameterRootPath
+ * @return root path for a method parameter.
+ */
+ public static String createMethodParamRootPath( String constructorParameterRootPath )
{
+ String constructPrimitiveFormalParamRootPath =
JcrUtil.createPath(constructorParameterRootPath + SLASH
+ +
JAVA_TYPE_CHILD_NODE + SLASH
+ +
JAVA_PRIMITIVE_TYPE_CHILD_NODE);
+ return constructPrimitiveFormalParamRootPath;
+ }
+
+ private MethodMetadataSequencer() {
+ }
+
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.jboss.dna.common.util.JcrUtil;
+import org.jboss.dna.sequencer.java.metadata.ModifierMetadata;
+import org.jboss.dna.sequencer.java.metadata.ParameterizedTypeFieldMetadata;
+import org.jboss.dna.spi.graph.NameFactory;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.PathFactory;
+import org.jboss.dna.spi.sequencers.SequencerOutput;
+
+/**
+ * Sequencer for all paths of a {@link ParameterizedTypeFieldMetadata}.
+ *
+ * @author Serge Pagop
+ */
+public class ParameterizedTypeFieldMetadataSequencer implements JavaSourceCndDefinition
{
+
+ /**
+ * Create the root path for all path children of a parameterized type.
+ *
+ * @param parameterizedIndex - index in case of multiple paths.
+ * @return a path with a index starting by 1.
+ */
+ public static String getParameterizedTypeFieldRootPath( int parameterizedIndex ) {
+ String simpleTypeFieldRootPath =
JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ +
JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ +
JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
+ +
JAVA_NORMAL_CLASS_DECLARATION_CHILD_NODE + SLASH
+ +
JAVA_FIELD_CHILD_NODE + SLASH + JAVA_FIELD_TYPE_CHILD_NODE
+ + SLASH +
JAVA_TYPE_CHILD_NODE + SLASH
+ +
JAVA_PARAMETERIZED_TYPE_CHILD_NODE, parameterizedIndex);
+ return simpleTypeFieldRootPath;
+ }
+
+ /**
+ * Sequences the type name of the parameterized type.
+ *
+ * @param parameterizedTypeFieldMetadata - the meta data.
+ * @param parameterizedTypeFieldRootPath - the root path of a parameterized type.
+ * @param output - the {@link SequencerOutput}.
+ * @param pathFactory - the {@link PathFactory}.
+ * @param nameFactory - the {@link NameFactory}.
+ */
+ public static void sequenceTheParameterizedTypeName( ParameterizedTypeFieldMetadata
parameterizedTypeFieldMetadata,
+ String
parameterizedTypeFieldRootPath,
+ PathFactory pathFactory,
+ NameFactory nameFactory,
+ SequencerOutput output ) {
+ Path parameterizedTypeFieldChildNode =
pathFactory.create(parameterizedTypeFieldRootPath);
+ output.setProperty(parameterizedTypeFieldChildNode,
+ nameFactory.create(JAVA_PARAMETERIZED_TYPE_NAME),
+ parameterizedTypeFieldMetadata.getType());
+ }
+
+ /**
+ * Create a path for the parameterized modifier.
+ *
+ * @param parameterizedTypeFieldRootPath - the root path to be used.
+ * @param parameterizedTypeModifierIndex - index in case of multiple modifiers.
+ * @return the path.
+ */
+ public static String getParameterizedTypeFieldRModifierPath( String
parameterizedTypeFieldRootPath,
+ int
parameterizedTypeModifierIndex ) {
+ String parameterizedTypeModifierPath =
JcrUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
+ +
JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE + SLASH
+ +
JAVA_MODIFIER_DECLARATION_CHILD_NODE,
+
parameterizedTypeModifierIndex);
+ return parameterizedTypeModifierPath;
+ }
+
+ /**
+ * Sequences a modifier of this parameterized type.
+ *
+ * @param modifierMetadata - the meta data.
+ * @param parameterizedTypeModifierPath - the path of a modifier.
+ * @param pathFactory - the {@link PathFactory}.
+ * @param nameFactory - the {@link NameFactory}.
+ * @param output - the {@link SequencerOutput}.
+ */
+ public static void sequenceTheParameterizedTypeModifier( ModifierMetadata
modifierMetadata,
+ String
parameterizedTypeModifierPath,
+ PathFactory pathFactory,
+ NameFactory nameFactory,
+ SequencerOutput output ) {
+ Path parameterizedTypeModifieChildNode =
pathFactory.create(parameterizedTypeModifierPath);
+ output.setProperty(parameterizedTypeModifieChildNode,
nameFactory.create(JAVA_MODIFIER_NAME), modifierMetadata.getName());
+ }
+
+ /**
+ * Get the path of a parameterized type variable.
+ *
+ * @param pathFactory - the {@link PathFactory}.
+ * @param parameterizedTypeFieldRootPath - the root path.
+ * @param parameterizedTypeVariableIndex - the index in case of multiple paths
+ * @return the path of the parameterized variable.
+ */
+ public static Path getParameterizedTypeFieldVariablePath( PathFactory pathFactory,
+ String
parameterizedTypeFieldRootPath,
+ int
parameterizedTypeVariableIndex ) {
+ String variablePath = JcrUtil.createPathWithIndex(parameterizedTypeFieldRootPath
+ SLASH
+ +
JAVA_PARAMETERIZED_TYPE_VARIABLE + SLASH + JAVA_VARIABLE,
+
parameterizedTypeVariableIndex);
+ Path parameterizedTypeVariableChildNode = pathFactory.create(variablePath);
+ return parameterizedTypeVariableChildNode;
+ }
+
+ private ParameterizedTypeFieldMetadataSequencer() {
+ // prevent constructor
+ }
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java;
+
+import org.jboss.dna.common.util.JcrUtil;
+import org.jboss.dna.sequencer.java.metadata.SimpleTypeFieldMetadata;
+import org.jboss.dna.spi.graph.NameFactory;
+import org.jboss.dna.spi.graph.Path;
+import org.jboss.dna.spi.graph.PathFactory;
+import org.jboss.dna.spi.sequencers.SequencerOutput;
+
+/**
+ * The sequencer of the {@link SimpleTypeFieldMetadata}
+ *
+ * @author Serge Pagop
+ */
+public class SimpleTypeMetadataSequencer implements JavaSourceCndDefinition {
+
+ private SimpleTypeMetadataSequencer() {
+ // prevent construction
+ }
+
+ /**
+ * the root path.
+ *
+ * @param basePath - the base path to use to build a root path.
+ * @return the root path, that is compose from other base path.
+ */
+ public static String createRootPath( String basePath ) {
+ return JcrUtil.createPath(basePath + SLASH + JAVA_TYPE_CHILD_NODE + SLASH +
JAVA_SIMPLE_TYPE_CHILD_NODE);
+ }
+
+ /**
+ * Sequence the type name of the simple type.
+ *
+ * @param simpleTypeFieldMetadata - the {@link SimpleTypeFieldMetadata}.
+ * @param rootPath - the path.
+ * @param output - the {@link SequencerOutput}.
+ * @param nameFactory - the {@link NameFactory}.
+ * @param pathFactory - the {@link PathFactory}.
+ */
+ public static void sequenceConstructorSimpleTypeName( SimpleTypeFieldMetadata
simpleTypeFieldMetadata,
+ String rootPath,
+ SequencerOutput output,
+ NameFactory nameFactory,
+ PathFactory pathFactory ) {
+
+ Path constructorSimpleTypeParamChildNode = pathFactory.create(rootPath);
+ output.setProperty(constructorSimpleTypeParamChildNode,
+ nameFactory.create(JAVA_SIMPLE_TYPE_NAME),
+ simpleTypeFieldMetadata.getType());
+
+ }
+
+ /**
+ * Create the path of parameter.
+ *
+ * @param pathFactory - The {@link PathFactory}.
+ * @param rootPath - the root path need to build the path.
+ * @return the path of a variable node.
+ */
+ public static Path createSimpleTypeParamPath( PathFactory pathFactory,
+ String rootPath ) {
+ String paramVariablePath = JcrUtil.createPath(rootPath + SLASH +
JAVA_SIMPLE_TYPE_VARIABLE + SLASH + JAVA_VARIABLE);
+ return pathFactory.create(paramVariablePath);
+ }
+
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ArrayTypeFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java.metadata;
+
+
+/**
+ * ArrayTypeFieldMetadata represents the meta data for an array type.
+ *
+ * @author Serge Pagop
+ */
+public class ArrayTypeFieldMetadata extends FieldMetadata {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isArrayType()
+ */
+ @Override
+ public boolean isArrayType() {
+ return true;
+ }
+
+ // Element type
+ private FieldMetadata elementType;
+
+ // Component type
+ private FieldMetadata componentType;
+
+ public ArrayTypeFieldMetadata() {
+
+ }
+
+ /**
+ * @return elementType
+ */
+ public FieldMetadata getElementType() {
+ return elementType;
+ }
+
+ /**
+ * @param elementType Sets elementType to the specified value.
+ */
+ public void setElementType( FieldMetadata elementType ) {
+ this.elementType = elementType;
+ }
+
+ /**
+ * @return componentType
+ */
+ public FieldMetadata getComponentType() {
+ return componentType;
+ }
+
+ /**
+ * @param componentType Sets componentType to the specified value.
+ */
+ public void setComponentType( FieldMetadata componentType ) {
+ this.componentType = componentType;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ArrayTypeFieldMetadata [ " + getType() + " ]";
+ }
+}
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/FieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -25,6 +25,8 @@
import java.util.List;
/**
+ * FieldMetadata is the base class of all fields.
+ *
* @author Serge Pagop
*/
public class FieldMetadata {
@@ -78,4 +80,58 @@
public void setModifiers( List<ModifierMetadata> modifierMetadatas ) {
this.modifierMetadatas = modifierMetadatas;
}
+
+ /**
+ * Find out if a field is primitive type or not.
+ *
+ * @return true if field is a primitive type.
+ */
+ public boolean isPrimitiveType() {
+ return false;
+ }
+
+ /**
+ * Find out if a field is a simple type or not.
+ *
+ * @return true if field is a simple type.
+ */
+ public boolean isSimpleType() {
+ return false;
+ }
+
+ /**
+ * Find out if a field is a array type or not.
+ *
+ * @return true if field is a array type.
+ */
+ public boolean isArrayType() {
+ return false;
+ }
+
+ /**
+ * Find out if a field is a qualified type or not.
+ *
+ * @return true if field is a qualified type.
+ */
+ public boolean isQualifiedType() {
+ return false;
+ }
+
+ /**
+ * Find out if a field is a parameterized type or not.
+ *
+ * @return true if field is a parameterized type.
+ */
+ public boolean isParameterizedType() {
+ return false;
+ }
+
+ /**
+ * Find out if a field is a wild card type or not.
+ *
+ * @return true if field is a wild card type.
+ */
+ public boolean isWildcardType() {
+ return false;
+ }
}
Deleted:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedFieldMetadata.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.sequencer.java.metadata;
-
-/**
- * Field meta data for parameterized type.
- */
-public class ParameterizedFieldMetadata extends ReferenceFieldMetadata {
-
-}
Copied:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java
(from rev 476,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedFieldMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ParameterizedTypeFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java.metadata;
+
+/**
+ * ParameterizedTypeFieldMetadata is a meta data for a parameterized type.
+ *
+ * @author Serge Pagop
+ */
+public class ParameterizedTypeFieldMetadata extends FieldMetadata {
+
+ public ParameterizedTypeFieldMetadata() {}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isParameterizedType()
+ */
+ @Override
+ public boolean isParameterizedType() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ParameterizedTypeFieldMetadata [ " + getType() + "
]";
+ }
+
+
+
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/QualifiedTypeFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java.metadata;
+
+
+/**
+ * QualifiedTypeFieldMetadata meta data for a qualified type.
+ *
+ * @author Serge Pagop
+ */
+public class QualifiedTypeFieldMetadata extends FieldMetadata {
+
+ public QualifiedTypeFieldMetadata() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isQualifiedType()
+ */
+ @Override
+ public boolean isQualifiedType() {
+ return super.isQualifiedType();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "QualifiedTypeFieldMetadata [ " + getType() + "]";
+ }
+
+}
Deleted:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ReferenceFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ReferenceFieldMetadata.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/ReferenceFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.sequencer.java.metadata;
-
-/**
- * Field meta data for parameterized type.
- */
-public class ReferenceFieldMetadata extends FieldMetadata {
-}
Deleted:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleFieldMetadata.java 2008-08-28
19:46:55 UTC (rev 478)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.sequencer.java.metadata;
-
-/**
- * field meta data for simple type.
- */
-public class SimpleFieldMetadata extends ReferenceFieldMetadata {
-
-}
Copied:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java
(from rev 476,
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleFieldMetadata.java)
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/SimpleTypeFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java.metadata;
+
+/**
+ * SimpleTypeFieldMetadata is a meta data for simple class type reference ,
+ * a simple interface type reference, or a simple type variable.
+ *
+ * @author serge pagop
+ *
+ */
+public class SimpleTypeFieldMetadata extends FieldMetadata {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isSimpleType()
+ */
+ @Override
+ public boolean isSimpleType() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "SimpleTypeFieldMetadata [ " + getType() + "]" ;
+ }
+
+}
Added:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java
(rev 0)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/metadata/WildcardTypeFieldMetadata.java 2008-08-28
19:50:10 UTC (rev 479)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.sequencer.java.metadata;
+
+
+/**
+ * WildcardTypeFieldMetadata represents meta data for wild card type.
+ * <p>
+ * It is important to know that, it is nonsense if a wild card type appears anywhere
other than as an argument of a
+ * <code>ParameterizedTypeFieldMetadata</code> node.
+ * </p>
+ *
+ * @author Serge Pagop
+ */
+public class WildcardTypeFieldMetadata extends FieldMetadata {
+
+ public WildcardTypeFieldMetadata() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.sequencer.java.metadata.FieldMetadata#isWildcardType()
+ */
+ @Override
+ public boolean isWildcardType() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "WildcardTypeFieldMetadata [ " + getType() + " ]";
+ }
+}