Package br.net.woodstock.rockframework.core.reflection

Examples of br.net.woodstock.rockframework.core.reflection.PropertyDescriptor


      if ((obj != null) && (obj instanceof Entity)) {
        Entity<?> entity = (Entity<?>) obj;

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(entity.getClass()).getBeanDescriptor();

        PropertyDescriptor propertyDescriptor = beanDescriptor.getProperty(EntityInterceptor.ENTITY_ID);
        Class<?> clazz = propertyDescriptor.getType();

        try {
          Constructor<?> contructor = clazz.getConstructor(new Class[] { String.class });
          Object fieldValue = contructor.newInstance(new Object[] { value });

          RockFrameworkLogger.getLogger().info("Setting entity ID " + entityName + "[" + fieldValue + "]");
          propertyDescriptor.setValue(entity, fieldValue);
        } catch (NoSuchMethodException e) {
          RockFrameworkLogger.getLogger().warn("Could not find constructor " + entity.getClass().getCanonicalName() + "(String). Parameter not setted");
        } catch (Exception e) {
          RockFrameworkLogger.getLogger().warn("Error in constructor " + entity.getClass().getCanonicalName() + "(String)");
          RockFrameworkLogger.getLogger().warn(e.getMessage(), e);
View Full Code Here


    for (Method method : c.getMethods()) {
      if (BeanDescriptorHelper.isValidGetterOrSetter(method)) {
        String propertyName = BeanDescriptorHelper.getPropertyName(method);
        if (!this.hasProperty(propertyName)) {
          Class<?> propertyType = BeanDescriptorHelper.getPropertyType(method);
          PropertyDescriptor property = new MethodPropertyDescriptor(this, propertyName, propertyType);
          if ((property.isReadable()) || (property.isWriteable())) {
            this.getProperties().add(property);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.core.reflection.PropertyDescriptor

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.