FileDocCategorySizeDatePackage
BaseBeanUtils.javaAPI DocGlassfish v2 API3883Fri May 04 22:34:38 BST 2007com.sun.enterprise.tools.common.dd

BaseBeanUtils

public class BaseBeanUtils extends Object
Utilities that apply to all the various generated schema2beans objects in the system
author
vkraemer

Fields Summary
Constructors Summary
protected BaseBeanUtils()
Creates a new instance of BaseBeanUtils

    
Methods Summary
protected static java.util.ListfindCompatibleBeansWithValue(org.netbeans.modules.schema2beans.BaseBean root, java.lang.String propName, java.lang.String propVal, java.lang.Class type)
A utility for finding beans in a graph of BaseBean objects. Search the bean graph, starting at a given root, for beans where the named property has the given value. The returned list is filtered by assignment compatibility.

return
The assignment compatible BaseBeans that were found.
param
root The root of a search
param
propName The name of the element
param
propVal the value of the element
param
type The expected type of the value to be returned.
throws
IllegalArgumentException If the bean is not part of a complete bean graph.

        java.util.List retVal = null; 
        GraphManager gm = root.graphManager();
        if (null == gm) 
            throw new IllegalArgumentException("Disconnected beans not supported");
        String[] props = root.findPropertyValue(propName, propVal);
        int len = 0;
        if (null != props)
            len = props.length;
        if (len > 0)
            retVal = new java.util.ArrayList(); 
        for (int i = 0; i < len; i++) {
            // get the bean that is the property's parent.
            BaseBean candidate = gm.getPropertyParent(props[i]); 
            if (type.isInstance(candidate))
                retVal.add(candidate);
        }
        return retVal;