public Constructor getZeroArgumentConstructor ( ) { if ( zeroArgumentConstructor == null && ! alreadyLookedupZeroArguments ) { try { zeroArgumentConstructor = getClassOfObject ( ) . getConstructor ( NO_PARAMS ) ; } catch ( NoSuchMethodException e ) { //no public zero argument constructor available let's try for a private/protected one try { zeroArgumentConstructor = getClassOfObject ( ) . getDeclaredConstructor ( NO_PARAMS ) ; //we found one, now let's make it accessible zeroArgumentConstructor . setAccessible ( true ) ; } catch ( NoSuchMethodException e2 ) { //out of options, log the fact and let the method return null LoggerFactory . getDefaultLogger ( ) . warn ( this . getClass ( ) . getName ( ) + ": " + "No zero argument constructor defined for " + this . getClassOfObject ( ) ) ; } } alreadyLookedupZeroArguments = true ; } return zeroArgumentConstructor ; }
returns the zero argument constructor for the class represented by this class descriptor or null if a zero argument constructor does not exist . If the zero argument constructor for this class is not public it is made accessible before being returned .