Java Code Examples for com.sun.beans.introspect.ClassInfo

Following code examples demonstrate how to use com.sun.beans.introspect.ClassInfofrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.beans.introspect.ClassInfoand various code implementation of this class.

    }

    private IndexedPropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1,
                                                       IndexedPropertyDescriptor ipd2) {
        if (ipd1.getClass0().isAssignableFrom(ipd2.getClass0())) {
            return new IndexedPropertyDescriptor(ipd1, ipd2);
        } else {
            return new IndexedPropertyDescriptor(ipd2, ipd1);
        }
    } 


    private void addEvent(EventSetDescriptor esd) {
        String key = esd.getName();
        if (esd.getName().equals("propertyChange")) {
            propertyChangeSource = true;
        }
        EventSetDescriptor old = events.get(key);
        if (old == null) {
            events.put(key, esd);
            return;
        }
        EventSetDescriptor composite = new EventSetDescriptor(old, esd);
        events.put(key, composite);
    } 

    
    private static Method internalFindMethod(Class<?> start, String methodName,
                                                 int argCount, Class<?> args[]) {
        for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
            for (Method method : ClassInfo.get(cl).getMethods()) {
                if (method.getName().equals(methodName)) {
                    Type[] params = method.getGenericParameterTypes();
                    if (params.length == argCount) {
                        if (args != null) {
                            boolean different = false;
                            if (argCount > 0) {
                                for (int j = 0; j < argCount; j++) {
                                    if (TypeResolver.erase(TypeResolver.resolveInClass(start, params[j])) != args[j]) {
                                        different = true;
                                        continue;
                                    }
                                }
                                if (different) {
                                    continue;
                                }
                            }
                        }
                        return method;
                    }
                }
            }
        }
        Class<?>[] ifcs = start.getInterfaces();
        for (int i = 0 ; i < ifcs.length; i++) {
            Method method = internalFindMethod(ifcs[i], methodName, argCount, null);
            if (method != null) {
                return method;
            }
        }
        return null;
    } 

Advertisement
Related Classes
Advertisement