@Override public FilterResult filter(Object instance) { if (instance == null) { throw new IllegalArgumentException("instance cannot be null"); } MatcherEvalContext<TypeMetadata, AttributeMetadata, AttributeId> matcherEvalContext = matcher.startSingleTypeContext(null, null, instance, metadataAdapter); if (matcherEvalContext != null) { // once we have a successfully created context we already have a match as there are no filter // conditions except for entity type return new FilterResultImpl(matcher.convert(instance), null, null); } return null; }
@SuppressWarnings("unchecked") @Override public final void describeMismatch(Object item, Description mismatchDescription) { if (item == null || !expectedType.isInstance(item)) { super.describeMismatch(item, mismatchDescription); } else { matchesSafely((T) item, mismatchDescription); } }