Package com.dyuproject.web.rest

Examples of com.dyuproject.web.rest.ValidationException


            {
                Object value = props.get(vs.getPropertyName());
                if(value==null)
                {
                    if(vs.isRequired())
                        throw new ValidationException(vs.getErrorMsg(), vs.getPropertyName(), obj);
                   
                    continue;
                }
                try
                {
                    vs.invoke(obj, value);
                    count++;
                }
                catch(ValidationException e)
                {
                    // need as its a subclass of IllegalArgumentException
                    throw e;
                }
                catch (IllegalArgumentException e)
                {                   
                    throw new ValidationException(vs.getErrorMsg(), vs.getPropertyName(), obj);
                }
                catch (IllegalAccessException e)
                {                   
                    throw new RuntimeException(e);
                }
                catch (InvocationTargetException e)
                {                   
                    throw new ValidationException(vs.getErrorMsg(), vs.getPropertyName(), obj);
                }               
            }           
            return count;
        }
View Full Code Here


            {
                String errorMsg = _validator.validate(value);
                if(errorMsg==null)
                    super.invokeObject(obj, value);
                else
                    throw new ValidationException(errorMsg, getPropertyName(), obj);
            }
        }
View Full Code Here

            if(value==null)
            {
                if(!included.isRequired())
                    continue;
               
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            value = value.trim();
            if(value.length()==0)
            {
                if(!included.isRequired())
                    continue;
               
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            Object actualValue = included.getSimpleField().getType().getActualValue(value);
           
            String errorMsg = included.getErrorMsg(actualValue);
            if(errorMsg!=null)
                throw new ValidationException(errorMsg, field, pojo);
            try
            {               
                included.getSimpleField().getMethod().invoke(pojo, new Object[]{actualValue});
                count++;
            }
            catch(IllegalArgumentException e)
            {
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            catch (IllegalAccessException e)
            {
                throw new RuntimeException(e);
            }
            catch (InvocationTargetException e)
            {
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }           
        }
        return count;
    }
View Full Code Here

            if(value==null)
            {
                if(!included.isRequired())
                    continue;
               
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            value = value.trim();
            if(value.length()==0)
            {
                if(!included.isRequired())
                    continue;
               
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            Object actualValue = included.getSimpleField().getType().getActualValue(value);
           
            String errorMsg = included.getErrorMsg(actualValue);
            if(errorMsg!=null)
                throw new ValidationException(errorMsg, field, pojo);
            // lazy
            if(pojo==null)
            {
                try
                {
                    pojo = _pojoClass.newInstance();
                }
                catch(Exception e)
                {
                    throw new RuntimeException(e);
                }
            }
            try
            {               
                included.getSimpleField().getMethod().invoke(pojo, new Object[]{actualValue});
            }
            catch(IllegalArgumentException e)
            {
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }
            catch (IllegalAccessException e)
            {
                throw new RuntimeException(e);
            }
            catch (InvocationTargetException e)
            {
                throw new ValidationException(included.getErrorMsg(), field, pojo);
            }           
        }
        return pojo;
    }
View Full Code Here

TOP

Related Classes of com.dyuproject.web.rest.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.