/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { return !subfilter.matches(object); }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { for(Filter<T> subfilter : subfilters) { subfilter.reset(); } } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = false; for(Filter<T> filter : getSubFilters()) { matched = matched || filter.matches(object); if(matched) { return true; } } return false; } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = true; for(Filter<T> filter : getSubFilters()) { matched = matched && filter.matches(object); if(!matched) { return false; } } return true; } }
/** * Applies the given filter to the input and returns only those elements * that match it. * * @param filter * a (possible compound) filter; elements in the input array matching the * filter will be returned. * @param elements * the collection of objects to filter. * @return * a filtered set of elements. */ public static <T> Collection<T> apply(Filter<T> filter, T ... elements) { List<T> list = new ArrayList<T>(); if(elements != null) { for(T element : elements) { list.add(element); } } return apply(filter, list); }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = false; for(Filter<T> filter : getSubFilters()) { matched = matched || filter.matches(object); if(matched) { return true; } } return false; } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = true; for(Filter<T> filter : getSubFilters()) { matched = matched && filter.matches(object); if(!matched) { return false; } } return true; } }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { for(Filter<T> subfilter : subfilters) { subfilter.reset(); } } }
/** * Applies the given filter to the input and returns only those elements * that match it. * * @param filter * a (possible compound) filter; elements in the input array matching the * filter will be returned. * @param elements * the collection of objects to filter. * @return * a filtered set of elements. */ public static <T> Collection<T> apply(Filter<T> filter, T ... elements) { List<T> list = new ArrayList<T>(); if(elements != null) { for(T element : elements) { list.add(element); } } return apply(filter, list); }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { return !subfilter.matches(object); }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = false; for(Filter<T> filter : getSubFilters()) { matched = matched || filter.matches(object); if(matched) { return true; } } return false; } }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { boolean matched = true; for(Filter<T> filter : getSubFilters()) { matched = matched && filter.matches(object); if(!matched) { return false; } } return true; } }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { subfilter.reset(); } }
/** * Returns the filtered set of methods of the given class, including those * inherited from the super-classes; if provided, complex filter criteria * can be applied. * * @param clazz * the class whose methods are being retrieved. * @param filter * an optional filter; to get all fields pass in a {@code null} value. * @return * the set of methods from the given class and its super-classes. */ public static Set<Method> getMethods(Class<?> clazz, Filter<Method>filter) { Set<Method> methods = new HashSet<Method>(); Class<?> cursor = clazz; while(cursor != null && cursor != Object.class) { // get all methods and apply filters methods.addAll(Filter.apply(filter, cursor.getDeclaredMethods())); // up one step on the hierarchy cursor = cursor.getSuperclass(); } return methods; }
/** * @see org.dihedron.core.filters.Filter#matches(java.lang.Object) */ @Override public boolean matches(T object) { return !subfilter.matches(object); }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { for(Filter<T> subfilter : subfilters) { subfilter.reset(); } } }
/** * Returns the filtered set of fields of the given class, including those * inherited from the super-classes; if provided, complex filter criteria * can be applied. * * @param clazz * the class whose fields are being retrieved. * @param filter * an optional filter; to get all fields pass in a {@code null} value. * @return * the set of fields from the given class and its super-classes. */ public static Set<Field> getFields(Class<?> clazz, Filter<Field> filter) { Set<Field> fields = new HashSet<Field>(); Class<?> cursor = clazz; while(cursor != null && cursor != Object.class) { // get all fields and apply filters fields.addAll(Filter.apply(filter, cursor.getDeclaredFields())); // up one step on the hierarchy cursor = cursor.getSuperclass(); } return fields; }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { subfilter.reset(); } }
/** * Returns the filtered set of fields of the given class, including those * inherited from the super-classes; if provided, complex filter criteria * can be applied. * * @param clazz * the class whose fields are being retrieved. * @param filter * an optional filter; to get all fields pass in a {@code null} value. * @return * the set of fields from the given class and its super-classes. */ public static Set<Field> getFields(Class<?> clazz, Filter<Field> filter) { Set<Field> fields = new HashSet<Field>(); Class<?> cursor = clazz; while(cursor != null && cursor != Object.class) { // get all fields and apply filters fields.addAll(Filter.apply(filter, cursor.getDeclaredFields())); // up one step on the hierarchy cursor = cursor.getSuperclass(); } return fields; }
/** * @see org.dihedron.core.filters.Filter#reset() */ @Override public void reset() { subfilter.reset(); } }