Class ReflectionSecurity
java.lang.Object
com.onenetwork.platform.tools.util.ReflectionSecurity
public class ReflectionSecurity
extends java.lang.Object
This class ensures only whitelisted list of classnames are allowed to
be intantiated using reflection
-
Constructor Summary
Constructors Constructor Description ReflectionSecurity()
-
Method Summary
Modifier and Type Method Description static void
registerSafeReflectiveInstantiationBasePackage(java.lang.String basePkg)
Configures the given package and all its subpackages as safe for instantiation.static java.lang.String
sanitizeClassForReflectiveInstantiation(java.lang.String className)
Throws IllegalArgumentException if the given className is not registered safe for reflection.
-
Constructor Details
-
ReflectionSecurity
public ReflectionSecurity()
-
-
Method Details
-
registerSafeReflectiveInstantiationBasePackage
public static void registerSafeReflectiveInstantiationBasePackage(java.lang.String basePkg)Configures the given package and all its subpackages as safe for instantiation. -
sanitizeClassForReflectiveInstantiation
public static java.lang.String sanitizeClassForReflectiveInstantiation(java.lang.String className)Throws IllegalArgumentException if the given className is not registered safe for reflection.
-