Update of 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/util
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13547/plugin-ejb/src/main/java/org/xdoclet/plugin/ejb/util

Added Files:
        DuplicatedJavaParameter.java DuplicatedJavaMethod.java 
        DuplicatedJavaClass.java QDoxFilterMetadataProvider.java 
        DuplicatedJavaField.java QDoxCachedMetadataProvider.java 
Log Message:
* Various refactorings
* Completed ValueObjectPlugin

--- NEW FILE: QDoxFilterMetadataProvider.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import java.util.Collection;

import org.generama.ConfigurableDocletTagFactory;
import org.generama.GeneramaException;
import org.generama.QDoxCapableMetadataProvider;

/**
 * @author Diogo Quintela
 */
public class QDoxFilterMetadataProvider implements QDoxCapableMetadataProvider {
    protected final QDoxCapableMetadataProvider wrapper;

    public QDoxFilterMetadataProvider(QDoxCapableMetadataProvider wrapper) {
        this.wrapper = wrapper;
    }

    public ConfigurableDocletTagFactory getDocletTagFactory() {
        return this.wrapper.getDocletTagFactory();
    }

    public Collection getMetadata() throws GeneramaException {
        return this.wrapper.getMetadata();
    }

    public String getOriginalFileName(Object metadata) {
        return this.wrapper.getOriginalFileName(metadata);
    }

    public String getOriginalPackageName(Object metadata) {
        return this.wrapper.getOriginalPackageName(metadata);
    }
}

--- NEW FILE: QDoxCachedMetadataProvider.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import java.util.Collection;

import org.generama.GeneramaException;
import org.generama.QDoxCapableMetadataProvider;

/**
 * @author Diogo Quintela
 */
public class QDoxCachedMetadataProvider extends QDoxFilterMetadataProvider {
    private Collection metadata = null;

    public QDoxCachedMetadataProvider(QDoxCapableMetadataProvider wrapper) {
        super(wrapper);
    }

    public Collection getMetadata() throws GeneramaException {
        if (metadata == null) {
            metadata = super.getMetadata();
        }
        return metadata;
    }
}

--- NEW FILE: DuplicatedJavaField.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import java.util.Arrays;

import com.thoughtworks.qdox.model.JavaField;

/**
 * @author Diogo Quintela
 */
public class DuplicatedJavaField extends JavaField {
    protected JavaField otherJavaField;
    public DuplicatedJavaField(JavaField otherJavaField) {
        super();
        this.otherJavaField = otherJavaField;
        // AbstractJavaEntity fields
        setName(otherJavaField.getName());
        setModifiers(otherJavaField.getModifiers());
        setComment(otherJavaField.getComment());
        setTags(Arrays.asList(otherJavaField.getTags()));
        setParent(otherJavaField.getParent());
        setLineNumber(otherJavaField.getLineNumber());
        // JavaField fields
        setType(otherJavaField.getType());
    }
}

--- NEW FILE: DuplicatedJavaMethod.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import java.util.Arrays;

import com.thoughtworks.qdox.model.JavaMethod;
import com.thoughtworks.qdox.model.JavaParameter;

/**
 * @author Diogo Quintela
 */
public class DuplicatedJavaMethod extends JavaMethod {
    protected JavaMethod otherJavaMethod;
    public DuplicatedJavaMethod(JavaMethod otherJavaMethod) {
        super();
        this.otherJavaMethod = otherJavaMethod;
        // AbstractJavaEntity fields
        setName(otherJavaMethod.getName());
        setModifiers(otherJavaMethod.getModifiers());
        setComment(otherJavaMethod.getComment());
        setTags(Arrays.asList(otherJavaMethod.getTags()));
        setParent(otherJavaMethod.getParent());
        setLineNumber(otherJavaMethod.getLineNumber());

        // JavaMethod fields
        setReturns(otherJavaMethod.getReturns());
        JavaParameter[] methodParams = (JavaParameter[]) 
Arrays.asList(otherJavaMethod.getParameters()).toArray(new JavaParameter[0]);

        for (int i = 0; i < methodParams.length; i++) {
            methodParams[i] = new DuplicatedJavaParameter(methodParams[i]);
        }

        setParameters(methodParams);
        setExceptions(otherJavaMethod.getExceptions());
        setConstructor(otherJavaMethod.isConstructor());
    }
}

--- NEW FILE: DuplicatedJavaClass.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import java.util.Arrays;

import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaField;
import com.thoughtworks.qdox.model.JavaMethod;

/**
 * @author Diogo Quintela
 */
public class DuplicatedJavaClass extends JavaClass {
    protected JavaClass otherJavaClass;

    public DuplicatedJavaClass(JavaClass otherJavaClass) {
        this.otherJavaClass = otherJavaClass;

        // AbstractJavaEntity fields
        setName(otherJavaClass.getName());
        setModifiers(otherJavaClass.getModifiers());
        setComment(otherJavaClass.getComment());
        setTags(Arrays.asList(otherJavaClass.getTags()));
        setParent(otherJavaClass.getParent());
        setLineNumber(otherJavaClass.getLineNumber());
        // JavaClass fields
        JavaMethod[] otherMethods = otherJavaClass.getMethods();

        for (int i = 0; i < otherMethods.length; i++) {
            addMethod(new DuplicatedJavaMethod(otherMethods[i]));
        }

        JavaField[] otherFields = otherJavaClass.getFields();

        for (int i = 0; i < otherFields.length; i++) {
            addField(new DuplicatedJavaField(otherFields[i]));
        }

        JavaClass[] nestedClasses = otherJavaClass.getNestedClasses();

        for (int i = 0; i < nestedClasses.length; i++) {
            addClass(new DuplicatedJavaClass(nestedClasses[i]));
        }

        setInterface(otherJavaClass.isInterface());
        setImplementz(otherJavaClass.getImplements());
        // TODO: Should we duplicate the parent ?
        setSuperClass(otherJavaClass.getSuperClass());
    }
}

--- NEW FILE: DuplicatedJavaParameter.java ---
/*
 * Copyright (c) 2005
 * XDoclet Team
 * All rights reserved.
 */
package org.xdoclet.plugin.ejb.util;

import com.thoughtworks.qdox.model.JavaParameter;

/**
 * @author Diogo Quintela
 */
public class DuplicatedJavaParameter extends JavaParameter {
    protected JavaParameter otherJavaParameter;
    public DuplicatedJavaParameter(JavaParameter otherJavaParameter) {
        super(otherJavaParameter.getType(), otherJavaParameter.getName(), 
otherJavaParameter.isVarArgs());
        this.otherJavaParameter = otherJavaParameter;
        // JavaParameter fields
        setParentMethod(otherJavaParameter.getParentMethod());
    }
}



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to