public <T> T lookup(Class<T> clazz) { for (Iterator i = allItems.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof AbstractLookup.Pair) { AbstractLookup.Pair<?> p = (AbstractLookup.Pair<?>)o; if (p.instanceOf(clazz)) { Object ret = p.getInstance(); if (clazz.isInstance(ret)) { return clazz.cast(ret); } } } } return null; }
Class<?> iface = entry.getKey(); if (item.instanceOf(iface)) { Object value = entry.getValue();
AbstractLookup.Pair it = (AbstractLookup.Pair) en.nextElement(); if (it.instanceOf(clazz)) {
Class<?> iface = entry.getKey(); if (item.instanceOf(iface)) { Object value = entry.getValue();
Class<?> iface = entry.getKey(); if (item.instanceOf(iface)) { Object value = entry.getValue();
Map.Entry entry = (Map.Entry)it.next (); Class iface = (Class)entry.getKey (); if (item.instanceOf (iface)) { Object value = entry.getValue (); if (value instanceof Collection) {
while (en.hasMoreElements ()) { AbstractLookup.Pair it = (AbstractLookup.Pair)en.nextElement (); if (it.instanceOf (clazz)) {
Map.Entry entry = (Map.Entry)it.next (); Class iface = (Class)entry.getKey (); if (item.instanceOf (iface)) { Object value = entry.getValue (); if (value instanceof Collection) {
/** A method that defines matching between Item and Template. * @param t template providing the criteria * @param item the item to match * @param deepCheck true if type of the pair should be tested, false if it is already has been tested * @return true if item matches the template requirements, false if not */ static boolean matches(Template<?> t, Pair<?> item, boolean deepCheck) { String id = t.getId(); if (id != null && !id.equals(item.getId())) { return false; } Object instance = t.getInstance(); if ((instance != null) && !item.creatorOf(instance)) { return false; } if (deepCheck) { return item.instanceOf(t.getType()); } else { return true; } }
/** A method that defines matching between Item and Template. * @param t template providing the criteria * @param item the item to match * @param deepCheck true if type of the pair should be tested, false if it is already has been tested * @return true if item matches the template requirements, false if not */ static boolean matches (Template t, Pair item, boolean deepCheck) { String id = t.getId (); if (id != null && !item.getId ().equals (id)) { return false; } Object instance = t.getInstance (); if (instance != null && !item.creatorOf (instance)) { return false; } if (deepCheck) { return item.instanceOf (t.getType ()); } else { return true; } }
/** A method that defines matching between Item and Template. * @param t template providing the criteria * @param item the item to match * @param deepCheck true if type of the pair should be tested, false if it is already has been tested * @return true if item matches the template requirements, false if not */ static boolean matches(Template<?> t, Pair<?> item, boolean deepCheck) { String id = t.getId(); if (id != null && !id.equals(item.getId())) { return false; } Object instance = t.getInstance(); if ((instance != null) && !item.creatorOf(instance)) { return false; } if (deepCheck) { return item.instanceOf(t.getType()); } else { return true; } }
/** A method that defines matching between Item and Template. * @param t template providing the criteria * @param item the item to match * @param deepCheck true if type of the pair should be tested, false if it is already has been tested * @return true if item matches the template requirements, false if not */ static boolean matches (Template t, Pair item, boolean deepCheck) { String id = t.getId (); if (id != null && !item.getId ().equals (id)) { return false; } Object instance = t.getInstance (); if (instance != null && !item.creatorOf (instance)) { return false; } if (deepCheck) { return item.instanceOf (t.getType ()); } else { return true; } }
public <T> T lookup(Class<T> clazz) { for (Iterator i = allItems.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof AbstractLookup.Pair) { AbstractLookup.Pair<?> p = (AbstractLookup.Pair<?>)o; if (p.instanceOf(clazz)) { Object ret = p.getInstance(); if (clazz.isInstance(ret)) { return clazz.cast(ret); } } } } return null; }
public <T> T lookup(Class<T> clazz) { for (Iterator i = allItems.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof AbstractLookup.Pair) { AbstractLookup.Pair<?> p = (AbstractLookup.Pair<?>)o; if (p.instanceOf(clazz)) { Object ret = p.getInstance(); if (clazz.isInstance(ret)) { return clazz.cast(ret); } } } } return null; }
/** Checks whether item is instance of this node. */ public boolean accepts (AbstractLookup.Pair item) { if (getType () == Object.class) { // Object.class return true; } return item.instanceOf (getType ()); }
/** Checks whether item is instance of this node. */ public boolean accepts (AbstractLookup.Pair item) { if (getType () == Object.class) { // Object.class return true; } return item.instanceOf (getType ()); }
/** Checks whether item is instance of this node. */ public boolean accepts(AbstractLookup.Pair<?> item) { if (getType() == Object.class) { // Object.class return true; } return item.instanceOf(getType()); }
/** Checks whether item is instance of this node. */ public boolean accepts(AbstractLookup.Pair<?> item) { if (getType() == Object.class) { // Object.class return true; } return item.instanceOf(getType()); }
/** A method that defines matching between Item and Template. * @param t template providing the criteria * @param item the item to match * @param deepCheck true if type of the pair should be tested, false if it is already has been tested * @return true if item matches the template requirements, false if not */ static boolean matches(Template<?> t, Pair<?> item, boolean deepCheck) { String id = t.getId(); if (id != null && !id.equals(item.getId())) { return false; } Object instance = t.getInstance(); if ((instance != null) && !item.creatorOf(instance)) { return false; } if (deepCheck) { return item.instanceOf(t.getType()); } else { return true; } }
/** Checks whether item is instance of this node. */ public boolean accepts(AbstractLookup.Pair<?> item) { if (getType() == Object.class) { // Object.class return true; } return item.instanceOf(getType()); }