Makes ProtocolProviderService#getOperationSet() type safe in order to shorten its uses which otherwise require casts and are usually excessively long, to make it less prone to errors because now the compiler takes care of checking (most of) the types. This change causes a lot of warnings about redundant casts but they are too much for me to fix in one go so I'll fix them over time.

cusax-fix
Lyubomir Marinov 17 years ago
parent fcb0040932
commit fff438a56e

@ -149,9 +149,10 @@ public Map<String, OperationSet> getSupportedOperationSets()
* @return returns an OperationSet of the specified <tt>Class</tt> if the
* undelying implementation supports it or null otherwise.
*/
public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass)
@SuppressWarnings("unchecked")
public <T extends OperationSet> T getOperationSet(Class<T> opsetClass)
{
return getSupportedOperationSets().get(opsetClass.getName());
return (T) getSupportedOperationSets().get(opsetClass.getName());
}
/**

@ -126,13 +126,14 @@ public void fireRegistrationStateChanged( RegistrationState oldState,
* this operation set is not supported by the provider implementation.
*
* @param opsetClass the <tt>Class</tt> of the operation set that we're
* looking for.
* @return returns an OperationSet of the specified <tt>Class</tt> if the
* undelying implementation supports it or null otherwise.
* looking for.
* @return returns an <tt>OperationSet</tt> of the specified <tt>Class</tt>
* if the undelying implementation supports it; <tt>null</tt>, otherwise.
*/
public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass)
@SuppressWarnings("unchecked")
public <T extends OperationSet> T getOperationSet(Class<T> opsetClass)
{
return doGetSupportedOperationSets().get(opsetClass.getName());
return (T) doGetSupportedOperationSets().get(opsetClass.getName());
}
/**

@ -153,7 +153,7 @@ public void removeRegistrationStateChangeListener(
* @return returns an OperationSet of the specified <tt>Class</tt> if the
* undelying implementation supports it or null otherwise.
*/
public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass);
public <T extends OperationSet> T getOperationSet(Class<T> opsetClass);
/**
* Makes the service implementation close all open sockets and release

Loading…
Cancel
Save