All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.open.jwtdependency.com.fasterxml.jackson.databind.introspect.AnnotatedMethodMap Maven / Gradle / Ivy

Go to download

This is a drop in replacement for the auth0 java-jwt library (see https://github.com/auth0/java-jwt). This jar makes sure there are no external dependencies (e.g. fasterXml, Apacha Commons) needed. This is useful when deploying to an application server (e.g. tomcat with Alfreso or Pega).

The newest version!
package com.fasterxml.jackson.databind.introspect;

import java.lang.reflect.Method;
import java.util.*;

/**
 * Simple helper class used to keep track of collection of
 * {@link AnnotatedMethod}s, accessible by lookup. Lookup
 * is usually needed for augmenting and overriding annotations.
 */
public final class AnnotatedMethodMap
    implements Iterable
{
    protected LinkedHashMap _methods;

    public AnnotatedMethodMap() { }

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

    /**
     * Method called to remove specified method, assuming
     * it exists in the Map
     */
    public AnnotatedMethod remove(AnnotatedMethod am)
    {
        return remove(am.getAnnotated());
    }

    public AnnotatedMethod remove(Method m)
    {
        if (_methods != null) {
            return _methods.remove(new MemberKey(m));
        }
        return null;
    }

    public boolean isEmpty() {
        return (_methods == null || _methods.size() == 0);
    }

    public int size() {
        return (_methods == null) ? 0 : _methods.size();
    }

    public AnnotatedMethod find(String name, Class[] paramTypes)
    {
        if (_methods == null) {
            return null;
        }
        return _methods.get(new MemberKey(name, paramTypes));
    }

    public AnnotatedMethod find(Method m)
    {
        if (_methods == null) {
            return null;
        }
        return _methods.get(new MemberKey(m));
    }

    /*
    /**********************************************************
    /* Iterable implementation (for iterating over values)
    /**********************************************************
     */

    @Override
    public Iterator iterator()
    {
        if (_methods != null) {
            return _methods.values().iterator();
        }
        List empty = Collections.emptyList();
        return empty.iterator();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy