private Descriptor buildItemResourceDescriptor( RootResourceInformation resourceInformation, Descriptor representationDescriptor, HttpMethod method) { PersistentEntity<?, ?> entity = resourceInformation.getPersistentEntity(); ResourceMetadata metadata = mappings.getMetadataFor(entity.getType()); return descriptor() . // id(prefix(method).concat(metadata.getItemResourceRel())) . // name(metadata.getItemResourceRel()) . // type(getType(method)) . // doc(getDocFor(metadata.getItemResourceDescription())) . // rt("#".concat(representationDescriptor.getId())) . // descriptors(getProjectionDescriptor(entity.getType(), method)) . // build(); }
private Descriptor buildRepresentationDescriptor(Class<?> type) { ResourceMetadata metadata = mappings.getMetadataFor(type); return descriptor() . // id(getRepresentationDescriptorId(metadata)) . // href(entityLinks.linkFor(type).slash("schema").toString()) . // doc(getDocFor(metadata.getItemResourceDescription())) . // descriptors(buildPropertyDescriptors(type, metadata.getItemResourceRel())) . // build(); }
private static String getRepresentationDescriptorId(ResourceMetadata metadata) { return metadata.getItemResourceRel().concat("-representation"); }