Package org.switchyard.common.type.reflect

Examples of org.switchyard.common.type.reflect.Access


                    if (((CoverageType.INCLUSIVE.equals(coverageType)
                            && readMethod.getAnnotation(Exclude.class) == null)
                            || (CoverageType.EXCLUSIVE.equals(coverageType)
                                    && readMethod.getAnnotation(Include.class) != null))
                                    && readMethod.getAnnotation(Deprecated.class) == null) {
                        Access access = null;
                        Method writeMethod = desc.getWriteMethod();
                        if (writeMethod == null) {
                            String readName = readMethod.getName();
                            if (readName.startsWith("get") || readName.startsWith("is")) {
                                String writeName = "set" + (readName.startsWith("get") ? readName.substring(3) : readName.substring(2));
                                Class<?> declaringClass = readMethod.getDeclaringClass();
                                try {
                                    writeMethod = declaringClass.getDeclaredMethod(writeName, desc.getPropertyType());
                                } catch (NoSuchMethodException nsme1) {
                                    try {
                                        writeMethod = declaringClass.getMethod(writeName, desc.getPropertyType());
                                    } catch (NoSuchMethodException nsme2) {
                                        writeMethod = null;
                                    }
                                }
                                if (writeMethod != null) {
                                    Class<?> returnClass = writeMethod.getReturnType();
                                    if (returnClass == null || returnClass.isAssignableFrom(declaringClass)) {
                                        access = new MethodAccess(readMethod, writeMethod);
                                    }
                                }
                            }
                        }
                        if (access == null) {
                            access = new BeanAccess(desc);
                        }
                        if (access.isReadable() && !getIgnoredAccessNames().contains(access.getName())) {
                            accessList.add(access);
                        }
                    }
                }
                break;
            case FIELD:
                for (Field field : clazz.getDeclaredFields()) {
                    if (((CoverageType.INCLUSIVE.equals(coverageType)
                            && field.getAnnotation(Exclude.class) == null)
                            || (CoverageType.EXCLUSIVE.equals(coverageType)
                                    && field.getAnnotation(Include.class) != null))
                                    && field.getAnnotation(Deprecated.class) == null
                                    && !Modifier.isTransient(field.getModifiers())) {
                        Access access = new FieldAccess(field);
                        if (access.isReadable()) {
                            accessList.add(access);
                        }
                    }
                }
                break;
View Full Code Here

TOP

Related Classes of org.switchyard.common.type.reflect.Access

Copyright © 2018 www.massapicom. 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.