public static void checkConstriants(BaseXmlDataValue obj) throws ConstraintException {
        for(Method method : obj.getClass().getMethods()) {
            for(Annotation anno : method.getAnnotations()) {
                if(isConstraint(anno)) {
                    try {
                        String value = (String)method.invoke(obj, (Object[])null);
                        if(anno instanceof MaxLength) {
                            int max = ((MaxLength)anno).value();
                            if (value != null && value.length() > max) {
                                throw new ConstraintException(ConstraintExceptionType.CONSTRIANT, "Length of \"" + value + "\" is larger than " + max);
                            }
                                
                        }
                    } catch (IllegalAccessException ex) {
                        throw new ConstraintException(ConstraintExceptionType.ILLEGAL_ACCESS, ex);
                    } catch (IllegalArgumentException ex) {
                        throw new ConstraintException(ConstraintExceptionType.ILLEGAL_ARGUMENT, ex);
                    } catch (InvocationTargetException ex) {
                        throw new ConstraintException(ConstraintExceptionType.INVOCATION_TARGET, ex);
                    }
                }
            }
        }
    }