use of com.linkedin.restli.restspec.AlternativeKeySchemaArray in project rest.li by linkedin.
the class ResourceModelEncoder method appendAlternativeKeys.
public void appendAlternativeKeys(CollectionSchema rootNode, ResourceModel resourceModel) {
Map<String, AlternativeKey<?, ?>> alternativeKeys = resourceModel.getAlternativeKeys();
if (!alternativeKeys.isEmpty()) {
AlternativeKeySchemaArray altKeyArray = new AlternativeKeySchemaArray();
for (Map.Entry<String, AlternativeKey<?, ?>> entry : alternativeKeys.entrySet()) {
AlternativeKeySchema altKeySchema = new AlternativeKeySchema();
altKeySchema.setName(entry.getKey());
altKeySchema.setType(buildDataSchemaType(entry.getValue().getType()));
altKeySchema.setKeyCoercer(entry.getValue().getKeyCoercer().getClass().getCanonicalName());
altKeyArray.add(altKeySchema);
}
rootNode.setAlternativeKeys(altKeyArray);
}
}
Aggregations