All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.vyarus.java.generics.resolver.GenericsResolver Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package ru.vyarus.java.generics.resolver;

import ru.vyarus.java.generics.resolver.context.GenericsContext;
import ru.vyarus.java.generics.resolver.context.GenericsInfoFactory;

/**
 * Resolves class hierarchy generics and provides api for introspection.
 *
 * @author Vyacheslav Rusakov
 * @since 17.11.2014
 */
public final class GenericsResolver {

    private GenericsResolver() {
    }

    /**
     * By default returned context set on root class, which can't be introspected (because only parent class hods
     * generics information for current class). To use it switch context to required type from hierarchy:
     * {@code returnedContext.type(SomeTypeFromHierarchy.class)}.
     * 

Note: when ignore classes provided, produced {@code GenericsInfo} instance will not be cached * (and full version from cache will not be used also)

* * @param type root class to resolve generics hierarchy * @param ignoreClasses list of classes to ignore during inspection (useful to avoid interface clashes * or to limit resolution depth) * @return resolved generics context object */ public static GenericsContext resolve(final Class type, final Class... ignoreClasses) { return new GenericsContext(GenericsInfoFactory.create(type, ignoreClasses), type); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy