Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.introspect;
 
 import java.util.*;

Simple helper class used to keep track of collection of AnnotatedMethods, accessible by lookup. Lookup is usually needed for augmenting and overriding annotations.
public final class AnnotatedMethodMap
    implements Iterable<AnnotatedMethod>
    public AnnotatedMethodMap() { }

    
Method called to add specified annotated method in the Map.
    public void add(AnnotatedMethod am)
    {
        if ( == null) {
             = new LinkedHashMap<MemberKey,AnnotatedMethod>();
        }
        .put(new MemberKey(am.getAnnotated()), am);
    }

    
Method called to remove specified method, assuming it exists in the Map
    {
        return remove(am.getAnnotated());
    }
    public AnnotatedMethod remove(Method m)
    {
        if ( != null) {
            return .remove(new MemberKey(m));
        }
        return null;
    }
    public boolean isEmpty() {
        return ( == null || .size() == 0);
    }
    public int size() {
        return ( == null) ? 0 : .size();
    }
    public AnnotatedMethod find(String nameClass<?>[] paramTypes)
    {
        if ( == null) {
            return null;
        }
        return .get(new MemberKey(nameparamTypes));
    }
    public AnnotatedMethod find(Method m)
    {
        if ( == null) {
            return null;
        }
        return .get(new MemberKey(m));
    }
    /*
    /**********************************************************
    /* Iterable implementation (for iterating over values)
    /**********************************************************
     */
//  @Override
    public Iterator<AnnotatedMethoditerator()
    {
        if ( != null) {
            return .values().iterator();
        }
        List<AnnotatedMethodempty = Collections.emptyList();
        return empty.iterator();
    }
New to GrepCode? Check out our FAQ X