/** * Returns the strategy applicable for the given class or <code>null</code> if no such strategy * is found. A strategy that applies strictly to the given class is always preferable. If no * such strategy is available then the range strategies are checked for applicability. Backup * strategies, if applicable, are returned as a last resort. * * @param target to lookup strategy for * @return the applicable strategy or null */ public S lookup(Class target) { final S ss = this.strict.get(target); if (ss != null) { return ss; // found strict. } for (S rs : this.range) { if (rs.appliesTo(target)) { return rs; // found range. } } if (this.backup != null) { for (S bs : this.backup) { if (bs.appliesTo(target)) { return bs; // found backup. } } } return null; }