/** * Get named child string value or null if child not found or it has no value. * * @param name name of the child to retrieve value from. * @return named child string value, possible null. */ public String getChildValue(String name) { Config child = getChild(name); return child != null ? child.getValue() : null; }
} else { for (int i = 0; i < descriptor.getChildrenCount(); ++i) { String interfaceName = descriptor.getChild(i).getAttribute("name"); if (interfaceName == null) { throw new ConfigException("Missing <name> attribute from interface declaration. See class descriptor |%s|.", descriptor);
Config pojoClassesSection = config.getChild("pojo-classes"); if (pojoClassesSection == null) { return; throw new ConfigException("Invalid POJO class element. Missing <class> attribute."); Config configSection = config.getChild(pojoClassElement.getName()); Class<?> pojoClass = Classes.forOptionalName(pojoClassName); if (pojoClass == null) {
@Override public void config(Config config) throws ConfigException { super.config(config); // by convention configuration object name is the web application name appName = config.getName(); privateDir = server.getAppDir(appName); if (!privateDir.exists()) { privateDir.mkdir(); } Config loginConfig = config.getChild("login"); if (loginConfig != null) { loginRealm = loginConfig.getProperty("realm", appName); loginPage = loginConfig.getProperty("page"); if (loginPage != null && !loginPage.startsWith("/")) { loginPage = Strings.concat('/', appName, '/', loginPage); } } }
/** * Loads this managed class state from class descriptor then delegates {@link #scanAnnotations()}. Annotations scanning is * performed only if this managed class type requires implementation, see {@link InstanceType#requiresImplementation()}. * * @param container parent container, * @param descriptor class descriptor from <code>managed-class</code> section. * @throws ConfigException if configuration is invalid. */ public ManagedClass(Container container, Config descriptor) throws ConfigException { this.container = container; // if configuration section is missing this.config field remains null this.config = descriptor.getRoot().getChild(descriptor.getName()); // loading order matters; do not change it this.instanceScope = loadInstanceScope(descriptor); this.instanceType = loadInstanceType(descriptor); this.implementationClass = loadImplementationClass(descriptor); this.interfaceClasses = loadInterfaceClasses(descriptor); this.implementationURL = loadImplementationURL(descriptor); // get declared constructor return null if no implementation class this.constructor = getDeclaredConstructor(this.implementationClass); // scan dependencies return empty collection if no implementation class this.dependencies = scanDependencies(this.implementationClass); if (this.instanceType.requiresImplementation()) { scanAnnotations(); initializeStaticFields(); } this.key = Integer.toString(KEY_SEED.getAndIncrement()); this.string = buildStringRepresentation(descriptor); }
Config section = config.getChild("converters"); if (section == null) { return;