Java Code Examples for org.apache.commons.lang3.ClassUtils#hierarchy()
The following examples show how to use
org.apache.commons.lang3.ClassUtils#hierarchy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityUUID.java From olingo-odata4 with Apache License 2.0 | 6 votes |
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); } if (this.type == null) { for (Class<?> clazz : ClassUtils.hierarchy(type, ClassUtils.Interfaces.INCLUDE)) { if (ArrayUtils.contains(clazz.getInterfaces(), EntityType.class)) { this.type = clazz; } } } }
Example 2
Source File: Bindings.java From Bastion with GNU General Public License v3.0 | 3 votes |
/** * Creates a Bindings object containing the entire class hierarchy of the given view type. All extended classes and interfaces * implemented by the given type will be bound to the specified view. * * @param viewType The class representing the type of view to bind * @param view The view object to bind * @param <T> The type of view to bind * @return A bindings object */ @SuppressWarnings("unchecked") public static <T> Bindings hierarchy(Class<? super T> viewType, T view) { Bindings bindings = new Bindings(); for (Class<?> superType : ClassUtils.hierarchy(viewType, ClassUtils.Interfaces.INCLUDE)) { bindings.addBinding((Class<? super T>) superType, view); } return bindings; }