DNA SVN: r488 - trunk/docs/examples/gettingstarted/dna-example-java-sequencer/workspace/project1/src/org/acme.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:33:55 -0400 (Thu, 28 Aug 2008)
New Revision: 488
Modified:
trunk/docs/examples/gettingstarted/dna-example-java-sequencer/workspace/project1/src/org/acme/MySource.java
Log:
more node types
Modified: trunk/docs/examples/gettingstarted/dna-example-java-sequencer/workspace/project1/src/org/acme/MySource.java
===================================================================
--- trunk/docs/examples/gettingstarted/dna-example-java-sequencer/workspace/project1/src/org/acme/MySource.java 2008-08-28 20:33:24 UTC (rev 487)
+++ trunk/docs/examples/gettingstarted/dna-example-java-sequencer/workspace/project1/src/org/acme/MySource.java 2008-08-28 20:33:55 UTC (rev 488)
@@ -38,7 +38,7 @@
MySource() {
}
- public MySource(int i, int j) {
+ public MySource(int i, int j, Object o) {
this.i = i;
this.j = j;
}
@@ -56,7 +56,7 @@
this.j = j;
}
- public void doSomething(int p1, double p2) {
+ public void doSomething(int p1, double p2, Object o) {
l = new ArrayList<String>();
l.add("N1");
}
15 years, 8 months
DNA SVN: r487 - trunk/docs/examples/gettingstarted/dna-example-java-sequencer/src/main/resources.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:33:24 -0400 (Thu, 28 Aug 2008)
New Revision: 487
Modified:
trunk/docs/examples/gettingstarted/dna-example-java-sequencer/src/main/resources/java-source-artifact.cnd
Log:
more node types
Modified: trunk/docs/examples/gettingstarted/dna-example-java-sequencer/src/main/resources/java-source-artifact.cnd
===================================================================
--- trunk/docs/examples/gettingstarted/dna-example-java-sequencer/src/main/resources/java-source-artifact.cnd 2008-08-28 20:32:23 UTC (rev 486)
+++ trunk/docs/examples/gettingstarted/dna-example-java-sequencer/src/main/resources/java-source-artifact.cnd 2008-08-28 20:33:24 UTC (rev 487)
@@ -112,14 +112,14 @@
* Formal parameter
*/
[java:formalParameter] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType)
/**
* Primitive type:
* - Integral type ('byte', 'short', 'int', 'long', 'char')
* - Floating point type ('float', 'double')
* - Boolean type ('boolean')
- * - No return type (''void')
+ * - No return type ('void')
*/
[java:primitiveType] > nt:unstructured
- java:primitiveTypeDescription (string)
@@ -128,21 +128,46 @@
+ java:primitiveVariable (java:variable) = java:variable
[java:variable] > nt:unstructured
- - java:variableName (string)
+ - java:variableName (string) mandatory
/**
- * Reference type (TODO to enhance)
+ * java:arrayType
*/
-[java:referenceType] > nt:unstructured
- - java:ReferenceDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:referenceName (string) mandatory
+[java:arrayType] > nt:unstructured
+ - java:arrayTypeDescription (string)
+ + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:arrayTypeName (string) mandatory
+ + java:arrayTypeVariable (java:variable) = java:variable
+[java:simpleType] > nt:unstructured
+ - java:simpleTypeDescription (string)
+ + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:simpleTypeName (string) mandatory
+ + java:simpleTypeVariable (java:variable) = java:variable
+
+[java:qualifiedType] > nt:unstructured
+ - java:qualifiedTypeDescription (string)
+ + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:qualifiedTypeName (string) mandatory
+ + java:qualifiedTypeVariable (java:variable) = java:variable
+
+[java:wildcardType] > nt:unstructured
+ - java:wildcardTypeDescription (string)
+ + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:wildcardTypeName (string) mandatory
+ + java:wildcardTypeVariable (java:variable) = java:variable
+
+[java:parameterizedType] > nt:unstructured
+ - java:parameterizedTypeDescription (string)
+ + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:parameterizedTypeName (string) mandatory
+ + java:parameterizedTypeVariable (java:variable) = java:variable
+
/**
* Field type
*/
[java:fieldType] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory multiple
/**
* Method declaration
@@ -150,7 +175,7 @@
[java:methodDeclaration] > nt:unstructured
- java:methodDescription (string)
+ java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- + java:resultType (java:primitiveType, java:referenceType) mandatory
+ + java:resultType (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
- java:methodName (string) mandatory
+ java:parameter (java:formalParameter) multiple
15 years, 8 months
DNA SVN: r486 - trunk/dna-common/src/main/java/org/jboss/dna/common/util.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:32:23 -0400 (Thu, 28 Aug 2008)
New Revision: 486
Removed:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/JcrUtil.java
Log:
delete JcrUtil
Deleted: trunk/dna-common/src/main/java/org/jboss/dna/common/util/JcrUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/JcrUtil.java 2008-08-28 20:31:54 UTC (rev 485)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/JcrUtil.java 2008-08-28 20:32:23 UTC (rev 486)
@@ -1,61 +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.common.util;
-
-/**
- * @author Serge Pagop
- *
- */
-public class JcrUtil {
-
- /**
- * Create a path for the tree with index.
- *
- * @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
- */
- public static String createPathWithIndex( String path,
- int index ) {
- ArgCheck.isNotEmpty(path, "path");
- ArgCheck.isPositive(index, "index");
- return path + "[" + index + "]";
- }
-
- /**
- * Create a path for the tree without index.
- *
- * @param path - the path.
- * @return the string
- * @throws IllegalArgumentException if the path is null, blank or empty
- */
- public static String createPath( String path ) {
- ArgCheck.isNotEmpty(path, "path");
- return path;
- }
-
- private JcrUtil() {
- // prevent construction
- }
-
-}
15 years, 8 months
DNA SVN: r485 - trunk/dna-common/src/test/java/org/jboss/dna/common/util.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:31:54 -0400 (Thu, 28 Aug 2008)
New Revision: 485
Removed:
trunk/dna-common/src/test/java/org/jboss/dna/common/util/JcrUtilTest.java
Log:
delete JcrUtil
Deleted: trunk/dna-common/src/test/java/org/jboss/dna/common/util/JcrUtilTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/util/JcrUtilTest.java 2008-08-28 20:27:18 UTC (rev 484)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/util/JcrUtilTest.java 2008-08-28 20:31:54 UTC (rev 485)
@@ -1,55 +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.common.util;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.*;
-import org.junit.Test;
-
-/**
- * @author Serge Pagop
- *
- */
-public class JcrUtilTest {
-
- /**
- * Test method for {@link org.jboss.dna.common.util.JcrUtil#createPathWithIndex(java.lang.String, int)}.
- */
- @Test
- public void shouldCreatePathWithIndex() {
- int index = 1;
- String path = JcrUtil.createPathWithIndex("/a/b/c", 1);
- char c = path.charAt(path.indexOf("[") + 1);
- assertTrue( c == Integer.toString(index).charAt(0));
- }
-
- /**
- * Test method for {@link org.jboss.dna.common.util.JcrUtil#createPath(java.lang.String)}.
- */
- @Test
- public void shouldCreatePath() {
- String path = JcrUtil.createPath("/a/b/c");
- assertTrue(path.length() > 0);
- assertThat(path, is(new String("/a/b/c")));
- }
-
-}
15 years, 8 months
DNA SVN: r484 - trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:27:18 -0400 (Thu, 28 Aug 2008)
New Revision: 484
Modified:
trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java
Log:
more type support and some utils / refactory
Modified: trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java 2008-08-28 20:26:40 UTC (rev 483)
+++ trunk/extensions/dna-sequencer-java/src/test/workspace/projectX/src/org/acme/MySource.java 2008-08-28 20:27:18 UTC (rev 484)
@@ -38,7 +38,7 @@
MySource() {
}
- public MySource(int i, int j) {
+ public MySource(int i, int j, Object o) {
this.i = i;
this.j = j;
}
@@ -56,7 +56,7 @@
this.j = j;
}
- public void doSomething(int p1, double p2) {
+ public void doSomething(int p1, double p2, Object o) {
l = new ArrayList<String>();
l.add("N1");
}
15 years, 8 months
DNA SVN: r483 - trunk/extensions/dna-sequencer-java/src/test/resources.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:26:40 -0400 (Thu, 28 Aug 2008)
New Revision: 483
Modified:
trunk/extensions/dna-sequencer-java/src/test/resources/java-source-artifact.cnd
Log:
more type support and some utils / refactory
Modified: trunk/extensions/dna-sequencer-java/src/test/resources/java-source-artifact.cnd
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/resources/java-source-artifact.cnd 2008-08-28 20:26:16 UTC (rev 482)
+++ trunk/extensions/dna-sequencer-java/src/test/resources/java-source-artifact.cnd 2008-08-28 20:26:40 UTC (rev 483)
@@ -112,14 +112,14 @@
* Formal parameter
*/
[java:formalParameter] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType)
/**
* Primitive type:
* - Integral type ('byte', 'short', 'int', 'long', 'char')
* - Floating point type ('float', 'double')
* - Boolean type ('boolean')
- * - No return type (''void')
+ * - No return type ('void')
*/
[java:primitiveType] > nt:unstructured
- java:primitiveTypeDescription (string)
@@ -128,21 +128,46 @@
+ java:primitiveVariable (java:variable) = java:variable
[java:variable] > nt:unstructured
- - java:variableName (string)
+ - java:variableName (string) mandatory
/**
- * Reference type (TODO to enhance)
+ * java:arrayType
*/
-[java:referenceType] > nt:unstructured
- - java:ReferenceDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:referenceName (string) mandatory
+[java:arrayType] > nt:unstructured
+ - java:arrayTypeDescription (string)
+ + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:arrayTypeName (string) mandatory
+ + java:arrayTypeVariable (java:variable) = java:variable
+[java:simpleType] > nt:unstructured
+ - java:simpleTypeDescription (string)
+ + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:simpleTypeName (string) mandatory
+ + java:simpleTypeVariable (java:variable) = java:variable
+
+[java:qualifiedType] > nt:unstructured
+ - java:qualifiedTypeDescription (string)
+ + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:qualifiedTypeName (string) mandatory
+ + java:qualifiedTypeVariable (java:variable) = java:variable
+
+[java:wildcardType] > nt:unstructured
+ - java:wildcardTypeDescription (string)
+ + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:wildcardTypeName (string) mandatory
+ + java:wildcardTypeVariable (java:variable) = java:variable
+
+[java:parameterizedType] > nt:unstructured
+ - java:parameterizedTypeDescription (string)
+ + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:parameterizedTypeName (string) mandatory
+ + java:parameterizedTypeVariable (java:variable) = java:variable
+
/**
* Field type
*/
[java:fieldType] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory multiple
/**
* Method declaration
@@ -150,7 +175,7 @@
[java:methodDeclaration] > nt:unstructured
- java:methodDescription (string)
+ java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- + java:resultType (java:primitiveType, java:referenceType) mandatory
+ + java:resultType (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
- java:methodName (string) mandatory
+ java:parameter (java:formalParameter) multiple
15 years, 8 months
DNA SVN: r482 - in trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna: sequencer/java and 1 other directory.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:26:16 -0400 (Thu, 28 Aug 2008)
New Revision: 482
Modified:
trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java
trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
Log:
more type support and some utils / refactory
Modified: trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java 2008-08-28 20:25:42 UTC (rev 481)
+++ trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/jackrabbitcdnsupport/jackrabbitCNDSupportsTest.java 2008-08-28 20:26:16 UTC (rev 482)
@@ -21,7 +21,6 @@
*/
package org.jboss.dna.jackrabbitcdnsupport;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.FileInputStream;
@@ -91,7 +90,7 @@
FileInputStream cndFile = new FileInputStream(TESTATA_PATH + "java-source-artifact.cnd");
assertNotNull(cndFile);
NodeType[] nodeTypes = ntm.registerNodeTypes(cndFile, JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
- assertEquals(26, nodeTypes.length);
+ assertTrue(nodeTypes.length > 0);
for (NodeType nodeType : nodeTypes) {
System.out.println("node type name: " + nodeType.getName());
}
Modified: trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java 2008-08-28 20:25:42 UTC (rev 481)
+++ trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataSequencerTest.java 2008-08-28 20:26:16 UTC (rev 482)
@@ -122,11 +122,11 @@
"java:primitiveTypeName"),
is(new Object[] {"int"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[1]/java:variable[1]",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[1]/java:primitiveVariable/java:variable[1]",
"java:variableName"),
is(new Object[] {"i"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[1]/java:variable[2]",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[1]/java:primitiveVariable/java:variable[2]",
"java:variableName"),
is(new Object[] {"j"}));
@@ -142,21 +142,24 @@
"java:primitiveTypeName"),
is(new Object[] {"double"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[2]/java:variable[1]",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:primitiveType[2]/java:primitiveVariable/java:variable[1]",
"java:variableName"),
is(new Object[] {"a"}));
// support for reference type sequencing ()
- // assertThat(output.getPropertyValues("java:compilationUnit/java:type/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:referenceType",
- // "java:name"),
- // is(new Object[] {"l"}));
- // assertThat(output.getPropertyValues("java:compilationUnit/java:type/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:referenceType",
- // "java:name"),
- // is(new Object[] {"o"}));
- // assertThat(output.getPropertyValues("java:compilationUnit/java:type/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:referenceType",
- // "java:name"),
- // is(new Object[] {"x"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:parameterizedType[1]",
+ "java:parameterizedTypeName"),
+ is(new Object[] {"List"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:parameterizedType[2]",
+ "java:parameterizedTypeName"),
+ is(new Object[] {"A"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:simpleType[1]",
+ "java:simpleTypeName"),
+ is(new Object[] {"X"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:field/java:fieldType/java:type/java:simpleType[1]/java:simpleTypeVariable/java:variable[1]",
+ "java:variableName"),
+ is(new Object[] {"x"}));
// support for methods sequencing (modifiers, return type, method name, parameters).Not supported are javadoc
@@ -165,7 +168,7 @@
"java:constructorName"),
is(new Object[] {"MySource"}));
- // public MySource(int i, int j) constructor with parameters
+ // public MySource(int i, int j, Object 0) constructor with parameters
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:modifier/java:modifierDeclaration[1]",
"java:modifierName"),
is(new Object[] {"public"}));
@@ -177,17 +180,24 @@
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
"java:primitiveTypeName"),
is(new Object[] {"int"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:variable",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:primitiveVariable/java:variable",
"java:variableName"),
is(new Object[] {"i"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType",
"java:primitiveTypeName"),
is(new Object[] {"int"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType/java:variable",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType/java:primitiveVariable/java:variable",
"java:variableName"),
is(new Object[] {"j"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[3]/java:type/java:simpleType",
+ "java:simpleTypeName"),
+ is(new Object[] {"Object"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:constructor/java:constructorDeclaration[2]/java:parameter/java:formalParameter[3]/java:type/java:simpleType/java:simpleTypeVariable /java:variable",
+ "java:variableName"),
+ is(new Object[] {"o"}));
+
// public int getI() method
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[1]/java:modifier/java:modifierDeclaration[1]",
"java:modifierName"),
@@ -212,7 +222,7 @@
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
"java:primitiveTypeName"),
is(new Object[] {"int"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:variable",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[2]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:primitiveVariable/java:variable",
"java:variableName"),
is(new Object[] {"i"}));
@@ -229,16 +239,23 @@
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType",
"java:primitiveTypeName"),
is(new Object[] {"int"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:variable",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[1]/java:type/java:primitiveType/java:primitiveVariable/java:variable",
"java:variableName"),
is(new Object[] {"p1"}));
assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType",
"java:primitiveTypeName"),
is(new Object[] {"double"}));
- assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType/java:variable",
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[2]/java:type/java:primitiveType/java:primitiveVariable/java:variable",
"java:variableName"),
is(new Object[] {"p2"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[3]/java:type/java:simpleType",
+ "java:simpleTypeName"),
+ is(new Object[] {"Object"}));
+ assertThat(output.getPropertyValues("java:compilationUnit/java:unitType/java:classDeclaration/java:normalClass/java:normalClassDeclaration/java:method/java:methodDeclaration[4]/java:parameter/java:formalParameter[3]/java:type/java:simpleType/java:simpleTypeVariable/java:variable",
+ "java:variableName"),
+ is(new Object[] {"o"}));
+
}
}
Modified: trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java 2008-08-28 20:25:42 UTC (rev 481)
+++ trunk/extensions/dna-sequencer-java/src/test/java/org/jboss/dna/sequencer/java/JavaMetadataTest.java 2008-08-28 20:26:16 UTC (rev 482)
@@ -46,8 +46,9 @@
import org.jboss.dna.sequencer.java.metadata.MethodMetadata;
import org.jboss.dna.sequencer.java.metadata.MethodTypeMemberMetadata;
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.SimpleTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.SingleImportMetadata;
import org.jboss.dna.sequencer.java.metadata.TypeMetadata;
import org.junit.After;
@@ -158,7 +159,7 @@
// get fields
List<FieldMetadata> fields = classMetadata.getFields();
assertNotNull(fields);
- assertTrue(fields.size() == 5);
+ assertTrue(fields.size() > 0);
PrimitiveFieldMetadata primitiveFieldMetadata = (PrimitiveFieldMetadata)fields.get(0);
assertTrue(primitiveFieldMetadata.getModifiers().size() == 1);
@@ -171,19 +172,20 @@
assertThat(primitiveFieldMetadata2.getType(), is("double"));
assertThat(primitiveFieldMetadata2.getVariables().get(0).getName(), is("a"));
- ReferenceFieldMetadata parameterizedFieldMetadata1 = (ReferenceFieldMetadata)fields.get(2);
+ ParameterizedTypeFieldMetadata parameterizedFieldMetadata1 = (ParameterizedTypeFieldMetadata)fields.get(2);
assertNotNull(parameterizedFieldMetadata1);
assertTrue(parameterizedFieldMetadata1.getModifiers().size() == 1);
assertThat(parameterizedFieldMetadata1.getType(), is("List"));
assertThat(parameterizedFieldMetadata1.getVariables().get(0).getName(), is("l"));
- ReferenceFieldMetadata parameterizedFieldMetadata2 = (ReferenceFieldMetadata)fields.get(3);
+ ParameterizedTypeFieldMetadata parameterizedFieldMetadata2 = (ParameterizedTypeFieldMetadata)fields.get(3);
assertNotNull(parameterizedFieldMetadata2);
assertTrue(parameterizedFieldMetadata2.getModifiers().size() == 1);
assertThat(parameterizedFieldMetadata2.getType(), is("A"));
assertThat(parameterizedFieldMetadata2.getVariables().get(0).getName(), is("o"));
- ReferenceFieldMetadata simpleFieldMetadata = (ReferenceFieldMetadata)fields.get(4);
+
+ SimpleTypeFieldMetadata simpleFieldMetadata = (SimpleTypeFieldMetadata)fields.get(4);
assertNotNull(simpleFieldMetadata);
assertTrue(simpleFieldMetadata.getModifiers().size() == 1);
assertThat(simpleFieldMetadata.getType(), is("X"));
@@ -206,7 +208,7 @@
assertNotNull(constructorMetadata2);
assertTrue(constructorMetadata2.getModifiers().size() == 1);
assertThat(constructorMetadata2.getName(), is("MySource"));
- assertTrue(constructorMetadata2.getParameters().size() == 2);
+ assertTrue(constructorMetadata2.getParameters().size() > 0);
MethodTypeMemberMetadata methodTypeMemberMetadata1 = (MethodTypeMemberMetadata)methods.get(2);
assertTrue(methodTypeMemberMetadata1.getModifiers().size() == 1);
@@ -234,7 +236,7 @@
assertEquals(methodTypeMemberMetadata5.getReturnType().getType(), "void");
assertNotNull(methodTypeMemberMetadata5);
assertThat(methodTypeMemberMetadata5.getName(), is("doSomething"));
- assertTrue(methodTypeMemberMetadata5.getParameters().size() == 2);
+ assertTrue(methodTypeMemberMetadata5.getParameters().size() > 0);
}
}
}
15 years, 8 months
DNA SVN: r481 - trunk/extensions/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:25:42 -0400 (Thu, 28 Aug 2008)
New Revision: 481
Modified:
trunk/extensions/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd
Log:
more type support and some utils / refactory
Modified: trunk/extensions/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd
===================================================================
--- trunk/extensions/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd 2008-08-28 20:25:25 UTC (rev 480)
+++ trunk/extensions/dna-sequencer-java/src/main/resources/org/jboss/dna/sequencer/java/java-source-artifact.cnd 2008-08-28 20:25:42 UTC (rev 481)
@@ -112,7 +112,7 @@
* Formal parameter
*/
[java:formalParameter] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType)
/**
* Primitive type:
@@ -128,21 +128,46 @@
+ java:primitiveVariable (java:variable) = java:variable
[java:variable] > nt:unstructured
- - java:variableName (string)
+ - java:variableName (string) mandatory
/**
- * Reference type (TODO to enhance)
+ * java:arrayType
*/
-[java:referenceType] > nt:unstructured
- - java:ReferenceDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:referenceName (string) mandatory
+[java:arrayType] > nt:unstructured
+ - java:arrayTypeDescription (string)
+ + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:arrayTypeName (string) mandatory
+ + java:arrayTypeVariable (java:variable) = java:variable
+[java:simpleType] > nt:unstructured
+ - java:simpleTypeDescription (string)
+ + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:simpleTypeName (string) mandatory
+ + java:simpleTypeVariable (java:variable) = java:variable
+
+[java:qualifiedType] > nt:unstructured
+ - java:qualifiedTypeDescription (string)
+ + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:qualifiedTypeName (string) mandatory
+ + java:qualifiedTypeVariable (java:variable) = java:variable
+
+[java:wildcardType] > nt:unstructured
+ - java:wildcardTypeDescription (string)
+ + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:wildcardTypeName (string) mandatory
+ + java:wildcardTypeVariable (java:variable) = java:variable
+
+[java:parameterizedType] > nt:unstructured
+ - java:parameterizedTypeDescription (string)
+ + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:parameterizedTypeName (string) mandatory
+ + java:parameterizedTypeVariable (java:variable) = java:variable
+
/**
* Field type
*/
[java:fieldType] > nt:unstructured
- + java:type (java:primitiveType, java:referenceType) mandatory multiple
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory multiple
/**
* Method declaration
@@ -150,7 +175,7 @@
[java:methodDeclaration] > nt:unstructured
- java:methodDescription (string)
+ java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- + java:resultType (java:primitiveType, java:referenceType) mandatory
+ + java:resultType (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
- java:methodName (string) mandatory
+ java:parameter (java:formalParameter) multiple
15 years, 8 months
DNA SVN: r480 - trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2008-08-28 16:25:25 -0400 (Thu, 28 Aug 2008)
New Revision: 480
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/JavaMetadataUtil.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
Log:
more type support and some utils / refactory
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:50:10 UTC (rev 479)
+++ trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataSequencer.java 2008-08-28 20:25:25 UTC (rev 480)
@@ -26,7 +26,6 @@
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.jboss.dna.common.monitor.ProgressMonitor;
-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;
@@ -336,7 +335,7 @@
if (fieldMetadata instanceof PrimitiveFieldMetadata) {
// primitive type
PrimitiveFieldMetadata primitiveFieldMetadata = (PrimitiveFieldMetadata)fieldMetadata;
- String primitiveFieldRootPath = JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+ String primitiveFieldRootPath = JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+ SLASH
+ JAVA_UNIT_TYPE_CHILD_NODE
+ SLASH
@@ -359,7 +358,7 @@
List<ModifierMetadata> modifiers = primitiveFieldMetadata.getModifiers();
int primitiveModifierIndex = 1;
for (ModifierMetadata modifierMetadata : modifiers) {
- String modifierPath = JcrUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ String modifierPath = JavaMetadataUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ JAVA_MODIFIER_CHILD_NODE + SLASH
+ JAVA_MODIFIER_DECLARATION_CHILD_NODE,
primitiveModifierIndex);
@@ -373,7 +372,7 @@
List<Variable> variables = primitiveFieldMetadata.getVariables();
int primitiveVariableIndex = 1;
for (Variable variable : variables) {
- String variablePath = JcrUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ String variablePath = JavaMetadataUtil.createPathWithIndex(primitiveFieldRootPath + SLASH
+ JAVA_PRIMITIVE_TYPE_VARIABLE + SLASH
+ JAVA_VARIABLE, primitiveVariableIndex);
Path primitiveChildNode = pathFactory.create(variablePath);
@@ -391,7 +390,7 @@
// Simple type
if (fieldMetadata instanceof SimpleTypeFieldMetadata) {
SimpleTypeFieldMetadata simpleTypeFieldMetadata = (SimpleTypeFieldMetadata)fieldMetadata;
- String simpleTypeFieldRootPath = JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+ String simpleTypeFieldRootPath = JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE
+ SLASH
+ JAVA_UNIT_TYPE_CHILD_NODE
+ SLASH
@@ -414,7 +413,7 @@
List<ModifierMetadata> simpleModifiers = simpleTypeFieldMetadata.getModifiers();
int simpleTypeModifierIndex = 1;
for (ModifierMetadata modifierMetadata : simpleModifiers) {
- String simpleTypeModifierPath = JcrUtil.createPathWithIndex(simpleTypeFieldRootPath
+ String simpleTypeModifierPath = JavaMetadataUtil.createPathWithIndex(simpleTypeFieldRootPath
+ SLASH
+ JAVA_SIMPLE_TYPE_MODIFIER_CHILD_NODE
+ SLASH
@@ -431,7 +430,7 @@
List<Variable> variables = simpleTypeFieldMetadata.getVariables();
int simpleTypeVariableIndex = 1;
for (Variable variable : variables) {
- String variablePath = JcrUtil.createPathWithIndex(simpleTypeFieldRootPath + SLASH
+ String variablePath = JavaMetadataUtil.createPathWithIndex(simpleTypeFieldRootPath + SLASH
+ JAVA_SIMPLE_TYPE_VARIABLE + SLASH
+ JAVA_VARIABLE, simpleTypeVariableIndex);
Path primitiveChildNode = pathFactory.create(variablePath);
@@ -495,7 +494,7 @@
if (methodMetadata.isContructor()) {
// process constructor
ConstructorMetadata constructorMetadata = (ConstructorMetadata)methodMetadata;
- String constructorRootPath = JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ String constructorRootPath = JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
@@ -512,7 +511,7 @@
// modifiers
int constructorModifierIndex = 1;
for (ModifierMetadata modifierMetadata : modifiers) {
- String contructorModifierPath = JcrUtil.createPathWithIndex(constructorRootPath
+ String contructorModifierPath = JavaMetadataUtil.createPathWithIndex(constructorRootPath
+ SLASH
+ JAVA_MODIFIER_CHILD_NODE
+ SLASH
@@ -530,7 +529,7 @@
int constructorParameterIndex = 1;
for (FieldMetadata fieldMetadata : constructorMetadata.getParameters()) {
- String constructorParameterRootPath = JcrUtil.createPathWithIndex(constructorRootPath + SLASH
+ String constructorParameterRootPath = JavaMetadataUtil.createPathWithIndex(constructorRootPath + SLASH
+ JAVA_PARAMETER + SLASH
+ JAVA_FORMAL_PARAMETER,
constructorParameterIndex);
@@ -576,7 +575,7 @@
// normal method
MethodTypeMemberMetadata methodTypeMemberMetadata = (MethodTypeMemberMetadata)methodMetadata;
- String methodRootPath = JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ String methodRootPath = JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
@@ -591,7 +590,7 @@
// method modifiers
int methodModierIndex = 1;
for (ModifierMetadata modifierMetadata : methodTypeMemberMetadata.getModifiers()) {
- String methodModifierPath = JcrUtil.createPathWithIndex(methodRootPath + SLASH
+ String methodModifierPath = JavaMetadataUtil.createPathWithIndex(methodRootPath + SLASH
+ JAVA_MODIFIER_CHILD_NODE + SLASH
+ JAVA_MODIFIER_DECLARATION_CHILD_NODE,
methodModierIndex);
@@ -605,7 +604,7 @@
int methodParameterIndex = 1;
for (FieldMetadata fieldMetadata : methodMetadata.getParameters()) {
- String methodParamRootPath = JcrUtil.createPathWithIndex(methodRootPath + SLASH + JAVA_PARAMETER
+ String methodParamRootPath = JavaMetadataUtil.createPathWithIndex(methodRootPath + SLASH + JAVA_PARAMETER
+ SLASH + JAVA_FORMAL_PARAMETER,
methodParameterIndex);
@@ -613,7 +612,7 @@
PrimitiveFieldMetadata primitive = (PrimitiveFieldMetadata)fieldMetadata;
- String methodPrimitiveFormalParamRootPath = JcrUtil.createPath(methodParamRootPath
+ String methodPrimitiveFormalParamRootPath = JavaMetadataUtil.createPath(methodParamRootPath
+ SLASH
+ JAVA_TYPE_CHILD_NODE
+ SLASH
@@ -651,7 +650,7 @@
if (methodReturnType instanceof PrimitiveFieldMetadata) {
PrimitiveFieldMetadata methodReturnPrimitiveType = (PrimitiveFieldMetadata)methodReturnType;
- String methodReturnPrimitiveTypePath = JcrUtil.createPath(methodRootPath + SLASH
+ String methodReturnPrimitiveTypePath = JavaMetadataUtil.createPath(methodRootPath + SLASH
+ JAVA_RETURN_TYPE + SLASH
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
Path methodReturnPrimitiveTypeChildNode = pathFactory.create(methodReturnPrimitiveTypePath);
Modified: trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
===================================================================
--- trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2008-08-28 19:50:10 UTC (rev 479)
+++ trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2008-08-28 20:25:25 UTC (rev 480)
@@ -68,7 +68,34 @@
ArgCheck.isNotNull(name, "name");
return name.getFullyQualifiedName();
}
+
+ /**
+ * Create a path for the tree with index.
+ *
+ * @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
+ */
+ public static String createPathWithIndex( String path,
+ int index ) {
+ ArgCheck.isNotEmpty(path, "path");
+ ArgCheck.isPositive(index, "index");
+ return path + "[" + index + "]";
+ }
+ /**
+ * Create a path for the tree without index.
+ *
+ * @param path - the path.
+ * @return the string
+ * @throws IllegalArgumentException if the path is null, blank or empty
+ */
+ public static String createPath( String path ) {
+ ArgCheck.isNotEmpty(path, "path");
+ return path;
+ }
+
// prevent construction
private JavaMetadataUtil() {
}
Modified: 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 2008-08-28 19:50:10 UTC (rev 479)
+++ trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/MethodMetadataSequencer.java 2008-08-28 20:25:25 UTC (rev 480)
@@ -21,7 +21,6 @@
*/
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;
@@ -42,7 +41,7 @@
*/
public static Path createMethodParamPath( PathFactory pathFactory,
String rootPath ) {
- String methodPrimitiveParamVariablePath = JcrUtil.createPath(rootPath
+ String methodPrimitiveParamVariablePath = JavaMetadataUtil.createPath(rootPath
+ SLASH
+ JAVA_PRIMITIVE_TYPE_VARIABLE
+ SLASH + JAVA_VARIABLE);
@@ -57,7 +56,7 @@
* @return root path for a method parameter.
*/
public static String createMethodParamRootPath( String constructorParameterRootPath ) {
- String constructPrimitiveFormalParamRootPath = JcrUtil.createPath(constructorParameterRootPath + SLASH
+ String constructPrimitiveFormalParamRootPath = JavaMetadataUtil.createPath(constructorParameterRootPath + SLASH
+ JAVA_TYPE_CHILD_NODE + SLASH
+ JAVA_PRIMITIVE_TYPE_CHILD_NODE);
return constructPrimitiveFormalParamRootPath;
Modified: 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 2008-08-28 19:50:10 UTC (rev 479)
+++ trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/ParameterizedTypeFieldMetadataSequencer.java 2008-08-28 20:25:25 UTC (rev 480)
@@ -21,7 +21,6 @@
*/
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;
@@ -43,7 +42,7 @@
* @return a path with a index starting by 1.
*/
public static String getParameterizedTypeFieldRootPath( int parameterizedIndex ) {
- String simpleTypeFieldRootPath = JcrUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ String simpleTypeFieldRootPath = JavaMetadataUtil.createPathWithIndex(JAVA_COMPILATION_UNIT_NODE + SLASH
+ JAVA_UNIT_TYPE_CHILD_NODE + SLASH
+ JAVA_CLASS_DECLARATION_CHILD_NODE + SLASH
+ JAVA_NORMAL_CLASS_CHILD_NODE + SLASH
@@ -83,7 +82,7 @@
*/
public static String getParameterizedTypeFieldRModifierPath( String parameterizedTypeFieldRootPath,
int parameterizedTypeModifierIndex ) {
- String parameterizedTypeModifierPath = JcrUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
+ String parameterizedTypeModifierPath = JavaMetadataUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
+ JAVA_PARAMETERIZED_TYPE_MODIFIER_CHILD_NODE + SLASH
+ JAVA_MODIFIER_DECLARATION_CHILD_NODE,
parameterizedTypeModifierIndex);
@@ -119,7 +118,7 @@
public static Path getParameterizedTypeFieldVariablePath( PathFactory pathFactory,
String parameterizedTypeFieldRootPath,
int parameterizedTypeVariableIndex ) {
- String variablePath = JcrUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
+ String variablePath = JavaMetadataUtil.createPathWithIndex(parameterizedTypeFieldRootPath + SLASH
+ JAVA_PARAMETERIZED_TYPE_VARIABLE + SLASH + JAVA_VARIABLE,
parameterizedTypeVariableIndex);
Path parameterizedTypeVariableChildNode = pathFactory.create(variablePath);
Modified: 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 2008-08-28 19:50:10 UTC (rev 479)
+++ trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/SimpleTypeMetadataSequencer.java 2008-08-28 20:25:25 UTC (rev 480)
@@ -21,7 +21,6 @@
*/
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;
@@ -46,7 +45,7 @@
* @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);
+ return JavaMetadataUtil.createPath(basePath + SLASH + JAVA_TYPE_CHILD_NODE + SLASH + JAVA_SIMPLE_TYPE_CHILD_NODE);
}
/**
@@ -80,7 +79,7 @@
*/
public static Path createSimpleTypeParamPath( PathFactory pathFactory,
String rootPath ) {
- String paramVariablePath = JcrUtil.createPath(rootPath + SLASH + JAVA_SIMPLE_TYPE_VARIABLE + SLASH + JAVA_VARIABLE);
+ String paramVariablePath = JavaMetadataUtil.createPath(rootPath + SLASH + JAVA_SIMPLE_TYPE_VARIABLE + SLASH + JAVA_VARIABLE);
return pathFactory.create(paramVariablePath);
}
15 years, 8 months
DNA SVN: r479 - in trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java: metadata and 1 other directory.
by dna-commits@lists.jboss.org
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() + " ]";
+ }
+}
15 years, 8 months