/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(Class<?> clazz) { return buildModel(clazz.getName()); }
@Deprecated public ConfigModel getModel(Class c) { return buildModel(c); }
/** * Allocate a new ConfigBean object as part of the Transaction * associated with this configuration object. This will eventually * be moved to a factory. * * @param type the request configuration object type * @return the properly constructed configuration object */ public ConfigBean allocate(Class<?> type) { return (ConfigBean) document.make(getHabitat(), null, this, document.buildModel(type)); }
/** * Obtains the {@link ConfigModel} from the "global" element name. * * <p> * This method uses {@link #buildModel} to lazily build models if necessary. * * @return * Null if no configurable component is registered under the given global element name. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public ConfigModel getModelByElementName(String elementName) { ActiveDescriptor<?> i = habitat.getBestDescriptor( BuilderHelper.createNameAndContractFilter(ConfigInjector.class.getName(), elementName)); if(i==null) return null; return buildModel((ActiveDescriptor<? extends ConfigInjector>) i); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(String fullyQualifiedClassName) { ActiveDescriptor<? extends ConfigInjector<?>> desc; synchronized (cache) { desc = cache.get(fullyQualifiedClassName); if (desc == null) { desc = (ActiveDescriptor<? extends ConfigInjector<?>>) habitat.getBestDescriptor(new InjectionTargetFilter(fullyQualifiedClassName)); if (desc == null) { throw new ConfigurationException("ConfigInjector for %s is not found, is it annotated with @Configured",fullyQualifiedClassName); } cache.put(fullyQualifiedClassName, desc); } } return buildModel(desc); }
ConfigModel model = document.buildModel(value); prop = collection?new CollectionNode(model,elementName):new SingleNode(model,elementName);
/** * probably a bit slow, calculates all the @Configured interfaces subclassing, useful * to find all possible subclasses of a type. * * @throws ClassNotFoundException */ private void initXRef() throws ClassNotFoundException { // force initialization of all the config models. for (ServiceHandle<?> i : habitat.getAllServiceHandles(ConfigInjector.class)) { buildModel((ActiveDescriptor<? extends ConfigInjector>) i.getActiveDescriptor()); } for (ConfigModel cm : models.values()) { Class targetType = cm.classLoaderHolder.loadClass(cm.targetTypeName); do { Class[] intfs = targetType.getInterfaces(); for (Class intf : intfs) { if (intf.isAnnotationPresent(Configured.class)) { addXRef(intf, cm); } } targetType = targetType.getSuperclass(); } while (targetType!=null); } }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(Class<?> clazz) { return buildModel(clazz.getName()); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(Class<?> clazz) { return buildModel(clazz.getName()); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(Class<?> clazz) { return buildModel(clazz.getName()); }
@Deprecated public ConfigModel getModel(Class c) { return buildModel(c); }
@Deprecated public ConfigModel getModel(Class c) { return buildModel(c); }
@Deprecated public ConfigModel getModel(Class c) { return buildModel(c); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(Class<?> clazz) { return buildModel(clazz.getName()); }
/** * Allocate a new ConfigBean object as part of the Transaction * associated with this configuration object. This will eventually * be moved to a factory. * * @param type the request configuration object type * @return the properly constructed configuration object */ public ConfigBean allocate(Class<?> type) { return (ConfigBean) document.make(habitat, null, this, document.buildModel(type)); }
/** * Allocate a new ConfigBean object as part of the Transaction * associated with this configuration object. This will eventually * be moved to a factory. * * @param type the request configuration object type * @return the properly constructed configuration object */ public ConfigBean allocate(Class<?> type) { return (ConfigBean) document.make(habitat, null, this, document.buildModel(type)); }
/** * Allocate a new ConfigBean object as part of the Transaction * associated with this configuration object. This will eventually * be moved to a factory. * * @param type the request configuration object type * @return the properly constructed configuration object */ public ConfigBean allocate(Class<?> type) { return (ConfigBean) document.make(getHabitat(), null, this, document.buildModel(type)); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(String fullyQualifiedClassName) { Inhabitant i = habitat.getInhabitantByAnnotation(InjectionTarget.class, fullyQualifiedClassName); if(i==null) throw new ComponentException("ConfigInjector for %s is not found, is it annotated with @Configured",fullyQualifiedClassName); return buildModel(i); }
/** * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.) */ public ConfigModel buildModel(String fullyQualifiedClassName) { Inhabitant i = habitat.getInhabitantByAnnotation(InjectionTarget.class, fullyQualifiedClassName); if(i==null) throw new ComponentException("ConfigInjector for %s is not found, is it annotated with @Configured",fullyQualifiedClassName); return buildModel(i); }
/** * Allocate a new ConfigBean object as part of the Transaction * associated with this configuration object. This will eventually * be moved to a factory. * * @param type the request configuration object type * @return the properly constructed configuration object */ public ConfigBean allocate(Class<?> type) { return (ConfigBean) document.make(getHabitat(), null, this, document.buildModel(type)); }