Examples of BeanWrapperImpl


Examples of org.springframework.beans.BeanWrapperImpl

    public boolean isApplicable(Object obj) {
        PropertyDescriptor propertyDescriptor = BeanUtils.getPropertyDescriptor(obj.getClass(), propertyName);
        if (propertyDescriptor == null) {
            return false;
        }
        Object value = new BeanWrapperImpl(obj).getPropertyValue(propertyName);
        return rule.isApplicable(value);
    }
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

     * If you want to provide custom behaviour, set an appropriate property editor (see {@link #setPropertyEditor(PropertyEditor propertyEditor)}).
     * @return The binding value, or null if no target object has been set.
     */
    public String getStatusValue() {
        if (this.target != null) {
            BeanWrapper wrapper = new BeanWrapperImpl(this.target);
            Object value = wrapper.getPropertyValue(this.expression);
            if (this.propertyEditor == null) {
                return value.toString();
            }
            else {
                this.propertyEditor.setValue(value);
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

     * @param contentProperty The JavaBean property which will be retrieved from the object for setting the content of the option: there must be
     * a standard JavaBean getter for this property.
     */
    public Option(Object optionObject, String valueProperty, String contentProperty) {
        if (optionObject != null) {
            BeanWrapper wrapper = new BeanWrapperImpl(optionObject);
           
            Object tmp = wrapper.getPropertyValue(valueProperty);
            if (tmp != null) {
                this.addAttribute("value", tmp.toString());
            }
            else {
                this.addAttribute("value", "");
            }
           
            tmp = wrapper.getPropertyValue(contentProperty);
            if (tmp != null) {
                this.internalAddContent(new SimpleText(tmp.toString()));
            }
            else {
                this.internalAddContent(new SimpleText(""));
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

     * @param textRenderingCallback A callback to implement for rendering the object property value as a specific component: if <code>null</code>,
     * the object property value will be rendered as simple text.
     */
    public AbstractTableData(Object dataObject, String property, TextRenderingCallback textRenderingCallback) {
        if (dataObject != null) {
            BeanWrapper wrapper = new BeanWrapperImpl(dataObject);
            Object tmp = wrapper.getPropertyValue(property);
            if (tmp != null) {
                String value = tmp.toString();
                if (textRenderingCallback != null) {
                  this.internalAddContent(textRenderingCallback.getRenderingComponent(value));
                }
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

      touch(target, properties);
    }
  }
 
  private static void touch(Object target, Object[] properties) {
    BeanWrapper beanWrapper = new BeanWrapperImpl(target);
    for (int x = 0; properties != null && x < properties.length; x++) {
      Object property = properties[x];
      if (property instanceof String) {
        Object result = beanWrapper.getPropertyValue((String)property);
        if (result instanceof Collection) {
          ((Collection)result).size();
        }
      } else if (property instanceof Map) {
        for (Iterator iter = ((Map)property).keySet().iterator(); iter.hasNext();) {
          Object key = iter.next();
          Object tmpProperties = ((Map)property).get(key);
          if (!(key instanceof String)) {
            throw new IllegalArgumentException("Maps configured in the [properties] property should have a string key!");
          }
          if (!(tmpProperties instanceof Collection)) {
            throw new IllegalArgumentException("Maps configured in the [properties] property should have a list value!");
          }
          Object result = beanWrapper.getPropertyValue((String)key);
          if (result instanceof Collection) {
            touch(((Collection)result).toArray(), ((Collection)tmpProperties).toArray());
          } else if (result instanceof Object[]) {
            touch((Object[])result, ((Collection)tmpProperties).toArray());
          } else {
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

     * {@link #checkBean(org.springframework.beans.BeanWrapper)};
     *
     * @throws IllegalArgumentException when the passed in object is <code>null</code>.
     */
    public final boolean doCheck(Object object) {
        return checkBean(new BeanWrapperImpl(object));
    }
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

    }

    Properties properties = SemicolonSeparatedPropertiesParser
        .parseProperties(text);

    BeanWrapper beanWrapper = new BeanWrapperImpl(cacheModelClass);

    if (properties != null) {
      for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
        String propertyName = (String) i.next();
        String textProperty = properties.getProperty(propertyName);

        Object propertyValue = null;

        PropertyEditor propertyEditor = getPropertyEditor(propertyName);
        if (propertyEditor != null) {
          propertyEditor.setAsText(textProperty);
          propertyValue = propertyEditor.getValue();
        } else {
          propertyValue = textProperty;
        }
        beanWrapper.setPropertyValue(propertyName, propertyValue);
      }
    }

    setValue(beanWrapper.getWrappedInstance());
  }
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

        Object tmpTarget;

        if (target instanceof BeanWrapper || target instanceof Map) {
            tmpTarget = target;
        } else {
            tmpTarget = new BeanWrapperImpl(target);
        }
        if (!getPredicate().evaluate(tmpTarget)) {

            /*
            * Take into account error key and error args for localization
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

            }
        }
        // Convert from object to string:
        else {
            try {
                BeanWrapperImpl wrapper = new BeanWrapperImpl(element);
                result = wrapper.getPropertyValue(this.propertyName).toString();
            } catch(Exception ex) {
                throw new ReflectiveCollectionEditorException("An error occurred while getting: " + this.propertyName, ex);
            }
        }
       
View Full Code Here

Examples of org.springframework.beans.BeanWrapperImpl

            this.propertyPath = propertyPath;
        }

        public Object evaluate(Object argument) {
            try {
                return new BeanWrapperImpl(argument).getPropertyValue(propertyPath);
            } catch (Throwable t) {
                throw new FelEvaluationException("Could not evaluate path '" + propertyPath +
                    "' on bean '" + String.valueOf(argument) + "'", t);
            }
        }
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.