Package com.codiform.moo

Examples of com.codiform.moo.InvalidPropertyException


    if ( explicit || mode == AccessMode.FIELD ) {
      String errorMessage = validateField( field );
      if ( errorMessage == null ) {
        return new CollectionFieldProperty( field, propertyAnnotation, name, expression, explicit, ignore );
      } else if ( explicit ) {
        throw new InvalidPropertyException( name, declaringClass, errorMessage );
      }
    }
    return null;
  }
View Full Code Here


    if ( explicit || mode == AccessMode.FIELD ) {
      String errorMessage = validateField( field );
      if ( errorMessage == null ) {
        return new MapFieldProperty( field, propertyAnnotation, name, expression, explicit, ignore );
      } else if ( explicit ) {
        throw new InvalidPropertyException( name, declaringClass, errorMessage );
      }
    }
    return null;
  }
View Full Code Here

    if ( explicit || mode == AccessMode.FIELD ) {
      String errorMessage = validateField( field );
      if ( errorMessage == null ) {
        return new FieldProperty( field, propertyAnnotation, name, expression, explicit, ignore );
      } else if ( explicit ) {
        throw new InvalidPropertyException( name, declaringClass, errorMessage );
      }
    }
    return null;
  }
View Full Code Here

          validateNoCollectionPropertyAnnotation( collectionAnnotation, propertyName, declaringClass );
          validateNoMapPropertyAnnotation( mapAnnotation, propertyName, declaringClass );
          return createMethodProperty( method, propertyAnnotation, propertyName, explicit, ignore );
        }
      } else if ( explicit ) {
        throw new InvalidPropertyException( propertyName == null ? methodName : propertyName, method.getDeclaringClass(), errorMessage );
      }
    }
    return null;
  }
View Full Code Here

      Property property = PropertyFactory.createProperty( item, mode );
      if ( property != null ) {
        if ( properties.containsKey( property.getName() ) ) {
          Property current = properties.get( property.getName() );
          if ( current.isExplicit() && property.isExplicit() ) {
            throw new InvalidPropertyException(
                property.getName(),
                property.getDeclaringClass(),
                "Property %s (in %s) is explicitly defined with @Property as both field and method properties; Moo expects no more than one annotation per property name per class." );
          } else if ( !current.isExplicit() && property.isExplicit() ) {
            properties.put( property.getName(), property );
View Full Code Here

      MethodProperty property = new MethodProperty(item);
      if (property.isProperty(mode)) {
        if( properties.containsKey( property.getName() ) ) {
          Property current = properties.get( property.getName() );
          if( current.isExplicit() && property.isExplicit() ) {
            throw new InvalidPropertyException(property, "Property %s (in %s) is explicitly defined with @Property as both field and method properties; Moo expects no more than one annotation per property name per class." );
          } else if( !current.isExplicit() && property.isExplicit() ) {
            properties.put( property.getName(), property);
          }
        } else {
          properties.put(property.getName(),property);
View Full Code Here

    isProperty = true;
  }

  /* package */boolean isProperty(AccessMode mode) {
    if (isExplicit() && !isProperty) {
      throw new InvalidPropertyException(this, propertyFailure);
    }
    switch (mode) {
    case METHOD:
      return isProperty;
    case FIELD:
View Full Code Here

  private boolean isAcceptableField(boolean throwException) {
    int modifiers = field.getModifiers();
    if (Modifier.isStatic(modifiers)) {
      if (throwException) {
        throw new InvalidPropertyException(
            this,
            "%s (%s) is annotated with @Property, but is static.  Moo does not support static fields as properties.");
      } else {
        return false;
      }
    } else if (Modifier.isFinal(modifiers)) {
      if (throwException) {
        throw new InvalidPropertyException(
            this,
            "%s (%s) is annotated with @Property, but is final.  Moo cannot write to final fields as properties.");
      } else {
        return false;
      }
View Full Code Here

      MethodProperty property = new MethodProperty(item);
      if (property.isProperty(mode)) {
        if( properties.containsKey( property.getName() ) ) {
          Property current = properties.get( property.getName() );
          if( current.isExplicit() && property.isExplicit() ) {
            throw new InvalidPropertyException(property, "Property %s (in %s) is explicitly defined with @Property as both field and method properties; Moo expects no more than one annotation per property name per class." );
          } else if( !current.isExplicit() && property.isExplicit() ) {
            properties.put( property.getName(), property);
          }
        } else {
          properties.put(property.getName(),property);
View Full Code Here

      Property property = PropertyFactory.createProperty( item, mode );
      if( property != null ) {
        if( properties.containsKey( property.getName() ) ) {
          Property current = properties.get( property.getName() );
          if( current.isExplicit() && property.isExplicit() ) {
            throw new InvalidPropertyException(
                property.getName(),
                property.getDeclaringClass(),
                "Property %s (in %s) is explicitly defined with @Property as both field and method properties; Moo expects no more than one annotation per property name per class." );
          } else if( !current.isExplicit() && property.isExplicit() ) {
            properties.put( property.getName(), property );
View Full Code Here

TOP

Related Classes of com.codiform.moo.InvalidPropertyException

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.