Java Code Examples for com.fasterxml.jackson.databind.introspect.AnnotatedMethod#getParameterType()

The following examples show how to use com.fasterxml.jackson.databind.introspect.AnnotatedMethod#getParameterType() . 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: JtModule.java    From haven-platform with Apache License 2.0 6 votes vote down vote up
@Override
public Object findDeserializationConverter(Annotated a) {
    JtToMap ann = a.getAnnotation(JtToMap.class);
    if (ann == null) {
        return null;
    }
    JavaType javaType = a.getType();
    if(a instanceof AnnotatedMethod) {
        AnnotatedMethod am = (AnnotatedMethod) a;
        if(am.getParameterCount() == 1) {
            javaType = am.getParameterType(0);
        } else {
            throw new RuntimeException("Invalid property setter: " + am.getAnnotated());
        }
    }
    return new DeserializationConverterImpl(ann, new Ctx(a, javaType));
}
 
Example 2
Source File: KvSupportModule.java    From haven-platform with Apache License 2.0 6 votes vote down vote up
@Override
public Object findDeserializationConverter(Annotated a) {
    Class<? extends PropertyInterceptor>[] interceptors = getInterceptors(a);
    if (interceptors == null) {
        return null;
    }
    JavaType javaType = a.getType();
    if(a instanceof AnnotatedMethod) {
        AnnotatedMethod am = (AnnotatedMethod) a;
        if(am.getParameterCount() == 1) {
            javaType = am.getParameterType(0);
        } else {
            throw new RuntimeException("Invalid property setter: " + am.getAnnotated());
        }
    }
    return new KvInterceptorsDeserializationConverter(interceptors, new KvPropertyContextImpl(a, javaType));
}
 
Example 3
Source File: EnumDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method used when Enum instances are to be deserialized
 * using a creator (static factory method)
 * 
 * @return Deserializer based on given factory method
 *
 * @since 2.8
 */
public static JsonDeserializer<?> deserializerForCreator(DeserializationConfig config,
        Class<?> enumClass, AnnotatedMethod factory,
        ValueInstantiator valueInstantiator, SettableBeanProperty[] creatorProps)
{
    if (config.canOverrideAccessModifiers()) {
        ClassUtil.checkAndFixAccess(factory.getMember(),
                config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
    }
    return new FactoryBasedEnumDeserializer(enumClass, factory,
            factory.getParameterType(0),
            valueInstantiator, creatorProps);
}
 
Example 4
Source File: ConvertingDeserializer.java    From graphql-spqr with Apache License 2.0 5 votes vote down vote up
private JavaType extractType(Annotated annotated) {
    if (annotated instanceof AnnotatedMethod) {
        AnnotatedMethod method = (AnnotatedMethod) annotated;
        if (ClassUtils.isSetter(method.getAnnotated())) {
            return method.getParameterType(0);
        }
        return method.getType();
    }
    return annotated.getType();
}