Changeset 10831 in josm for trunk/src/oauth/signpost/http


Ignore:
Timestamp:
2016-08-18T00:21:03+02:00 (9 years ago)
Author:
Don-vip
Message:

see #13232 - cleanup OAuth signpost code:

  • remove classes unused by JOSM
  • add missing @Override annotations
Location:
trunk/src/oauth/signpost/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/oauth/signpost/http/HttpParameters.java

    r6849 r10831  
    3030 * A multi-map of HTTP request parameters. Each key references a
    3131 * {@link SortedSet} of parameters collected from the request during message
    32  * signing. Parameter values are sorted as per {@linkplain http
    33  * ://oauth.net/core/1.0a/#anchor13}. Every key/value pair will be
    34  * percent-encoded upon insertion. This class has special semantics tailored to
    35  * being useful for message signing; it's not a general purpose collection class
    36  * to handle request parameters.
    37  *
     32 * signing. Parameter values are sorted as per {@linkplain http://oauth.net/core/1.0a/#anchor13}.
     33 * Every key/value pair will be percent-encoded upon insertion.
     34 * This class has special semantics tailored to being useful for message signing;
     35 * it's not a general purpose collection class to handle request parameters.
     36 *
    3837 * @author Matthias Kaeppler
    3938 */
     
    4140public class HttpParameters implements Map<String, SortedSet<String>>, Serializable {
    4241
    43     private TreeMap<String, SortedSet<String>> wrappedMap = new TreeMap<String, SortedSet<String>>();
    44 
     42    private TreeMap<String, SortedSet<String>> wrappedMap = new TreeMap<>();
     43
     44    @Override
    4545    public SortedSet<String> put(String key, SortedSet<String> value) {
    4646        return wrappedMap.put(key, value);
     
    6262     * Convenience method to add a single value for the parameter specified by
    6363     * 'key'.
    64      * 
     64     *
    6565     * @param key
    6666     *        the parameter name
     
    7676     * Convenience method to add a single value for the parameter specified by
    7777     * 'key'.
    78      * 
     78     *
    7979     * @param key
    8080     *        the parameter name
     
    9191         SortedSet<String> values = wrappedMap.get(key);
    9292         if (values == null) {
    93              values = new TreeSet<String>();
     93             values = new TreeSet<>();
    9494             wrappedMap.put( key, values);
    9595         }
     
    105105     * Convenience method to allow for storing null values. {@link #put} doesn't
    106106     * allow null values, because that would be ambiguous.
    107      * 
     107     *
    108108     * @param key
    109109     *        the parameter name
     
    116116    }
    117117
     118    @Override
    118119    public void putAll(Map<? extends String, ? extends SortedSet<String>> m) {
    119120        wrappedMap.putAll(m);
     
    138139    /**
    139140     * Convenience method to merge a Map<String, List<String>>.
    140      * 
     141     *
    141142     * @param m
    142143     *        the map
     
    146147            SortedSet<String> vals = get(key);
    147148            if (vals == null) {
    148                 vals = new TreeSet<String>();
     149                vals = new TreeSet<>();
    149150                put(key, vals);
    150151            }
     
    153154    }
    154155
     156    @Override
    155157    public SortedSet<String> get(Object key) {
    156158        return wrappedMap.get(key);
     
    159161    /**
    160162     * Convenience method for {@link #getFirst(key, false)}.
    161      * 
     163     *
    162164     * @param key
    163165     *        the parameter name (must be percent encoded if it contains unsafe
     
    176178     * (that's because upon storing values in this map, keys get
    177179     * percent-encoded).
    178      * 
     180     *
    179181     * @param key
    180182     *        the parameter name (must be percent encoded if it contains unsafe
     
    196198     * Concatenates all values for the given key to a list of key/value pairs
    197199     * suitable for use in a URL query string.
    198      * 
     200     *
    199201     * @param key
    200202     *        the parameter name
     
    208210     * Concatenates all values for the given key to a list of key/value pairs
    209211     * suitable for use in a URL query string.
    210      * 
     212     *
    211213     * @param key
    212214     *        the parameter name
     
    237239        return sb.toString();
    238240    }
    239    
     241
    240242    public String getAsHeaderElement(String key) {
    241243        String value = getFirst(key);
     
    246248    }
    247249
     250    @Override
    248251    public boolean containsKey(Object key) {
    249252        return wrappedMap.containsKey(key);
    250253    }
    251254
     255    @Override
    252256    public boolean containsValue(Object value) {
    253257        for (Set<String> values : wrappedMap.values()) {
     
    259263    }
    260264
     265    @Override
    261266    public int size() {
    262267        int count = 0;
     
    267272    }
    268273
     274    @Override
    269275    public boolean isEmpty() {
    270276        return wrappedMap.isEmpty();
    271277    }
    272278
     279    @Override
    273280    public void clear() {
    274281        wrappedMap.clear();
    275282    }
    276283
     284    @Override
    277285    public SortedSet<String> remove(Object key) {
    278286        return wrappedMap.remove(key);
    279287    }
    280288
     289    @Override
    281290    public Set<String> keySet() {
    282291        return wrappedMap.keySet();
    283292    }
    284293
     294    @Override
    285295    public Collection<SortedSet<String>> values() {
    286296        return wrappedMap.values();
    287297    }
    288298
     299    @Override
    289300    public Set<Entry<String, SortedSet<String>>> entrySet() {
    290301        return wrappedMap.entrySet();
  • trunk/src/oauth/signpost/http/HttpRequest.java

    r4231 r10831  
    66
    77import oauth.signpost.OAuthConsumer;
    8 import oauth.signpost.basic.HttpURLConnectionRequestAdapter;
    98
    109/**
     
    1413 * currently supported, you'll have to write an adapter which implements this
    1514 * interface and a custom {@link OAuthConsumer} which performs the wrapping.
    16  *
    17  * @see HttpURLConnectionRequestAdapter
     15 *
    1816 * @author Matthias Kaeppler
    1917 */
     
    3836    /**
    3937     * Returns the wrapped request object, in case you must work directly on it.
    40      * 
     38     *
    4139     * @return the wrapped request object
    4240     */
Note: See TracChangeset for help on using the changeset viewer.