Examples of Injectable


Examples of org.apache.wink.common.internal.registry.Injectable

        return collector.getMetadata();
    }

    @Override
    protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
        Injectable injectable =
            InjectableFactory.getInstance().create(fieldType,
                                                   field.getAnnotations(),
                                                   (Member)field,
                                                   getMetadata().isEncoded(),
                                                   null);
        if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
            // EntityParam should be ignored for fields (see JSR-311 3.2)
            return null;
        }
        return injectable;
    }
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        return collector.getMetadata();
    }

    @Override
    protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
        Injectable injectable =
            InjectableFactory.getInstance().create(fieldType,
                                                   field.getAnnotations(),
                                                   (Member)field,
                                                   getMetadata().isEncoded(),
                                                   null);
        if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
            // EntityParam should be ignored for fields (see JSR-311 3.2)
            return null;
        }
        return injectable;
    }
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

    private void parseMethodParameters(Method method, MethodMetadata methodMetadata) {
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        Type[] paramTypes = method.getGenericParameterTypes();
        boolean entityParamExists = false;
        for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
            Injectable fp =
                InjectableFactory.getInstance().create(paramTypes[pos],
                                                       parameterAnnotations[pos],
                                                       method,
                                                       getMetadata().isEncoded() || methodMetadata
                                                           .isEncoded(),
                                                       methodMetadata.getDefaultValue());
            if (fp.getParamType() == Injectable.ParamType.ENTITY) {
                if (entityParamExists) {
                    // we are allowed to have only one entity parameter
                    String methodName =
                        method.getDeclaringClass().getName() + "." + method.getName();
                    throw new IllegalStateException("Resource method " + methodName
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

    }

    @Override
    protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
        logger.trace("parseAccessibleObject({}, {})", field, fieldType);
        Injectable injectable =
            InjectableFactory.getInstance().create(fieldType,
                                                   field.getAnnotations(),
                                                   (Member)field,
                                                   getMetadata().isEncoded(),
                                                   null);
        logger.trace("Injectable is {}", injectable);
        if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
            // EntityParam should be ignored for fields (see JSR-311 3.2)
            logger.trace("parseAccessibleObject() returning null");
            return null;
        }
        logger.trace("parseAccessibleObject() returning {}", injectable);
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        private void createFormalParameters() {
            formalParameters = new LinkedList<Injectable>();
            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
            Type[] paramTypes = method.getGenericParameterTypes();
            for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
                Injectable fp =
                    InjectableFactory.getInstance().create(paramTypes[pos],
                                                           parameterAnnotations[pos],
                                                           method,
                                                           false,
                                                           null);
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        return md;
    }

    @Override
    protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
        Injectable injectable =
            InjectableFactory.getInstance().create(fieldType,
                                                   field.getAnnotations(),
                                                   (Member)field,
                                                   getMetadata().isEncoded(),
                                                   null);
        if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
            // EntityParam should be ignored for fields (see JSR-311 3.2)
            return null;
        }
        return injectable;
    }
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        logger.trace("parseMethodParameters({}, {}), entry", method, methodMetadata);
        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
        Type[] paramTypes = getParamTypesFilterByXmlElementAnnotation(method);
        boolean entityParamExists = false;
        for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
            Injectable fp =
                InjectableFactory.getInstance().create(paramTypes[pos],
                                                       parameterAnnotations[pos],
                                                       method,
                                                       getMetadata().isEncoded() || methodMetadata
                                                           .isEncoded(),
                                                       methodMetadata.getDefaultValue());
            if (fp.getParamType() == Injectable.ParamType.ENTITY) {
                if (entityParamExists) {
                    // we are allowed to have only one entity parameter
                    String methodName =
                        method.getDeclaringClass().getName() + "." + method.getName(); //$NON-NLS-1$
                    throw new IllegalStateException(Messages
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        List<Injectable> currentParameters =
            new ArrayList<Injectable>(metadata.getFormalParameters());
        metadata.getFormalParameters().clear();
        int i = 0;
        for (Injectable injectable : currentParameters) {
            Injectable fp =
                InjectableFactory.getInstance().create(parameterTypes[i],
                                                       injectable.getAnnotations(),
                                                       method,
                                                       getMetadata().isEncoded() || metadata
                                                           .isEncoded(),
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

        // add fields
        while (resourceClass != Object.class && resourceClass != null) {
            for (Field field : resourceClass.getDeclaredFields()) {
                Type fieldType = field.getGenericType();
                Injectable injectable = parseAccessibleObject(field, fieldType);
                logger.trace("Field is {} and injectable is {}", fieldType, injectable);

                if (injectable != null) {
                    injectableFields.add(injectable);
                }
            }
            resourceClass = resourceClass.getSuperclass();
        }
        logger.trace("Injectable fields: {}", injectableFields);

        // add properties
        PropertyDescriptor[] propertyDescriptors = metadata.getBeanInfo().getPropertyDescriptors();
        if(logger.isTraceEnabled()) {
            logger.trace("Property descriptors are: {}", Arrays.asList(propertyDescriptors));
        }
        if (propertyDescriptors != null) {
            l: for (PropertyDescriptor pd : propertyDescriptors) {
                Method writeMethod = pd.getWriteMethod();
                if (writeMethod == null) {
                    // the property cannot be written, ignore it.
                    continue l;
                }
                if(logger.isTraceEnabled()) {
                    logger.trace("Method under inspection: {}", writeMethod.getName());
                }
                Type genericReturnType = writeMethod.getParameterTypes()[0];
                Injectable injectable = parseAccessibleObject(writeMethod, genericReturnType);
                if (injectable != null) {
                    injectableFields.add(injectable);
                }
                if(logger.isTraceEnabled()) {
                    logger.trace("Injectable under inspection: {}", injectable);
View Full Code Here

Examples of org.apache.wink.common.internal.registry.Injectable

            Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
            Type[] paramTypes = constructor.getGenericParameterTypes();
            // boolean isValidConstructor = true;
            // gather all formal parameters as list of injectable data
            for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
                Injectable fp =
                    InjectableFactory.getInstance()
                        .create(paramTypes[pos],
                                parameterAnnotations[pos],
                                constructor,
                                getMetadata().isEncoded() || constructorMetadata.isEncoded(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.