Package org.apache.tuscany.core.builder

Examples of org.apache.tuscany.core.builder.NoAccessorException


                            break;
                        }
                    }
                }
                if (method == null) {
                    throw new NoAccessorException(propertyName);
                }
            }
        }
        Injector injector = null;
        if (value instanceof DataObject) {
View Full Code Here


            if (field == null) {
                // No fields found. Again, since this is a multiplicity, we cannot match on business interface type, so
                // scan through the fields, matching on name and List or Array
                method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods);
                if (method == null) {
                    throw new NoAccessorException(refName);
                }
            }
            Injector injector;
            // for multiplicities, we need to inject the reference proxy or proxies using an object factory
            // which first delegates to create the proxies and then returns them in the appropriate List or array type
            if (field != null) {
                if (field.getType().isArray()) {
                    injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
                } else {
                    injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories));
                }
            } else {
                if (method.getParameterTypes()[0].isArray()) {
                    injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
                } else {
                    injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories));
                }
            }
            return injector;
        } else {
            field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields);
            if (field == null) {
                // hack for TUSCANY-300
                for (Field current : fields) {
                    Reference annot = current.getAnnotation(Reference.class);
                    if (annot != null) {
                        if (refName.equals(annot.name())) {
                            field = current;
                            break;
                        }
                    }
                }
                if (field == null) {
                    method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods);
                    if(method == null){
                        // Fix for Tuscany-325
                        method = JavaIntrospectionHelper.findClosestMatchingMethod("set"+refName.substring(0,1).toUpperCase()+ refName.substring(1), new Class[]{refClass}, methods);
                    }
                    if (method == null) {
                        // hack for TUSCANY-300
                        for (Method current : methods) {
                            Reference annot = current.getAnnotation(Reference.class);
                            if (annot != null) {
                                if (refName.equals(annot.name())) {
                                    method = current;
                                    break;
                                }
                            }
                        }
                        if (method == null) {
                            throw new NoAccessorException(refName);
                        }
                    }
                }
            }
            Injector injector;
View Full Code Here

        Method method = null;
        Field field = JavaIntrospectionHelper.findClosestMatchingField(propName, type, fields);
        if (field == null) {
            method = JavaIntrospectionHelper.findClosestMatchingMethod(propName, new Class[]{type}, methods);
            if (method == null) {
                throw new NoAccessorException(propName);
            }
        }
        Injector injector;
        // FIXME support types other than String
        if (JavaIntrospectionHelper.isImmutable(type)) {
View Full Code Here

            if (field == null) {
                // No fields found. Again, since this is a multiplicity, we cannot match on interface type, so
                // scan through the fields, matching on name and List or Array
                method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods);
                if (method == null) {
                    throw new NoAccessorException(refName);
                }
            }
            Injector injector;
            if (field != null) {
                // for multiplicities, we need to inject the target or targets using an object factory
                // which first delegates to create the proxies and then returns them in the appropriate List or array
                // type
                if (field.getType().isArray()) {
                    injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
                } else {
                    injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories));
                }
            } else {
                if (method.getParameterTypes()[0].isArray()) {
                    injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories));
                } else {
                    injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories));
                }
            }
            return injector;
        } else {
            field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields);
            if (field == null) {
                method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods);
                if (method == null) {
                    throw new NoAccessorException(refName);
                }
            }
            Injector injector;
            if (field != null) {
                injector = new FieldInjector(field, objectFactories.get(0));
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.builder.NoAccessorException

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.