/** * Gets object instance from groovy resource. * * @param <T> the type parameter * @param resource the resource * @param expectedType the expected type * @return the object instance from groovy resource */ public static <T> T getObjectInstanceFromGroovyResource(final Resource resource, final Class<T> expectedType) { return getObjectInstanceFromGroovyResource(resource, ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_OBJECT_ARRAY, expectedType); }
@SneakyThrows private void buildGroovyMultifactorPolicyInstanceIfNeeded() { if (this.groovyPolicyInstance == null) { val groovyResource = ResourceUtils.getResourceFrom(this.groovyScript); this.groovyPolicyInstance = ScriptingUtils.getObjectInstanceFromGroovyResource(groovyResource, RegisteredServiceMultifactorPolicy.class); } }
@SneakyThrows private void buildGroovyAccessStrategyInstanceIfNeeded() { if (this.groovyStrategyInstance == null) { val groovyResource = ResourceUtils.getResourceFrom(this.groovyScript); this.groovyStrategyInstance = ScriptingUtils.getObjectInstanceFromGroovyResource(groovyResource, RegisteredServiceAccessStrategy.class); } } }
val predicate = ScriptingUtils.getObjectInstanceFromGroovyResource(predicateResource, PREDICATE_CTOR_PARAMETERS, args, Predicate.class);