public boolean isAllowed ( String classname ) { Objects . requireNonNull ( classname ) ; if ( ! restrictedClassnames . isEmpty ( ) ) { for ( String restrictedClassname : restrictedClassnames ) { if ( classname . startsWith ( restrictedClassname ) ) { return false ; } } } if ( ! allowedClassnames . isEmpty ( ) ) { for ( String allowedClassname : allowedClassnames ) { if ( classname . startsWith ( allowedClassname ) ) { return true ; } } return false ; } return true ; }
Tells whether or not the given classname is allowed thus can be loaded .