/** * Creates a collection resource, embedding the components in a rel name derived from the component type * simple class name. The class name is lower-cased and pluralized in order to create the rel name. * * @param components the objects to embed. They will be converted to Resource instances also. * @param componentType the object type of the components. * @param contentType the desired content type of the resource (e.g. "application/hal+json") * @return a new Resource instance with the collection embedded (as Resources). */ public static Resource createCollectionResource(Collection<?> components, Class<?> componentType, String contentType) { return INSTANCE._createCollectionResource(components, componentType, contentType); }
/** * Creates a collection resource, embedding the components in the given componentRel name. * * @param components the objects to embed. They will be converted to Resource instances also. * @param componentType the object type of the components. * @param componentRel the 'rel' name to use when embedding the resources. * @param contentType the desired content type of the resource (e.g. "application/hal+json") * @return a new Resource instance with the collection embedded (as Resources). */ public static Resource createCollectionResource(Collection<?> components, Class<?> componentType, String componentRel, String contentType) { return INSTANCE._createCollectionResource(components, componentType, componentRel, contentType); }
/** * Creates a collection resource, embedding the components in a rel name derived from the component type * simple class name. The class name is lower-cased and pluralized in order to create the rel name. * * @param components * @param componentType * @param contentType * @return a new Resource instance with the collection embedded (as Resources). */ private Resource _createCollectionResource(Collection<?> components, Class<?> componentType, String contentType) { String componentRel = relationshipDefinition.getCollectionRelFor(componentType); return _createCollectionResource(components, componentType, componentRel, contentType); }