List of usage examples for org.apache.commons.collections4 IteratorUtils objectGraphIterator
public static <E> Iterator<E> objectGraphIterator(final E root, final Transformer<? super E, ? extends E> transformer)
From source file:com.link_intersystems.beans.BeanClass.java
/** * Returns true if the method is a method to access a property (either get, * is, set). The equality is based on the method's signature. This means * that even property accessor methods in super classes will be recognized * as property accessor methods of this {@link BeanClass}. * * @param method//from w w w . ja v a2s .c om * the method to test if it is a property accessor method of this * class. * @return true if the given method is a property accessor method of this * class. * @since 1.2.0.0 */ @SuppressWarnings("unchecked") public boolean isPropertyAccessor(Method method) { Class<?> declaringClass = method.getDeclaringClass(); Class<T> beanType = getType(); boolean isInHierarchy = declaringClass.isAssignableFrom(beanType); if (!isInHierarchy) { return false; } Map<String, PropertyDescriptor> propertyDescriptors = getPropertyDescriptors(); Collection<PropertyDescriptor> propertyDescriptorCollection = propertyDescriptors.values(); Predicate predicate = new SignaturePredicate(method); Iterator<Method> propertyMethodsIterator = IteratorUtils.objectGraphIterator( propertyDescriptorCollection.iterator(), PropertyDescriptor2AccessorsTransformer.INSTANCE); Iterator<Method> filteredIterator = IteratorUtils.filteredIterator(propertyMethodsIterator, predicate); return filteredIterator.hasNext(); }