Package org.springframework.core.convert

Examples of org.springframework.core.convert.Property


        method = findGetterForProperty(name, type, target);
        if (method != null) {
          // TODO remove the duplication here between canRead and read
          // Treat it like a property...
          // The readerCache will only contain gettable properties (let's not worry about setters for now).
          Property property = new Property(type, method, null);
          TypeDescriptor typeDescriptor = new TypeDescriptor(property);
          invoker = new InvokerPair(method, typeDescriptor);
          lastReadInvokerPair = invoker;
          this.readerCache.put(cacheKey, invoker);
        }
View Full Code Here


      return true;
    }
    Method method = findSetterForProperty(name, type, target);
    if (method != null) {
      // Treat it like a property
      Property property = new Property(type, null, method);
      TypeDescriptor typeDescriptor = new TypeDescriptor(property);
      this.writerCache.put(cacheKey, method);
      this.typeDescriptorCache.put(cacheKey, typeDescriptor);
      return true;
    }
View Full Code Here

    assertThat(typeDescriptor.getElementTypeDescriptor(), is(TypeDescriptor.valueOf(Integer.class)));
  }

  @Test
  public void shouldGetPropertyForNull() throws Exception {
    Property property = ELUtils.getProperty(null, this.context);
    assertThat(property, is(nullValue()));
  }
View Full Code Here

  }

  @Test
  public void shouldGetProperty() throws Exception {
    ValueExpression valueExpression = newValueExpression("integer", Object.class);
    Property property = ELUtils.getProperty(valueExpression, this.context);
    assertThat(property.getName(), is(equalTo("integer")));
    assertThat(property.getObjectType(), is(equalTo((Class) Bean.class)));
  }
View Full Code Here

  }

  @Test
  public void shouldGetNestedProperty() throws Exception {
    ValueExpression valueExpression = newValueExpression("nested.collectionOfInteger", Object.class);
    Property property = ELUtils.getProperty(valueExpression, this.context);
    assertThat(property.getName(), is(equalTo("collectionOfInteger")));
    assertThat(property.getObjectType(), is(equalTo((Class) NestedBean.class)));
  }
View Full Code Here

  @Test
  public void shouldGetNullPropertyIfMissing() throws Exception {
    ValueExpression valueExpression = new ExpressionBuilder("#{bean}", this.context)
        .createValueExpression(Object.class);
    Property property = ELUtils.getProperty(valueExpression, this.context);
    assertThat(property, is(nullValue()));
  }
View Full Code Here

    TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(type);
    if (typeDescriptor.isCollection() || typeDescriptor.isMap()) {
      // We may be able to obtain the generic type info by resolving the property directly
      if (trackedContext.hasValues()) {
        try {
          Property property = getProperty(trackedContext);
          if (property != null) {
            typeDescriptor = new TypeDescriptor(property);
          }
        } catch (Exception e) {
        }
View Full Code Here

      return null;
    }
    Class<? extends Object> baseClass = trackedContext.getBase().getClass();
    PropertyDescriptor propertyDescriptor = BeanUtils.getPropertyDescriptor(baseClass, trackedContext.getProperty()
        .toString());
    Property property = new Property(baseClass, propertyDescriptor.getReadMethod(),
        propertyDescriptor.getWriteMethod());
    return property;
  }
View Full Code Here

    }

    public boolean isRequired(UIComponent component) {
      ELContext elContext = DefaultComponentInfo.this.context.getELContext();
      ValueExpression expression = component.getValueExpression("value");
      Property property = ELUtils.getProperty(expression, elContext);
      if (property == null) {
        return false;
      }
      BeanDescriptor beanConstraints = this.validator.getConstraintsForClass(property.getObjectType());
      PropertyDescriptor propertyConstraints = beanConstraints.getConstraintsForProperty(property.getName());
      return isRequired(propertyConstraints.getConstraintDescriptors());
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.convert.Property

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.