public static boolean matches(Entry[] attrs, String opStringName) {
boolean matched = false;
for (Entry attr : attrs) {
if (attr.getClass().getName().equals(OperationalStringEntry.class.getName())) {
if (attr instanceof OperationalStringEntry) {
OperationalStringEntry oe = (OperationalStringEntry) attr;
if (oe.name.equals(opStringName)) {
logger.trace("Matched required {} with value of {}", oe.name, opStringName);
matched = true;
break;
} else {
logger.trace("Did not match required {} with value of {}", oe.name, opStringName);
}
} else {
/*
* This addresses the issue where the discovered service
* has an OperationalStringEntry but there is a class loading
* problem, which results in the classes being loaded by sibling
* class loaders, and assignment does not work.
*/
OperationalStringEntry oe = new OperationalStringEntry();
try {
Field name = attr.getClass().getDeclaredField("name");
oe.name = (String) name.get(attr);
if (oe.name.equals(opStringName)) {
logger.trace("Reflective matching: Matched required {} with value of {}", oe.name, opStringName);