Package org.richfaces.resource

Examples of org.richfaces.resource.ResourceParameter


    }

    private void locateManagedPropertyFields(Class<?> clazz, Map<String, ResourceParameter> fieldsMap) {
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields) {
            ResourceParameter dependency = field.getAnnotation(ResourceParameter.class);

            if (dependency != null) {
                String propertyName = field.getName();

                if (!fieldsMap.containsKey(propertyName)) {
View Full Code Here


                PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
                if (descriptors != null) {
                    for (PropertyDescriptor descriptor : descriptors) {
                        String propertyName = descriptor.getName();

                        ResourceParameter dependency = injectableFields.get(propertyName);

                        if (dependency == null) {
                            dependency = getAnnotation(descriptor, ResourceParameter.class);
                        }
View Full Code Here

                expectedType = Object.class;
            } else {
                expectedType = propertyType;
            }

            ResourceParameter resourceParameter = getDependency();

            String expression = resourceParameter.expression();
            String name = resourceParameter.name();

            if (expression.length() != 0 && name.length() != 0) {
                throw new IllegalStateException(MessageFormat.format(
                    "'name' and 'expression' should not be specified simultaneously: {0}", resourceParameter));
            }

            Object propertyValue = null;
            if (expression.length() != 0) {
                propertyValue = getExpressionValue(context, expression, expectedType);
            } else {
                if (name.length() == 0) {
                    name = getPropertyDescriptor().getName();
                }

                Map<String, Object> parameters = (Map<String, Object>) context.getAttributes().get(
                    ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);

                propertyValue = parameters.get(name);
            }

            if (propertyValue == null || "".equals(propertyValue)) {
                String defaultValue = resourceParameter.defaultValue();
                if (defaultValue != null && defaultValue.length() != 0) {
                    propertyValue = getExpressionValue(context, defaultValue, expectedType);
                }
            }
View Full Code Here

TOP

Related Classes of org.richfaces.resource.ResourceParameter

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.