some more generics in client and friends
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@603312 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
87ff897181
commit
3337029c96
|
@ -49,7 +49,8 @@ import org.apache.http.params.HttpParams;
|
|||
*/
|
||||
public final class AuthSchemeRegistry {
|
||||
|
||||
private final Map registeredSchemes = new LinkedHashMap();
|
||||
private final Map<String,AuthSchemeFactory> registeredSchemes =
|
||||
new LinkedHashMap<String,AuthSchemeFactory>();
|
||||
|
||||
/**
|
||||
* Registers a {@link AuthSchemeFactory} with the given identifier. If a factory with the
|
||||
|
@ -108,7 +109,7 @@ public final class AuthSchemeRegistry {
|
|||
if (name == null) {
|
||||
throw new IllegalArgumentException("Name may not be null");
|
||||
}
|
||||
AuthSchemeFactory factory = (AuthSchemeFactory) registeredSchemes.get(name.toLowerCase());
|
||||
AuthSchemeFactory factory = registeredSchemes.get(name.toLowerCase());
|
||||
if (factory != null) {
|
||||
return factory.newInstance(params);
|
||||
} else {
|
||||
|
@ -122,8 +123,8 @@ public final class AuthSchemeRegistry {
|
|||
*
|
||||
* @return list of registered scheme names
|
||||
*/
|
||||
public synchronized List getSchemeNames() {
|
||||
return new ArrayList(registeredSchemes.keySet());
|
||||
public synchronized List<String> getSchemeNames() {
|
||||
return new ArrayList<String>(registeredSchemes.keySet());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,15 +114,15 @@ public final class HttpConnectionManagerParams {
|
|||
("The maximum must be greater than 0.");
|
||||
}
|
||||
|
||||
Map currentValues = (Map) params.getParameter
|
||||
(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
Map<Object,Integer> currentValues = (Map<Object,Integer>)
|
||||
params.getParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
// param values are meant to be immutable so we'll make a copy
|
||||
// to modify
|
||||
Map newValues = null;
|
||||
Map<Object,Integer> newValues = null;
|
||||
if (currentValues == null) {
|
||||
newValues = new HashMap();
|
||||
newValues = new HashMap<Object,Integer>();
|
||||
} else {
|
||||
newValues = new HashMap(currentValues);
|
||||
newValues = new HashMap<Object,Integer>(currentValues);
|
||||
}
|
||||
newValues.put(key, new Integer(max));
|
||||
params.setParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, newValues);
|
||||
|
@ -183,10 +183,10 @@ public final class HttpConnectionManagerParams {
|
|||
// if neither a specific nor a default maximum is configured...
|
||||
int result = DEFAULT_MAX_HOST_CONNECTIONS;
|
||||
|
||||
Map m = (Map) params.getParameter
|
||||
(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
Map<Object,Integer> m = (Map<Object,Integer>)
|
||||
params.getParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
if (m != null) {
|
||||
Integer max = (Integer) m.get(key);
|
||||
Integer max = m.get(key);
|
||||
if ((max == null) && (key != ROUTE_DEFAULT)) {
|
||||
// no specific maximum, get the configured default
|
||||
max = (Integer) m.get(ROUTE_DEFAULT);
|
||||
|
|
|
@ -50,11 +50,11 @@ import org.apache.http.params.HttpParams;
|
|||
*/
|
||||
public final class CookieSpecRegistry {
|
||||
|
||||
private final Map registeredSpecs;
|
||||
private final Map<String,CookieSpecFactory> registeredSpecs;
|
||||
|
||||
public CookieSpecRegistry() {
|
||||
super();
|
||||
this.registeredSpecs = new LinkedHashMap();
|
||||
this.registeredSpecs = new LinkedHashMap<String,CookieSpecFactory>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,7 @@ public final class CookieSpecRegistry {
|
|||
if (name == null) {
|
||||
throw new IllegalArgumentException("Name may not be null");
|
||||
}
|
||||
CookieSpecFactory factory = (CookieSpecFactory) registeredSpecs.get(name.toLowerCase());
|
||||
CookieSpecFactory factory = registeredSpecs.get(name.toLowerCase());
|
||||
if (factory != null) {
|
||||
return factory.newInstance(params);
|
||||
} else {
|
||||
|
@ -139,7 +139,7 @@ public final class CookieSpecRegistry {
|
|||
* @return list of registered cookie spec names
|
||||
*/
|
||||
public synchronized List getSpecNames(){
|
||||
return new ArrayList(registeredSpecs.keySet());
|
||||
return new ArrayList<String>(registeredSpecs.keySet());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue