@Override public int hashCode() { return super.getHashCode() + Objects.hashCode(getSchemaName()); }
private void setSingletonReferences(Bean bean, Map<String, Schema> schemas) { Schema s = bean.getSchema(); for (SchemaPropertyRef ref : s.get(SchemaPropertyRef.class)) { if (ref.isSingleton()) { Schema singletonSchema = schemas.get(ref.getSchemaName()); Optional<Bean> singleton = beanManager.getSingleton(ref.getSchemaName()); if (singleton.isPresent()) { singleton.get().set(singletonSchema); BeanId singletonId = singleton.get().getId(); singletonId.setBean(singleton.get()); // recursive call. setSingletonReferences(singleton.get(), schemas); bean.setReference(ref.getName(), singletonId); } } } }
public String getReferenceSchemaName(String propertyName) { for (AbstractSchemaProperty schema : properties.values()) { if (!schema.getFieldName().equals(propertyName)) { continue; } if (schema instanceof SchemaPropertyRef) { return ((SchemaPropertyRef) schema).getSchemaName(); } if (schema instanceof SchemaPropertyRefList) { return ((SchemaPropertyRefList) schema).getSchemaName(); } if (schema instanceof SchemaPropertyRefMap) { return ((SchemaPropertyRefMap) schema).getSchemaName(); } } return null; }
private void setSingletonReferences(Bean bean, Map<String, Schema> schemas) { Schema s = bean.getSchema(); for (SchemaPropertyRef ref : s.get(SchemaPropertyRef.class)) { if (ref.isSingleton()) { Schema singletonSchema = schemas.get(ref.getSchemaName()); Optional<Bean> singleton = beanManager.getSingleton(ref.getSchemaName()); if (!singleton.isPresent()) { initFile(null); Bean fileBean = FILE_CONFIG.get(BeanId.createSingleton(ref.getSchemaName())); if (fileBean != null) { singleton = Optional.of(fileBean); } } if (!singleton.isPresent()) { singleton = Optional.of(Bean.create(BeanId.createSingleton(ref.getSchemaName()))); } singleton.get().set(singletonSchema); BeanId singletonId = singleton.get().getId(); singletonId.setBean(singleton.get()); // recursive call. setSingletonReferences(singleton.get(), schemas); bean.setReference(ref.getName(), singletonId); } } }
private void setSingletonReferences(Bean bean, Map<String, Schema> schemas) { Schema s = bean.getSchema(); for (SchemaPropertyRef ref : s.get(SchemaPropertyRef.class)) { if (ref.isSingleton()) { Schema singletonSchema = schemas.get(ref.getSchemaName()); Bean singleton = beanManager.getSingleton(ref.getSchemaName()); singleton.set(singletonSchema); BeanId singletonId = singleton.getId(); singletonId.setBean(singleton); // recursive call. setSingletonReferences(singleton, schemas); bean.setReference(ref.getName(), singletonId); } } }
private void setSingletonReferences(Bean bean, Map<String, Schema> schemas) { Schema s = bean.getSchema(); for (SchemaPropertyRef ref : s.get(SchemaPropertyRef.class)) { if (ref.isSingleton()) { Schema singletonSchema = schemas.get(ref.getSchemaName()); Bean singleton = beanManager.getSingleton(ref.getSchemaName()); singleton.set(singletonSchema); BeanId singletonId = singleton.getId(); singletonId.setBean(singleton); // recursive call. setSingletonReferences(singleton, schemas); bean.setReference(ref.getName(), singletonId); } } }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaPropertyRef)) { return false; } SchemaPropertyRef o = (SchemaPropertyRef) obj; return equals(o) && equal(getSchemaName(), o.getSchemaName()); }
public XmlSchemaRef(SchemaPropertyRef p) { this.name = p.getName(); this.fieldName = p.getFieldName(); this.schemaName = p.getSchemaName(); this.desc = p.getDesc(); this.isImmutable = p.isImmutable(); this.isSingleton = p.isSingleton(); } }