public Method getInvocableMethod(Method method) { for (ComponentProvider componentProvider : providers) { if (componentProvider.isApplicable(method.getDeclaringClass())) { return componentProvider.getInvocableMethod(method); } } return method; }
private <T> Object getInstance(Class<T> clazz) throws InstantiationException { for (ComponentProvider componentProvider : providers) { if (componentProvider.isApplicable(clazz)) { final Object t = componentProvider.create(clazz); if (t != null) { return t; } } } throw new InstantiationException( LocalizationMessages.COMPONENT_PROVIDER_NOT_FOUND(clazz.getName())); }
/** * Remove {@link Session} from cache. * * @param session to be removed. */ public void removeSession(Session session) { final Map<Class<?>, Object> classObjectMap = sessionToObject.get(session); if (classObjectMap != null) { synchronized (classObjectMap) { for (Object o : classObjectMap.values()) { if (o instanceof Encoder) { ((Encoder) o).destroy(); } else if (o instanceof Decoder) { ((Decoder) o).destroy(); } for (ComponentProvider componentProvider : providers) { if (componentProvider.destroy(o)) { break; } } } } } sessionToObject.remove(session); }