public SchemaPropertyRefMap(Schema.SchemaPropertyRefMap schema) { super(schema); this.schemaName = schema.getSchemaName(); this.classType = schema.getClassType().getName(); this.mapType = schema.getMapType(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaPropertyRefMap)) { return false; } SchemaPropertyRefMap o = (SchemaPropertyRefMap) obj; return equals(o) && equal(getMapType(), o.getMapType()) && equal(getSchemaName(), o.getSchemaName()); }
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()); } }
schemaName = refMap.getSchemaName();
return SchemaPropertyRefMap.create(name, fieldName, getSchemaName(type), type, desc, source.isFinal(), source.getMapRawType().getName(), indexed); } else {
private void convertPropertyRefMap(Bean source, Map<String, Object> values, Map<BeanId, Object> instanceCache) { for (SchemaPropertyRefMap prop : source.getSchema().get(SchemaPropertyRefMap.class)) { List<BeanId> beans = source.getReference(prop.getName()); if (beans == null) { continue; } Map<Object, Object> c = newMap(loadClass(prop.getMapType())); for (BeanId beanId : beans) { Bean b = beanId.getBean(); if (b != null) { Object beanInstance = instanceCache.get(beanId); if (beanInstance == null) { try { beanInstance = newInstance(loadClass(b.getSchema().getType())); } catch (Exception e) { throw new UnsupportedOperationException(e); } beanInstance = convert(b, beanInstance, new HashMap<String, Object>(), instanceCache); } c.put(beanId.getInstanceId(), beanInstance); } } values.put(prop.getFieldName(), c); } }
public String getReferenceSchemaName(String propertyName) { for (AbstractSchemaProperty schema : properties.values()) { if (!schema.getName().equals(propertyName)) { 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; }
public String getReferenceSchemaName(String propertyName) { for (AbstractSchemaProperty schema : properties.values()) { if (!schema.getName().equals(propertyName)) { 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; }
public Schema.AbstractSchemaProperty toSchema() { return Schema.SchemaPropertyRefMap.create(getName(), getFieldName(), getSchemaName(), getClassType(), getDesc(), isImmutable(), getMapType(), false); } }
/** * Not to be used by users. */ public static SchemaPropertyRefMap create(final String name, final String fieldName, final String schemaName, final Class<?> classType, final String desc, final boolean isImmutable, final String mapType, final boolean indexed) { return new SchemaPropertyRefMap(name, fieldName, schemaName, classType, desc, isImmutable, mapType, indexed); }
@Override public String toString() { return toStringHelper(SchemaPropertyRefList.class).add("mapType", getMapType()) .add("schema-name", getSchemaName()).toString(); }
@Override public String toString() { return toStringHelper(SchemaPropertyRefList.class).add("mapType", getMapType()) .add("schema-name", getSchemaName()).toString(); }
/** * Not to be used by users. */ public static SchemaPropertyRefMap create(final String name, final String fieldName, final String schemaName, final Class<?> classType, final String desc, final boolean isImmutable, final String mapType, final boolean indexed) { return new SchemaPropertyRefMap(name, fieldName, schemaName, classType, desc, isImmutable, mapType, indexed); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaPropertyRefMap)) { return false; } SchemaPropertyRefMap o = (SchemaPropertyRefMap) obj; return equals(o) && equal(getMapType(), o.getMapType()) && equal(getSchemaName(), o.getSchemaName()); }