@Override // since 2.7 public AnnotatedMethod resolveSetterConflict(MapperConfig<?> config, AnnotatedMethod setter1, AnnotatedMethod setter2) { Class<?> cls1 = setter1.getRawParameterType(0); Class<?> cls2 = setter2.getRawParameterType(0); // First: prefer primitives over non-primitives // 11-Dec-2015, tatu: TODO, perhaps consider wrappers for primitives too? if (cls1.isPrimitive()) { if (!cls2.isPrimitive()) { return setter1; } } else if (cls2.isPrimitive()) { return setter2; } if (cls1 == String.class) { if (cls2 != String.class) { return setter1; } } else if (cls2 == String.class) { return setter2; } return null; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference. */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); String pkgName = ClassUtil.getPackageName(argType); return (pkgName != null) && pkgName.startsWith("groovy.lang"); }
Class<?> type = anyMethod.getRawParameterType(0); if ((type != String.class) && (type != Object.class)) { throw new IllegalArgumentException(String.format(
@Override public Method findFactoryMethod(Class<?>... expArgTypes) { // So, of all single-arg static methods: for (AnnotatedMethod am : _classInfo.getFactoryMethods()) { // 24-Oct-2016, tatu: Better ensure it only takes 1 arg, no matter what if (isFactoryMethod(am) && am.getParameterCount() == 1) { // And must take one of expected arg types (or supertype) Class<?> actualArgType = am.getRawParameterType(0); for (Class<?> expArgType : expArgTypes) { // And one that matches what we would pass in if (actualArgType.isAssignableFrom(expArgType)) { return am.getAnnotated(); } } } } return null; }
Class<?> cls = am.getRawParameterType(0); if (cls == String.class || CharSequence.class.isAssignableFrom(cls)) { return true;
@Override // since 2.9 public JacksonInject.Value findInjectableValue(AnnotatedMember m) { JacksonInject ann = _findAnnotation(m, JacksonInject.class); if (ann == null) { return null; } // Empty String means that we should use name of declared value class. JacksonInject.Value v = JacksonInject.Value.from(ann); if (!v.hasId()) { Object id; // slight complication; for setters, type if (!(m instanceof AnnotatedMethod)) { id = m.getRawType().getName(); } else { AnnotatedMethod am = (AnnotatedMethod) m; if (am.getParameterCount() == 0) { // getter id = m.getRawType().getName(); } else { // setter id = am.getRawParameterType(0).getName(); } } v = v.withId(id); } return v; }
if (factory.getRawParameterType(0) != String.class) { throw new IllegalArgumentException("Parameter #0 type for factory method ("+factory+") not suitable, must be java.lang.String");
protected Class<?> _rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; // 27-Nov-2012, tatu: Bit nasty, as we are assuming // things about method signatures here... but has to do if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }
@Override public PropertyName findNameForDeserialization(Annotated a) { // 16-Sep-2016, tatu: Prior to 2.9 logic her more complicated, on assumption // that visibility rules may require return of "" if method/fied visible; // however, that is not required and causes issues so... now simpler: if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; if (!isVisible(am)) { return null; } Class<?> rawType = am.getRawParameterType(0); return findJaxbPropertyName(am, rawType, BeanUtil.okNameForMutator(am, "set", true)); } if (a instanceof AnnotatedField) { AnnotatedField af = (AnnotatedField) a; return isVisible(af) ? findJaxbPropertyName(af, af.getRawType(), null) : null; } return null; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference to resolve [JACKSON-103] */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); Package pkg = argType.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference to resolve [JACKSON-103] */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); Package pkg = argType.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference to resolve [JACKSON-103] */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); Package pkg = argType.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference to resolve [JACKSON-103] */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); Package pkg = argType.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference. */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); String pkgName = ClassUtil.getPackageName(argType); return (pkgName != null) && pkgName.startsWith("groovy.lang"); }
/** * Similar to {@link #isCglibGetCallbacks}, need to suppress * a cyclic reference to resolve [JACKSON-103] */ protected static boolean isGroovyMetaClassSetter(AnnotatedMethod am) { Class<?> argType = am.getRawParameterType(0); String pkgName = ClassUtil.getPackageName(argType); if (pkgName != null && pkgName.startsWith("groovy.lang")) { return true; } return false; }
private Class<?> rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); } }
protected Class<?> _rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; // 27-Nov-2012, tatu: Bit nasty, as we are assuming // things about method signatures here... but has to do if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }
protected Class<?> _rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; // 27-Nov-2012, tatu: Bit nasty, as we are assuming // things about method signatures here... but has to do if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }
/** * @since 2.1.2 */ protected Class<?> _rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; // 27-Nov-2012, tatu: Bit nasty, as we are assuming // things about method signatures here... but has to do if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }
/** * @since 2.1.2 */ protected Class<?> _rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; // 27-Nov-2012, tatu: Bit nasty, as we are assuming // things about method signatures here... but has to do if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }