Example usage for com.fasterxml.jackson.databind.introspect AnnotatedMethod getRawType

List of usage examples for com.fasterxml.jackson.databind.introspect AnnotatedMethod getRawType

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.introspect AnnotatedMethod getRawType.

Prototype

public Class<?> getRawType() 

Source Link

Usage

From source file:Main.java

/**
 * Another helper method to deal with rest of [JACKSON-103]
 *///  w ww. j a v a  2s.c om
protected static boolean isGroovyMetaClassGetter(AnnotatedMethod am) {
    Class<?> rt = am.getRawType();
    if (rt == null || rt.isArray()) {
        return false;
    }
    Package pkg = rt.getPackage();
    if (pkg != null && pkg.getName().startsWith("groovy.lang")) {
        return true;
    }
    return false;
}

From source file:Main.java

/**
 * This method was added to address [JACKSON-53]: need to weed out
 * CGLib-injected "getCallbacks". //from   ww w  .j av a  2 s  .c o m
 * At this point caller has detected a potential getter method
 * with name "getCallbacks" and we need to determine if it is
 * indeed injectect by Cglib. We do this by verifying that the
 * result type is "net.sf.cglib.proxy.Callback[]"
 *<p>
 * Also, see [JACKSON-177]; Hibernate may repackage cglib
 * it uses, so we better catch that too
 */
protected static boolean isCglibGetCallbacks(AnnotatedMethod am) {
    Class<?> rt = am.getRawType();
    // Ok, first: must return an array type
    if (rt == null || !rt.isArray()) {
        return false;
    }
    /* And that type needs to be "net.sf.cglib.proxy.Callback".
     * Theoretically could just be a type that implements it, but
     * for now let's keep things simple, fix if need be.
     */
    Class<?> compType = rt.getComponentType();
    // Actually, let's just verify it's a "net.sf.cglib.*" class/interface
    Package pkg = compType.getPackage();
    if (pkg != null) {
        String pname = pkg.getName();
        if (pname.startsWith("net.sf.cglib")
                // also, as per [JACKSON-177]
                || pname.startsWith("org.hibernate.repackage.cglib")) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static String okNameForIsGetter(AnnotatedMethod am, String name) {
    if (name.startsWith("is")) {
        // plus, must return boolean...
        Class<?> rt = am.getRawType();
        if (rt != Boolean.class && rt != Boolean.TYPE) {
            return null;
        }//from   www  .  j a va  2  s .  co  m
        return manglePropertyName(name.substring(2));
    }
    // no, not a match by name
    return null;
}