/[Apache-SVN]/jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/java/org/apache/commons/betwixt/schema/ComplexType.java
ViewVC logotype

Diff of /jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/java/org/apache/commons/betwixt/schema/ComplexType.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/java/org/apache/commons/betwixt/schema/ComplexType.java	2005/06/05 15:49:25	180103
+++ jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/java/org/apache/commons/betwixt/schema/ComplexType.java	2005/06/05 15:50:03	180104
@@ -12,7 +12,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */ 
+ */
 
 package org.apache.commons.betwixt.schema;
 
@@ -25,10 +25,11 @@ import org.apache.commons.betwixt.Elemen
 import org.apache.commons.betwixt.XMLBeanInfo;
 
 /**
- * Models a <code>complexType</code>.
- * Global (top level) complex types are represented by {@link GlobalComplexType}.
- * Locally defined or referenced complex types are represented by {@link LocalComplexType}. 
- * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team</a>
+ * Models a <code>complexType</code>. Global (top level) complex types are
+ * represented by {@link GlobalComplexType}. Locally defined or referenced
+ * complex types are represented by {@link LocalComplexType}.
+ * 
+ * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team </a>
  * @version $Revision$
  */
 public abstract class ComplexType {
@@ -37,20 +38,25 @@ public abstract class ComplexType {
 
     protected List attributes = new ArrayList();
 
-    public ComplexType() {}
+    public ComplexType() {
+    }
 
-    public ComplexType(TranscriptionConfiguration configuration, ElementDescriptor elementDescriptor, Schema schema) throws IntrospectionException {
+    public ComplexType(TranscriptionConfiguration configuration,
+            ElementDescriptor elementDescriptor, Schema schema)
+            throws IntrospectionException {
         elementDescriptor = fillDescriptor(elementDescriptor, schema);
-        init(configuration, elementDescriptor, schema);      
+        init(configuration, elementDescriptor, schema);
     }
 
     /**
      * @param elementDescriptor
      * @param schema
-     * @return
-     * @throws IntrospectionException
+     * @return @throws
+     *         IntrospectionException
      */
-    protected ElementDescriptor fillDescriptor(ElementDescriptor elementDescriptor, Schema schema) throws IntrospectionException {
+    protected ElementDescriptor fillDescriptor(
+            ElementDescriptor elementDescriptor, Schema schema)
+            throws IntrospectionException {
         if (elementDescriptor.isHollow()) {
             // need to introspector for filled descriptor
             Class type = elementDescriptor.getSingularPropertyType();
@@ -63,70 +69,81 @@ public abstract class ComplexType {
         return elementDescriptor;
     }
 
-    protected void init(TranscriptionConfiguration configuration, ElementDescriptor elementDescriptor, Schema schema) throws IntrospectionException {
-        
-        AttributeDescriptor[] attributeDescriptors = elementDescriptor.getAttributeDescriptors();
-        for (int i=0,length=attributeDescriptors.length; i<length ; i++) {
+    protected void init(TranscriptionConfiguration configuration,
+            ElementDescriptor elementDescriptor, Schema schema)
+            throws IntrospectionException {
+
+        AttributeDescriptor[] attributeDescriptors = elementDescriptor
+                .getAttributeDescriptors();
+        for (int i = 0, length = attributeDescriptors.length; i < length; i++) {
             //TODO: need to think about computing schema types from descriptors
             // this will probably depend on the class mapped to
             String uri = attributeDescriptors[i].getURI();
-            if (! SchemaTranscriber.W3C_SCHEMA_INSTANCE_URI.equals(uri)) {
+            if (!SchemaTranscriber.W3C_SCHEMA_INSTANCE_URI.equals(uri)) {
                 attributes.add(new Attribute(attributeDescriptors[i]));
             }
         }
-        
+
         //TODO: add support for spacing elements
-        ElementDescriptor[] elementDescriptors = elementDescriptor.getElementDescriptors();
-        for (int i=0,length=elementDescriptors.length; i<length ; i++) {
+        ElementDescriptor[] elementDescriptors = elementDescriptor
+                .getElementDescriptors();
+        for (int i = 0, length = elementDescriptors.length; i < length; i++) {
             if (elementDescriptors[i].isHollow()) {
-                elements.add(new ElementReference(configuration, elementDescriptors[i], schema));
-            } else if (elementDescriptors[i].isSimple()){
-                elements.add(new SimpleLocalElement(configuration, elementDescriptors[i], schema));
+                elements.add(new ElementReference(configuration,
+                        elementDescriptors[i], schema));
+            } else if (elementDescriptors[i].isSimple()) {
+                elements.add(new SimpleLocalElement(configuration,
+                        elementDescriptors[i], schema));
             } else {
-                elements.add(new ComplexLocalElement(configuration, elementDescriptors[i], schema));
+                elements.add(new ComplexLocalElement(configuration,
+                        elementDescriptors[i], schema));
             }
-        } 
+        }
     }
 
     /**
-    	 * Gets the elements contained by this type
-    	 * @return 
-    	 */
+     * Gets the elements contained by this type
+     * 
+     * @return <code>List</code> of contained elements, not null
+     */
     public List getElements() {
-    		return elements;
+        return elements;
     }
 
     /**
-    	 * Adds an element to those contained by this type
-    	 * @param element
-    	 */
+     * Adds an element to those contained by this type
+     * 
+     * @param element
+     */
     public void addElement(ElementReference element) {
         elements.add(element);
     }
-    
-    /**
-          * Adds an element to those contained by this type
-          * @param element
-          */
-     public void addElement(LocalElement element) {
-         elements.add(element);
-     }
 
+    /**
+     * Adds an element to those contained by this type
+     * 
+     * @param element
+     */
+    public void addElement(LocalElement element) {
+        elements.add(element);
+    }
 
     /**
-    	 * Gets the attributes contained by this type.
-    	 * @return
-    	 */
+     * Gets the attributes contained by this type.
+     * 
+     * @return <code>List</code> of attributes
+     */
     public List getAttributes() {
         return attributes;
     }
 
     /**
-    	 * Adds an attribute to those contained by this type
-    	 * @param attribute
-    	 */
+     * Adds an attribute to those contained by this type
+     * 
+     * @param attribute
+     */
     public void addAttribute(Attribute attribute) {
-    		attributes.add(attribute);
+        attributes.add(attribute);
     }
 
-}
+}
\ No newline at end of file

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26