Java Code Examples for com.fasterxml.jackson.databind.introspect.AnnotatedMethod#getParameterCount()
The following examples show how to use
com.fasterxml.jackson.databind.introspect.AnnotatedMethod#getParameterCount() .
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 |
@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 |
@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: JavaTimeModule.java From jackson-modules-java8 with Apache License 2.0 | 6 votes |
protected AnnotatedMethod _findFactory(AnnotatedClass cls, String name, Class<?>... argTypes) { final int argCount = argTypes.length; for (AnnotatedMethod method : cls.getFactoryMethods()) { if (!name.equals(method.getName()) || (method.getParameterCount() != argCount)) { continue; } for (int i = 0; i < argCount; ++i) { Class<?> argType = method.getParameter(i).getRawType(); if (!argType.isAssignableFrom(argTypes[i])) { continue; } } return method; } return null; }
Example 4
Source File: BQTimeModule.java From bootique with Apache License 2.0 | 6 votes |
protected AnnotatedMethod _findFactory(AnnotatedClass cls, String name, Class<?>... argTypes) { final int argCount = argTypes.length; for (AnnotatedMethod method : cls.getFactoryMethods()) { if (!name.equals(method.getName()) || (method.getParameterCount() != argCount)) { continue; } for (int i = 0; i < argCount; ++i) { Class<?> argType = method.getParameter(i).getRawType(); if (!argType.isAssignableFrom(argTypes[i])) { continue; } } return method; } return null; }
Example 5
Source File: FriendlyIdAnnotationIntrospector.java From friendly-id with Apache License 2.0 | 5 votes |
private Class<?> rawDeserializationType(Annotated a) { if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; if (am.getParameterCount() == 1) { return am.getRawParameterType(0); } } return a.getRawType(); }
Example 6
Source File: RosettaAnnotationIntrospector.java From Rosetta with Apache License 2.0 | 5 votes |
private Annotated getAnnotatedTypeFromAnnotatedMethod(AnnotatedMethod a) { if (a.getParameterCount() > 0) { return a.getParameter(0); } else if (a.hasReturnType()) { return a; } else { throw new IllegalArgumentException("Cannot have @StoredAsJson on a method with no parameters AND no arguments"); } }