mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Fix minor codestyle issues
This commit is contained in:
parent
200f90ffdc
commit
cb18056613
422 changed files with 1404 additions and 1444 deletions
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
|||
|
||||
|
||||
/**
|
||||
* The NodeInformationProvider is responsible for providing supported indentities, features
|
||||
* The NodeInformationProvider is responsible for providing supported identities, features
|
||||
* and hosted items (i.e. DiscoverItems.Item) about a given node. This information will be
|
||||
* requested each time this XMPPP client receives a disco info or items requests on the
|
||||
* given node. each time this XMPPP client receives a disco info or items requests on the
|
||||
|
|
@ -56,7 +56,7 @@ public interface NodeInformationProvider {
|
|||
List<String> getNodeFeatures();
|
||||
|
||||
/**
|
||||
* Returns a list of the indentites defined in the node. For
|
||||
* Returns a list of the identities defined in the node. For
|
||||
* example, the x-command protocol must provide an identity of
|
||||
* category automation and type command-node for each command.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -78,17 +78,16 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
private static DiscoverInfo.Identity defaultIdentity = new Identity(DEFAULT_IDENTITY_CATEGORY,
|
||||
DEFAULT_IDENTITY_NAME, DEFAULT_IDENTITY_TYPE);
|
||||
|
||||
private Set<DiscoverInfo.Identity> identities = new HashSet<DiscoverInfo.Identity>();
|
||||
private final Set<DiscoverInfo.Identity> identities = new HashSet<>();
|
||||
private DiscoverInfo.Identity identity = defaultIdentity;
|
||||
|
||||
private EntityCapsManager capsManager;
|
||||
|
||||
private static Map<XMPPConnection, ServiceDiscoveryManager> instances = new WeakHashMap<>();
|
||||
private static final Map<XMPPConnection, ServiceDiscoveryManager> instances = new WeakHashMap<>();
|
||||
|
||||
private final Set<String> features = new HashSet<String>();
|
||||
private final Set<String> features = new HashSet<>();
|
||||
private DataForm extendedInfo = null;
|
||||
private Map<String, NodeInformationProvider> nodeInformationProviders =
|
||||
new ConcurrentHashMap<String, NodeInformationProvider>();
|
||||
private final Map<String, NodeInformationProvider> nodeInformationProviders = new ConcurrentHashMap<>();
|
||||
|
||||
// Create a new ServiceDiscoveryManager on every established connection
|
||||
static {
|
||||
|
|
@ -270,7 +269,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
* @return all identies as set
|
||||
*/
|
||||
public Set<DiscoverInfo.Identity> getIdentities() {
|
||||
Set<Identity> res = new HashSet<Identity>(identities);
|
||||
Set<Identity> res = new HashSet<>(identities);
|
||||
// Add the default identity that must exist
|
||||
res.add(defaultIdentity);
|
||||
return Collections.unmodifiableSet(res);
|
||||
|
|
@ -368,7 +367,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
* @return a List of the supported features by this XMPP entity.
|
||||
*/
|
||||
public synchronized List<String> getFeatures() {
|
||||
return new ArrayList<String>(features);
|
||||
return new ArrayList<>(features);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -455,7 +454,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
public List<ExtensionElement> getExtendedInfoAsList() {
|
||||
List<ExtensionElement> res = null;
|
||||
if (extendedInfo != null) {
|
||||
res = new ArrayList<ExtensionElement>(1);
|
||||
res = new ArrayList<>(1);
|
||||
res.add(extendedInfo);
|
||||
}
|
||||
return res;
|
||||
|
|
@ -748,7 +747,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
* Create a cache to hold the 25 most recently lookup services for a given feature for a period
|
||||
* of 24 hours.
|
||||
*/
|
||||
private Cache<String, List<DiscoverInfo>> services = new ExpirationCache<>(25,
|
||||
private final Cache<String, List<DiscoverInfo>> services = new ExpirationCache<>(25,
|
||||
24 * 60 * 60 * 1000);
|
||||
|
||||
/**
|
||||
|
|
@ -784,7 +783,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
*/
|
||||
public List<DiscoverInfo> findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache, Map<? super Jid, Exception> encounteredExceptions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
List<DiscoverInfo> serviceDiscoInfo = null;
|
||||
List<DiscoverInfo> serviceDiscoInfo;
|
||||
DomainBareJid serviceName = connection().getXMPPServiceDomain();
|
||||
if (useCache) {
|
||||
serviceDiscoInfo = services.lookup(feature);
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
|||
public static final String ELEMENT = QUERY_ELEMENT;
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/disco#info";
|
||||
|
||||
private final List<Feature> features = new LinkedList<Feature>();
|
||||
private final Set<Feature> featuresSet = new HashSet<Feature>();
|
||||
private final List<Identity> identities = new LinkedList<Identity>();
|
||||
private final Set<String> identitiesSet = new HashSet<String>();
|
||||
private final List<Feature> features = new LinkedList<>();
|
||||
private final Set<Feature> featuresSet = new HashSet<>();
|
||||
private final List<Identity> identities = new LinkedList<>();
|
||||
private final Set<String> identitiesSet = new HashSet<>();
|
||||
private String node;
|
||||
private boolean containsDuplicateFeatures;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
|||
* @return a list of Identites with the given category and type.
|
||||
*/
|
||||
public List<Identity> getIdentities(String category, String type) {
|
||||
List<Identity> res = new ArrayList<Identity>(identities.size());
|
||||
List<Identity> res = new ArrayList<>(identities.size());
|
||||
for (Identity identity : identities) {
|
||||
if (identity.getCategory().equals(category) && identity.getType().equals(type)) {
|
||||
res.add(identity);
|
||||
|
|
@ -208,7 +208,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
|||
* Returns true if the specified feature is part of the discovered information.
|
||||
*
|
||||
* @param feature the feature to check
|
||||
* @return true if the requestes feature has been discovered
|
||||
* @return true if the requests feature has been discovered
|
||||
*/
|
||||
public boolean containsFeature(CharSequence feature) {
|
||||
return features.contains(new Feature(feature));
|
||||
|
|
@ -234,7 +234,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
|||
* @return true if duplicate identities where found, otherwise false
|
||||
*/
|
||||
public boolean containsDuplicateIdentities() {
|
||||
List<Identity> checkedIdentities = new LinkedList<Identity>();
|
||||
List<Identity> checkedIdentities = new LinkedList<>();
|
||||
for (Identity i : identities) {
|
||||
for (Identity i2 : checkedIdentities) {
|
||||
if (i.equals(i2))
|
||||
|
|
@ -472,7 +472,7 @@ public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Represents the features offered by the item. This information helps requestors determine
|
||||
* Represents the features offered by the item. This information helps the requester to determine
|
||||
* what actions are possible with regard to this item (registration, search, join, etc.)
|
||||
* as well as specific feature types of interest, if any (e.g., for the purpose of feature
|
||||
* negotiation).
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class DiscoverItems extends IQ {
|
|||
public static final String ELEMENT = QUERY_ELEMENT;
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/disco#items";
|
||||
|
||||
private final List<Item> items = new LinkedList<Item>();
|
||||
private final List<Item> items = new LinkedList<>();
|
||||
private String node;
|
||||
|
||||
public DiscoverItems() {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
|
|||
throws Exception {
|
||||
DiscoverInfo discoverInfo = new DiscoverInfo();
|
||||
boolean done = false;
|
||||
DiscoverInfo.Identity identity = null;
|
||||
DiscoverInfo.Identity identity;
|
||||
String category = "";
|
||||
String identityName = "";
|
||||
String type = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue