/*
* 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;
}
});
}
}