public static Map < String , Map < String , Map < String , Map < String , ? > > > > getCoreValidationConstraints ( ) { if ( CORE_CONSTRAINTS . isEmpty ( ) ) { for ( Map . Entry < String , Class < ? extends ParaObject > > e : ParaObjectUtils . getCoreClassesMap ( ) . entrySet ( ) ) { String type = e . getKey ( ) ; List < Field > fieldlist = Utils . getAllDeclaredFields ( e . getValue ( ) ) ; for ( Field field : fieldlist ) { Annotation [ ] annos = field . getAnnotations ( ) ; if ( annos . length > 1 ) { Map < String , Map < String , ? > > constrMap = new HashMap <> ( ) ; for ( Annotation anno : annos ) { if ( isValidConstraintType ( anno . annotationType ( ) ) ) { Constraint c = fromAnnotation ( anno ) ; if ( c != null ) { constrMap . put ( c . getName ( ) , c . getPayload ( ) ) ; } } } if ( ! constrMap . isEmpty ( ) ) { if ( ! CORE_CONSTRAINTS . containsKey ( type ) ) { CORE_CONSTRAINTS . put ( type , new HashMap <> ( ) ) ; } CORE_CONSTRAINTS . get ( type ) . put ( field . getName ( ) , constrMap ) ; } } } } } return Collections . unmodifiableMap ( CORE_CONSTRAINTS ) ; }
Returns all validation constraints that are defined by Java annotation in the core classes .