Package org.xdoclet.plugin.ejb

Source Code of org.xdoclet.plugin.ejb.EjbBusinessUtils

/*
* Copyright (c) 2005
* XDoclet Team
* All rights reserved.
*/
package org.xdoclet.plugin.ejb;

import java.util.Arrays;
import java.util.Collection;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;

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

/**
* This class holds common functionality used by all EJB plugin.
* These methods will mostly be called by templates (including
* vendor specific templates). Reusable code should be placed here.
*
* @author Diogo Quintela
* @version $Revision: 638 $
*/
public class EjbBusinessUtils {
    protected EjbUtils ejbUtils;

    public EjbBusinessUtils(EjbUtils ejbUtils) {
        this.ejbUtils = ejbUtils;
    }

    public Collection getInterfaceMethods(final JavaClass clazz, final int viewType) {
        return
                CollectionUtils.select(Arrays.asList(clazz.getMethods(true)),
                        new Predicate() {
                            public boolean evaluate(Object object) {
                                JavaMethod method = (JavaMethod) object;
                                boolean retVal = EjbUtils.hasFlag(ejbUtils.getMethodType(method),
                                        EjbUtils.IFACE_METHOD_COMPONENT);
                                retVal = retVal && EjbUtils.hasFlag(ejbUtils.getViewType(method, clazz), viewType);
                                return retVal;
                            }
                        });

    }
}
TOP

Related Classes of org.xdoclet.plugin.ejb.EjbBusinessUtils

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.