Examples of AnnotatedMethod


Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

  }

  @Override
  public Object findDeserializer(Annotated a) {
    if (a instanceof AnnotatedMethod) {
      AnnotatedMethod method = (AnnotatedMethod) a;
      TypeDescriptor typeDescriptor = getTypeDescriptorForDeserializer(method);
      for (Annotation ann : typeDescriptor.getAnnotations()){
        if (isHandled(ann)) {
          return new ConvertingDeserializer(this.conversionService, typeDescriptor);
        }
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

  @Override
  public Object findSerializer(Annotated a) {
    // this seems to be called even if the method is not annotated with an actual annotation???
    if (a instanceof AnnotatedMethod) {
      AnnotatedMethod method = (AnnotatedMethod) a;
      TypeDescriptor typeDescriptor = getTypeDescriptorForSerializer(method);
      for (Annotation ann : typeDescriptor.getAnnotations()){
        if (isHandled(ann)) {
          return new ConvertingSerializer(this.conversionService, typeDescriptor);
        }
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

    }
    /* 16-Feb-2010, tatu: May also have annotation associated with field, not method
     *    itself... and findAnnotation() won't find that (nor property descriptor)
     */
    if ((a instanceof AnnotatedMethod) && propName != null) {
      AnnotatedMethod am = (AnnotatedMethod) a;
      annotation = this.findFieldAnnotation(XmlElement.class, am.getDeclaringClass(), propName);
      if (annotation != null && annotation.type() != XmlElement.DEFAULT.class) {
        return annotation.type();
      }
    }
    return null;
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

        AnnotatedClass ac = AnnotatedClass.construct(NumberBean.class, new JacksonAnnotationIntrospector(), null);
        ac.resolveMemberMethods(BasicClassIntrospector.SetterMethodFilter.instance);
        assertEquals(1, ac.getMemberMethodCount());

        Iterator<AnnotatedMethod> it = ac.memberMethods().iterator();
        AnnotatedMethod am = it.next();

        assertEquals("setX", am.getName());
        // should be one from sub-class
        assertEquals(NumberBean.class, am.getDeclaringClass());
        assertEquals(Integer.class, am.getParameterClass(0));
    }
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

        props = filterBeanProperties(config, beanDesc, props);
        // Do they need to be sorted in some special way?
        props = sortBeanProperties(config, beanDesc, props);
        BeanSerializer ser = new BeanSerializer(beanDesc.getBeanClass(), props);
        // 1.6: any-setter?
        AnnotatedMethod m = beanDesc.findAnyGetter();
        if (m != null) {
            JavaType type = m.getType(beanDesc.bindingsForBeanType());
            // copied from BasicSerializerFactory.buildMapSerializer():
            boolean staticTyping = config.isEnabled(SerializationConfig.Feature.USE_STATIC_TYPING);
            JavaType valueType = type.getContentType();
            TypeSerializer typeSer = createTypeSerializer(valueType, config);
            MapSerializer mapSer = MapSerializer.construct(/* ignored props*/ null, type, staticTyping, typeSer);
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

                return buildIndexedListSerializer(type, config, beanDesc);
            }
            return buildCollectionSerializer(type, config, beanDesc);
        }
        // [JACKSON-193]: consider @JsonValue for enum types (and basically any type), so:
        AnnotatedMethod valueMethod = beanDesc.findJsonValueMethod();
        if (valueMethod != null) {
            JsonSerializer<Object> ser = findSerializerFromAnnotation(config, valueMethod);
            return new JsonValueSerializer(valueMethod.getAnnotated(), ser);
           
        }
       
        if (Number.class.isAssignableFrom(cls)) {
            return StdSerializers.NumberSerializer.instance;
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

        }

        /* [JACKSON-80]: Should support @JsonValue, which is alternative to
         *   actual bean method introspection.
         */
        AnnotatedMethod valueMethod = beanDesc.findJsonValueMethod();
        if (valueMethod != null) {
            /* Further, method itself may also be annotated to indicate
             * exact JsonSerializer to use for whatever value is returned...
             */
            ser = findSerializerFromAnnotation(config, valueMethod);
            return new JsonValueSerializer(valueMethod.getAnnotated(), ser);
        }
        return constructBeanSerializer(type, config, beanDesc);
    }
View Full Code Here

Examples of org.codehaus.jackson.map.introspect.AnnotatedMethod

            JsonSerializer<Object> annotatedSerializer = findSerializerFromAnnotation(config, af);
            props.add(pb.buildProperty(en.getKey(), annotatedSerializer, af, staticTyping));
        }

        for (Map.Entry<String,AnnotatedMethod> en : methodsByProp.entrySet()) {
            AnnotatedMethod am = en.getValue();
            if (fixAccess) {
                am.fixAccess();
            }
            // Does Method specify a serializer? If so, let's use it.
            JsonSerializer<Object> annotatedSerializer = findSerializerFromAnnotation(config, am);
            props.add(pb.buildProperty(en.getKey(), annotatedSerializer, am, staticTyping));
        }
View Full Code Here

Examples of org.glassfish.jersey.server.model.AnnotatedMethod

*/
public class RolesAllowedDynamicFeature implements DynamicFeature {

    @Override
    public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
        AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());

        // DenyAll on the method take precedence over RolesAllowed and PermitAll
        if (am.isAnnotationPresent(DenyAll.class)) {
            configuration.register(new RolesAllowedRequestFilter());
            return;
        }

        // RolesAllowed on the method takes precedence over PermitAll
        RolesAllowed ra = am.getAnnotation(RolesAllowed.class);
        if (ra != null) {
            configuration.register(new RolesAllowedRequestFilter(ra.value()));
            return;
        }

        // PermitAll takes precedence over RolesAllowed on the class
        if (am.isAnnotationPresent(PermitAll.class)) {
            // Do nothing.
            return;
        }

        // DenyAll can't be attached to classes
View Full Code Here

Examples of org.glassfish.jersey.server.model.AnnotatedMethod

@Provider
public class CacheControlledResponseFeature implements DynamicFeature {

    @Override
    public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
        final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());

        // check to see if it has cache control annotation
        final CacheControl cc = am.getAnnotation(CacheControl.class);
        if (cc != null) {
            configuration.register(new CacheControlledResponseFilter(cc));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.