@Override protected void doInitialize() { super.doInitialize(); if (this.reflectionUtil == null) { this.reflectionUtil = ReflectionUtilImpl.getInstance(); } if (this.collectionReflectionUtil == null) { this.collectionReflectionUtil = CollectionReflectionUtilImpl.getInstance(); } }
/** * This method gets the {@link ReflectionUtil}. * * @return the {@link ReflectionUtil}. */ public ReflectionUtil getReflectionUtil() { if (this.reflectionUtil == null) { this.reflectionUtil = ReflectionUtilImpl.getInstance(); } return this.reflectionUtil; }
@Override public Set<String> findResourceNames(String packageName, boolean includeSubPackages, Filter<? super String> filter, ClassLoader classLoader) { Set<String> result = new HashSet<>(); ResourceNameCollector visitor = new ResourceNameCollector(result, filter); visitResourceNames(packageName, includeSubPackages, classLoader, visitor); return result; }
/** * This method gets the default {@link ClassLoader} to use. This should be the {@link Thread#getContextClassLoader() * ContextClassLoader} but falls back to alternatives if no such {@link ClassLoader} is available. * * @return the default {@link ClassLoader} to use. */ protected ClassLoader getDefaultClassLoader() { return getDefaultClassLoader(null); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public <E> GenericType<List<E>> createGenericTypeOfList(GenericType<E> elementType) { return (GenericType) createGenericType(List.class); }
/** * @param <V> the generic type of the {@link TypeVariable} to bind. * @param variable the captured {@link TypeVariable}. * @param type the {@link Class} to bind to the {@link TypeVariable}. * @return this instance for fluent API. */ public <V> GenericTypeBuilder<T> with(GenericTypeVariable<V> variable, Class<V> type) { return withType(variable, type); }
@Override public Type toType(String type) { return toType(type, ClassResolver.CLASS_FOR_NAME_RESOLVER); }
/** * @param typeVariable the {@link TypeVariable} to wrap. * @return the {@link TypeVariable} wrapped as {@link GenericTypeVariable}. */ protected GenericTypeVariable<?> wrap(TypeVariable<?> typeVariable) { return new WrappedTypeVariable(typeVariable); }
@Override protected void doInitialized() { super.doInitialized(); if (instance == null) { instance = this; } }
@Override public <T> T getStaticFieldOrNull(Class<?> type, String fieldName, Class<T> fieldType, boolean exactTypeMatch, boolean mustBeFinal, boolean inherit) throws IllegalArgumentException { try { return getStaticField(type, fieldName, fieldType, exactTypeMatch, mustBeFinal, inherit); } catch (NoSuchFieldException e) { return null; } catch (IllegalAccessException e) { return null; } }
/** * The constructor. */ public GenericTypeVariable() { Type typeArgument = resolve(); assert (typeArgument instanceof TypeVariable); this.typeVariable = (TypeVariable<?>) typeArgument; }
@Override @SuppressWarnings("unchecked") public <T> T[] toArrayTyped(Collection<T> collection, Class<T> componentType) { return (T[]) toArray(collection, componentType); }
@Override public GenericType<?> createGenericType(Type type, Class<?> definingType) { return createGenericType(type, createGenericType(definingType)); }
@Override public GenericType<?> createGenericType(Type type, GenericType<?> definingType) { return createGenericType(type); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public <K, V> GenericType<Map<K, V>> createGenericTypeOfMap(GenericType<K> keyType, GenericType<V> valueType) { return (GenericType) createGenericType(Map.class); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public <E> GenericType<Set<E>> createGenericTypeOfSet(GenericType<E> elementType) { return (GenericType) createGenericType(Set.class); }
@Override public GenericType<?> createGenericType(Type type, Class<?> definingType) { return createGenericType(type); }