/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public Builder<T,V> readiness(Closure<Boolean> val) { this.readiness = GroovyJavaMethods.predicateFromClosure(checkNotNull(val, "val")); return this; } public Builder<T,V> readiness(Predicate<? super T> val) {
/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static List<Class<?>> getAllAssignableTypes(Class<?> base, Closure<Boolean> filter) { return getAllAssignableTypes(base, GroovyJavaMethods.<Class<?>>predicateFromClosure(filter)); } public static List<Class<?>> getAllAssignableTypes(Class<?> base, Predicate<Class<?>> filter) {
/** * Takes a closure which accepts this ScriptHelper and returns true or false * as to whether the script needs to run (or can throw error if desired) * * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated @SuppressWarnings({ "rawtypes", "unchecked" }) public ScriptHelper executeIf(Closure c) { Predicate<ScriptHelper> predicate = GroovyJavaMethods.predicateFromClosure(c); return executeIf(predicate); }
/** returns all fields on the given class, superclasses, and interfaces thereof, in that order of preference, * (excluding fields on Object) * * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static List<Field> getAllFields(Class<?> base, Closure<Boolean> filter) { return getAllFields(base, GroovyJavaMethods.<Field>predicateFromClosure(filter)); } public static List<Field> getAllFields(Class<?> base) {
/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static List<Field> getLocalFields(List<Class<?>> classes, Closure<Boolean> filter) { return getLocalFields(classes, GroovyJavaMethods.<Field>predicateFromClosure(filter)); } public static List<Field> getLocalFields(List<Class<?>> classes, Predicate<Field> filter) {
@Deprecated @Override public void setEntityFilter(Closure<Boolean> filter) { setEntityFilter(filter != null ? GroovyJavaMethods.<Entity>predicateFromClosure(filter) : null); }
/** * Convenience for error-checking the result. * <p/> * Takes closure which accepts bash exit code (integer), * and returns false if it is invalid. Default is that this resultCodeCheck * closure always returns true (and the exit code is made available to the * caller if they care) * * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated @SuppressWarnings({ "rawtypes", "unchecked" }) public ScriptHelper requireResultCode(Closure integerFilter) { Predicate<Integer> objectPredicate = GroovyJavaMethods.predicateFromClosure(integerFilter); return requireResultCode(objectPredicate); }
/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static <T> Task<List<T>> listAttributesWhenReady(AttributeSensor<T> sensor, Iterable<Entity> entities, Closure<Boolean> readiness) { Predicate<Object> readinessPredicate = (readiness != null) ? GroovyJavaMethods.<Object>predicateFromClosure(readiness) : JavaGroovyEquivalents.groovyTruthPredicate(); return listAttributesWhenReady(sensor, entities, readinessPredicate); }
/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static <T> Task<T> attributeWhenReady(Entity source, AttributeSensor<T> sensor, Closure<Boolean> ready) { Predicate<Object> readyPredicate = (ready != null) ? GroovyJavaMethods.<Object>predicateFromClosure(ready) : JavaGroovyEquivalents.groovyTruthPredicate(); return attributeWhenReady(source, sensor, readyPredicate); }
@SuppressWarnings("unchecked") public static <T> Predicate<T> castToPredicate(Object o) { try { if (safeGroovyIsCase(o, Closure.class)) { return predicateFromClosure((Closure<Boolean>)o); } else { return (Predicate<T>) o; } } catch (Throwable e) { throw Exceptions.propagate(e); } }
/** * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ @Deprecated public static <T,V> Task<V> attributePostProcessedWhenReady(Entity source, AttributeSensor<T> sensor, Closure<Boolean> ready, Closure<V> postProcess) { Predicate<? super T> readyPredicate = (ready != null) ? GroovyJavaMethods.predicateFromClosure(ready) : JavaGroovyEquivalents.groovyTruthPredicate(); Function<? super T, V> postProcessFunction = GroovyJavaMethods.<T,V>functionFromClosure(postProcess); return attributePostProcessedWhenReady(source, sensor, readyPredicate, postProcessFunction); }