Package org.springframework.beans

Examples of org.springframework.beans.BeanWrapperImpl


  private String getObjectParameterIdFromMap(Object object, Map map) {

        Object idValue = null;

        if (!this.idPropertyName.equals("id")) {
            BeanWrapper wrapper = new BeanWrapperImpl(object);
            idValue =  wrapper.getPropertyValue(this.idPropertyName);

            if (keyType==String.class) {
                return idValue.toString();
            } else {
                return idValue.toString();
View Full Code Here


    return bean;
  }

  public void applyConfig(TextReport<?> bean, String[] parts) {
    BeanWrapperImpl bw = new BeanWrapperImpl(bean);

    new KoljaPropertyEditorRegistrar().registerCustomEditors(bw);

    for (String string : parts) {
      String[] split = string.split("=");

      log.info("setting " + split[0] + " to value " + split[1]);

      bw.setPropertyValue(split[0], split[1]);
    }
  }
View Full Code Here

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
            int row, int column) {
        if (value != null) {
            if (beanWrapper == null) {
                beanWrapper = new BeanWrapperImpl(value);
            } else {
                beanWrapper.setWrappedInstance(value);
            }
            try {
                BeanInfo info = Introspector.getBeanInfo(value.getClass());
View Full Code Here

                    DescribedElement element = (DescribedElement)bean;
                    setText(element.getDisplayName());
                    setToolTipText(element.getCaption());
                }
                else {
                    BeanWrapper wrapper = new BeanWrapperImpl(bean);
                    try {
                        Object text = propertyName != null ? wrapper.getPropertyValue(propertyName) : wrapper
                                .getPropertyValue("name");
                        setText(String.valueOf(text));
                    }
                    catch (FatalBeanException e) {
View Full Code Here

     * @param formModel
     * @param objectToMap
     */
    public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap)
    {
        BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap);
        for (String fieldName : (Set<String>) formModel.getFieldNames())
        {
            try
            {
                formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName));
            }
            catch (BeansException be)
            {
                // silently ignoring, just mapping values, so if there's one missing, don't bother
            }
View Full Code Here

    protected String getTextValue(Object value) {
        if (value == null) {
            return "";
        }
        if (beanWrapper == null) {
            beanWrapper = new BeanWrapperImpl(value);
        } else {
            beanWrapper.setWrappedInstance(value);
        }
        return String.valueOf(beanWrapper.getPropertyValue(propertyName));
    }
View Full Code Here

         * the default implementation of getColumnClass will return Object.class, which is not very usable. If you don't
         * provide a prototype, you should probably override {@link #getColumnClass(int)}.
         */
        public void setPrototypeValue(Object prototype) {
            this.prototype = prototype;
            beanWrapper = new BeanWrapperImpl(this.prototype);
        }
View Full Code Here

    return binding;
  }

  protected void applyContext(NachoCalendarDateFieldBinding binding, Map context) {
    super.applyContext(binding, context);
        BeanWrapper wrapper = new BeanWrapperImpl(binding.getControl());
    Object dateFormat = context.get(DATE_FORMAT);
    // remove DATE_FORMAT temporarily since it is handled in the super class
    context.remove(DATE_FORMAT);
    wrapper.setPropertyValues(context);
    if (dateFormat != null) {
      // restore the original context
      context.put(DATE_FORMAT, dateFormat);
        }
  }
View Full Code Here

        Assert.isTrue((o instanceof View), "View class '" + viewClass
                + "' was instantiated, but instance is not a View!");
        View view = (View) o;
        view.setDescriptor(this);
        if (viewProperties != null) {
            BeanWrapper wrapper = new BeanWrapperImpl(view);
            wrapper.setPropertyValues(viewProperties);
        }

        if (view instanceof InitializingBean) {
            try {
                ((InitializingBean) view).afterPropertiesSet();
View Full Code Here

    ApplicationEventMulticaster multicaster = getApplicationEventMulticaster();
    if(editor instanceof ApplicationListener &&  multicaster != null){
      multicaster.addApplicationListener((ApplicationListener)editor);
    }
    if(editorProperties != null){
      BeanWrapper wrapper = new BeanWrapperImpl(editor);
      wrapper.setPropertyValues(editorProperties);
    }
    if(editor instanceof InitializingBean){
       try {
         ((InitializingBean)editor).afterPropertiesSet();
           }
View Full Code Here

TOP

Related Classes of org.springframework.beans.BeanWrapperImpl

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.