Example usage for org.apache.commons.lang3 ClassUtils hierarchy

List of usage examples for org.apache.commons.lang3 ClassUtils hierarchy

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ClassUtils hierarchy.

Prototype

public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) 

Source Link

Document

Get an Iterable that can iterate over a class hierarchy in ascending (subclass to superclass) order.

Usage

From source file:org.apache.olingo.ext.proxy.context.EntityUUID.java

public EntityUUID(final URI entitySetURI, final Class<?> type, final Object key) {
    this.entitySetURI = entitySetURI;
    this.key = key;
    this.tempKey = (int) (Math.random() * 1000000);

    if (type == null || !Serializable.class.isAssignableFrom(type)) {
        throw new IllegalArgumentException("Invalid Entity type class: " + type);
    }/*w w w .j  a va 2  s  .  c  o  m*/
    if (this.type == null) {
        for (Class<?> clazz : ClassUtils.hierarchy(type, ClassUtils.Interfaces.INCLUDE)) {
            if (ArrayUtils.contains(clazz.getInterfaces(), EntityType.class)) {
                this.type = clazz;
            }
        }
    }
}

From source file:therian.module.SelfContainedTherianModule.java

private Operator<?>[] getSelfContainedOperators() {
    final List<Operator<?>> result = new ArrayList<>();

    for (Class<?> c : ClassUtils.hierarchy(getClass(), interfacesPolicy)) {
        for (Class<?> inner : c.getDeclaredClasses()) {
            if (Operator.class.isAssignableFrom(inner)) {
                final Operator<?> operator = newInstance(inner.asSubclass(Operator.class));
                if (operator != null) {
                    result.add(operator);
                }//from ww w. j a v  a  2  s . c  om
            }
        }
    }
    return result.toArray(new Operator[result.size()]);
}