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