Config schemaConfig = config.getConfig(schemaName); Bean bean; if (schema.getId().isSingleton()) { bean = Bean.create(BeanId.createSingleton(schema.getName())); constructBean(schemaConfig, schema, bean, schemas);
public List<Bean> list(Schema schema, Map<String, Schema> schemas) { List<Bean> beans = new ArrayList<>(); Config schemaConfig; try { String schemaName = schema.getName().replaceAll("\\$", "\\."); schemaConfig = config.getConfig(schemaName); if (schemaConfig == null) { return beans; } } catch (Exception e) { return beans; } if (schema.getId().isSingleton()) { final Bean bean = Bean.create(BeanId.createSingleton(schema.getName())); beans.add(bean); constructBean(schemaConfig, schema, bean, schemas); } else { for (Object instanceId : schemaConfig.root().keySet()) { Config instance = schemaConfig.getConfig(instanceId.toString()); final Bean bean = Bean.create(BeanId.create(instanceId.toString(), schema.getName())); beans.add(bean); constructBean(instance, schema, bean, schemas); } } return beans; }
public JaxrsSchema(Schema schema) { this.schemaName = schema.getName(); this.className = schema.getType(); this.desc = schema.getDesc(); this.idName = schema.getId().getName(); this.idDesc = schema.getId().getDesc(); this.singleton = schema.getId().isSingleton(); for (Schema.SchemaProperty prop : schema.get(Schema.SchemaProperty.class)) { property.add(new SchemaProperty(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyList prop : schema.get(Schema.SchemaPropertyList.class)) { propertyList.add(new SchemaPropertyList(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRef prop : schema.get(Schema.SchemaPropertyRef.class)) { propertyRef.add(new SchemaPropertyRef(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRefList prop : schema.get(Schema.SchemaPropertyRefList.class)) { propertyRefList.add(new SchemaPropertyRefList(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRefMap prop : schema.get(Schema.SchemaPropertyRefMap.class)) { propertyRefMap.add(new SchemaPropertyRefMap(prop)); propertyNames.add(prop.getName()); } }
throw Events.CFG101_SCHEMA_NOT_EXIST(schemaName); if (refSchema.getId().isSingleton()) { BeanId id = BeanId.createSingleton(refSchema.getName()); Optional<Bean> optional = get(id, schemas);
public Bean toBean(Schema schema) { final BeanId id; if (schema.getId().isSingleton()) { id = BeanId.createSingleton(schema.getName()); } else {
private Object convert(Bean source, Object instance, Map<String, Object> valuesToInject, Map<BeanId, Object> instanceCache) { instanceCache.put(source.getId(), instance); convertProperty(source, valuesToInject); convertPropertyList(source, valuesToInject); convertPropertyRef(source, valuesToInject, instanceCache); convertPropertyRefList(source, valuesToInject, instanceCache); convertPropertyRefMap(source, valuesToInject, instanceCache); Schema schema = source.getSchema(); if (!schema.getId().isSingleton()) { // do not try to inject lookup id: the field is static final valuesToInject.put(getIdField(instance.getClass()), source.getId().getInstanceId()); } inject(instance, valuesToInject); return instance; }