private void validateDefaultValues ( List < ParamDetail > detailList , HashMap < String , List < Validator > > paramConverterMap ) throws DeploymentUnitProcessingException { for ( ParamDetail detail : detailList ) { // check param converter for specific return type List < Validator > validators = paramConverterMap . get ( detail . parameter . getName ( ) ) ; if ( validators == null ) { // check for paramConverterProvider validators = paramConverterMap . get ( Object . class . getName ( ) ) ; } boolean isCheckClazzMethods = true ; if ( validators != null ) { for ( Validator v : validators ) { if ( ! v . isLazyLoad ( ) ) { try { Object obj = v . verify ( detail ) ; if ( obj != null ) { isCheckClazzMethods = false ; break ; } } catch ( Exception e ) { JAXRS_LOGGER . paramConverterFailed ( detail . defaultValue . value ( ) , detail . parameter . getSimpleName ( ) , detail . method . toString ( ) , v . toString ( ) , e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } } } if ( isCheckClazzMethods ) { Class baseType = detail . parameter ; Method valueOf = null ; // constructor rule try { Constructor < ? > ctor = baseType . getConstructor ( String . class ) ; if ( Modifier . isPublic ( ctor . getModifiers ( ) ) ) { continue ; // success move to next detail } } catch ( NoSuchMethodException ignored ) { } // method fromValue(String.class) rule try { Method fromValue = baseType . getDeclaredMethod ( "fromValue" , String . class ) ; if ( Modifier . isPublic ( fromValue . getModifiers ( ) ) ) { for ( Annotation ann : baseType . getAnnotations ( ) ) { if ( ann . annotationType ( ) . getName ( ) . equals ( "javax.xml.bind.annotation.XmlEnum" ) ) { valueOf = fromValue ; } } validateBaseType ( fromValue , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignoredA ) { } // method fromString(String.class) rule Method fromString = null ; try { fromString = baseType . getDeclaredMethod ( "fromString" , String . class ) ; if ( Modifier . isStatic ( fromString . getModifiers ( ) ) ) { validateBaseType ( fromString , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignoredB ) { } // method valueof(String.class) rule try { valueOf = baseType . getDeclaredMethod ( "valueOf" , String . class ) ; if ( Modifier . isStatic ( valueOf . getModifiers ( ) ) ) { validateBaseType ( valueOf , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignored ) { } } } }
Process all parameter DefaulValue objects . Flag all parameters with missing and invalid converters .