Package wwutil.model

Examples of wwutil.model.ValidationException


       
    }

    private void validateFields(Class modelClass, Field idField, Field rangeField) {
        if (idField == null)
            throw new ValidationException("Missing the annotated @Id field in the model class.");

        if (Modifier.isTransient(idField.getModifiers()) || ReflectUtil.hasAnnotation(idField, Transient.class))
            throw new ValidationException("The @Key field cannot be transient or annotated with Transient in the model class.");
       
        if (rangeField != null && (Modifier.isTransient(idField.getModifiers()) || Modifier.isTransient(rangeField.getModifiers())))
            throw new ValidationException("The @Key field cannot be transient in the model class.");

        if (ReflectUtil.hasAnnotation(idField, S3Field.class))
            throw new ValidationException("The @Key field cannot be @S3Field in the model class.");

        if (rangeField != null && ReflectUtil.hasAnnotation(rangeField, S3Field.class))
            throw new ValidationException("The @Key field cannot be @S3Field in the model class.");

        if (idField.getType() != String.class &&
            idField.getType() != Integer.class &&
            idField.getType() != int.class &&
            idField.getType() != Long.class &&
            idField.getType() != long.class)
            throw new ValidationException("The @Id field can only be String, Integer, or Long.");

    }
View Full Code Here

TOP

Related Classes of wwutil.model.ValidationException

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.