FileDocCategorySizeDatePackage
ComponentDefinition.javaAPI DocGlassfish v2 API7320Fri May 04 22:30:22 BST 2007com.sun.enterprise.deployment.annotation.impl

ComponentDefinition

public class ComponentDefinition extends Object implements com.sun.enterprise.deployment.annotation.ComponentInfo
This class represents the view of a class from annotation.
author
Shing Wai Chan

Fields Summary
private final Class
clazz
private final List
constructors
private final List
classes
private final List
fields
private final Map
methodMap
Constructors Summary
public ComponentDefinition(Class clazz)


       
        this.clazz = clazz;
        constructClassList();
        initializeConstructors();
        initializeFields();
        initializeMethods();
    
Methods Summary
private voidconstructClassList()

        // check whether this class is in the skip list
        if (!Factory.isSkipAnnotationProcessing(clazz.getName())) {
            classes.add(clazz);
        }
        Class parent = clazz;
        while ((parent = parent.getSuperclass()) != null) {
            if (parent.getPackage() == null ||
                    !parent.getPackage().getName().startsWith("java.lang")) {
                // always check whether this class is in the class list
                // for skipping annotation processing
                if (!Factory.isSkipAnnotationProcessing(parent.getName())) {
                    classes.add(0, parent);
                }
            } 
        }
    
public java.lang.reflect.Constructor[]getConstructors()

        return constructors.toArray(new Constructor[constructors.size()]);
    
public java.lang.reflect.Field[]getFields()

        return fields.toArray(new Field[fields.size()]);
    
public java.lang.reflect.Method[]getMethods()

        return methodMap.values().toArray(new Method[methodMap.size()]);
    
private voidinitializeConstructors()
In P.148 of "The Java Langugage Specification 2/e", Constructors, static initializers, and instance initializers are not members and therefore not inherited.

        for (Class cl : classes) {
            for (Constructor constr : cl.getConstructors()) {
                constructors.add(constr);           
            }
        }
    
private voidinitializeFields()

        for (Class cl : classes) {
            for (Field f : cl.getDeclaredFields()) {
                fields.add(f);           
            }
        }
    
private voidinitializeMethods()

        for (Class cl: classes) {
            for (Method method : cl.getDeclaredMethods()) {
                methodMap.put(new MethodKey(method), method);
            }
        }