/** * Register the methods of a class. This will automatically construct * instances as necessary. * * @param cls the class to register * @param parent the parent method * @return Commands Registered */ public List<Command> registerMethods(Class<?> cls, Method parent) { try { if (getInjector() == null) { return registerMethods(cls, parent, null); } else { Object obj = getInjector().getInstance(cls); return registerMethods(cls, parent, obj); } } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { logger.log(Level.SEVERE, "Failed to register commands", e); } return null; }
if(provider == null && injector != null) { provider = injector.getProviderOrNull(cls); if(provider == null) { if(instance == null) { instance = (C) injector.getInstance(cls); instances.put(cls, instance);