Skip to content

Commit

Permalink
[Minor] Removed DefaultRuntimeRegistry.exists(String, Class)
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed Feb 8, 2024
1 parent 69393bf commit abd8ee4
Showing 1 changed file with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
Expand Down Expand Up @@ -171,27 +173,6 @@ public synchronized boolean exists(int address) {
return Collections.unmodifiableMap(this.instances);
}

/** {@inheritDoc} */
public synchronized boolean exists(String id, Class<? extends IO> type){
String _id = null;
try {
_id = validateId(id);

// return 'false' if the requested ID is not found
if(!instances.containsKey(_id))
return false;

// get the I/O instance
IO instance = instances.get(id);

// return true if the I/O instance matches the requested I/O type
return type.isAssignableFrom(instance.getClass());
} catch (IOInvalidIDException e) {
return false;
}
}


private String validateId(String id) throws IOInvalidIDException {
if(id == null)
throw new IOInvalidIDException();
Expand Down

0 comments on commit abd8ee4

Please sign in to comment.