Package org.springframework.beans

Examples of org.springframework.beans.NotWritablePropertyException


    } catch (NotWritablePropertyException e) {

      Field field = findField(getWrappedClass(), propertyName);

      if (field == null) {
        throw new NotWritablePropertyException(getWrappedClass(), propertyName,
            "Could not find field for property during fallback access!");
      }

      makeAccessible(field);
      setField(field, getWrappedInstance(), value);
View Full Code Here


      fail("Should throw exception on invalid property");
    }
    catch (BeanCreationException ex) {
      ex.printStackTrace();
      assertTrue(ex.getCause() instanceof NotWritablePropertyException);
      NotWritablePropertyException cause = (NotWritablePropertyException) ex.getCause();
      // expected
      assertEquals(1, cause.getPossibleMatches().length);
      assertEquals("age", cause.getPossibleMatches()[0]);
    }
  }
View Full Code Here

    Object parentValue;
    try {
      parentValue = getPropertyValue(parentPropertyName);
    }
    catch (NotReadablePropertyException e) {
      throw new NotWritablePropertyException(getTargetClass(), propertyName, "parent property is not readable", e);
    }
    if (parentValue == null) {
      if (isWritableProperty(parentPropertyName)) {
        throw new NullValueInNestedPathException(getTargetClass(), propertyName);
      }
      else {
        throw new NotWritablePropertyException(getTargetClass(), propertyName);
      }
    }
    Object[] indices;
    try {
      indices = getIndices(propertyName);
    }
    catch (Exception e) {
      throw new NotWritablePropertyException(getTargetClass(), propertyName, "wrong index type", e);
    }
    Object index = indices[indices.length - 1];
    Object newParentValue = setAssemblageValue(getPropertyType(parentPropertyName), parentValue, index, value);
    if (newParentValue != parentValue) {
      setPropertyValue(parentPropertyName, newParentValue);
View Full Code Here

  }

  public void setSimplePropertyValue(String propertyName, Object value) throws BeansException {
    Member writeAccessor = getWritePropertyAccessor(propertyName);
    if (writeAccessor == null) {
      throw new NotWritablePropertyException(getTargetClass(), propertyName,
          "Neither non-static, non-final field nor set-method does exist");
    }
    Object target = getTarget();
    if (target == null) {
      throw new NullValueInNestedPathException(getTargetClass(), propertyName);
View Full Code Here

          }
        }
      }

      if ( setter == null ) {
        throw new NotWritablePropertyException( formModel.getFormObject().getClass(), formPropertyPath );
      }
    }

    return isNullable( setter, nullableAnnotation );
  }
View Full Code Here

        if ( key.startsWith( extendedPropertyPath ) ) {
          return;
        }
      }

      throw new NotWritablePropertyException( this.beanType, propertyPath );
    }
  }
View Full Code Here

      lbf.getBean("tb");
      fail("Should throw exception on invalid property");
    }
    catch (BeanCreationException ex) {
      assertTrue(ex.getCause() instanceof NotWritablePropertyException);
      NotWritablePropertyException cause = (NotWritablePropertyException) ex.getCause();
      // expected
      assertEquals(1, cause.getPossibleMatches().length);
      assertEquals("age", cause.getPossibleMatches()[0]);
    }
  }
View Full Code Here

      String name = findPropertyName(bean, key);

      if (name != null) {
        if (matches.containsValue(name)) {
          throw new NotWritablePropertyException(
              cls,
              name,
              "Duplicate match with distance <= "
                  + distanceLimit
                  + " found for this property in input keys: "
View Full Code Here

TOP

Related Classes of org.springframework.beans.NotWritablePropertyException

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.