EvaluationExpression implements ISerializableSopremoType, Cloneable { @SuppressWarnings("unchecked") public <T extends EvaluationExpression> T find(final Class<T> evaluableClass) { final Reference<T> ref = new Reference<T>(); this.transformRecursively(new TransformFunction() { @Override public EvaluationExpression call(final EvaluationExpression evaluationExpression) { if (ref.getValue() == null && evaluableClass.isInstance(evaluationExpression)) ref.setValue((T) evaluationExpression); return evaluationExpression; } }); return ref.getValue(); }  @Override EvaluationExpression clone(); @Override boolean equals(final Object obj); @SuppressWarnings("unchecked") T find(final Class<T> evaluableClass); List<EvaluationExpression> findAll(final Predicate<? super EvaluationExpression> predicate); EvaluationExpression transformRecursively(final TransformFunction function); EvaluationExpression replace(final Predicate<? super EvaluationExpression> replacePredicate,
			final EvaluationExpression replaceFragment); EvaluationExpression replace(final Predicate<? super EvaluationExpression> replacePredicate,
			final TransformFunction replaceFunction); EvaluationExpression replace(final EvaluationExpression toReplace, final EvaluationExpression replaceFragment); EvaluationExpression remove(final Predicate<? super EvaluationExpression> predicate); EvaluationExpression remove(final EvaluationExpression expressionToRemove); EvaluationExpression remove(final Class<?> expressionType); abstract IJsonNode evaluate(IJsonNode node, IJsonNode target, EvaluationContext context); @Override int hashCode(); @SuppressWarnings("unused") IJsonNode set(final IJsonNode node, final IJsonNode value, final EvaluationContext context); @Override String toString(); @Override void toString(final StringBuilder builder); static final EvaluationExpression VALUE; }
@Test public void shouldFindValues() { final InputSelection inputSelection = new InputSelection(1); final ObjectAccess objectAccess = new ObjectAccess("test"); final PathExpression pathExpression = new PathExpression(inputSelection, objectAccess); final EvaluationExpression expression = new ArithmeticExpression(pathExpression, ArithmeticOperator.ADDITION, ConstantExpression.MISSING); Assert.assertSame(inputSelection, expression.find(InputSelection.class)); Assert.assertSame(objectAccess, expression.find(ObjectAccess.class)); }