public List < ValidatorMetaData > readMetaData ( Class < ? > clazz , String propertyName ) { /* Generate a key to the cache based on the classname and the propertyName. */ String propertyKey = clazz . getName ( ) + "." + propertyName ; /* Look up the validation meta data in the cache. */ List < ValidatorMetaData > validatorMetaDataList = metaDataCache . get ( propertyKey ) ; /* If the meta-data was not found, then generate it. */ if ( validatorMetaDataList == null ) { // if not found validatorMetaDataList = extractValidatorMetaData ( clazz , propertyName , validatorMetaDataList ) ; /* Put it in the cache to avoid the processing in the future. * Design notes: The processing does a lot of reflection, there * is no need to do this each time. */ metaDataCache . put ( propertyKey , validatorMetaDataList ) ; } return validatorMetaDataList ; }
Read the meta - data from annotation . This copies the meta - data from the annotation into a POJO . It first checks the meta - data cache if the meta data is not found in the cache it then reads it from the class .