@@ -0,0 +1,2247 @@
+package org.xcolab.util.http.client;%0A%0Aimport org.xcolab.util.http.UriBuilder;%0Aimport org.xcolab.util.http.client.enums.ResourceEnum;%0Aimport org.xcolab.util.http.client.enums.ServiceNamespace;%0Aimport org.xcolab.util.http.client.interfaces.IdentifiableHttpResource;%0A%0A/**%0A * A virtual rest resource that does not require type information as it is never queried.%0A *%0A * This class serves as a placeholder for other services' entities in nested resource calls. These%0A * resources can be used as a parent for a %7B@link RestResource2%7D and can then be used to resolve%0A * the corresponding %7B@link QueryId%7D when a call is made to the nested resource.%0A *%0A * @param %3CResourceT%3E The resource type of the nested object. Usually either an entity in another%0A * service or %7B@link Void%7D.%0A * @param %3CIdT%3E The type of the resource identifier. Often a %7B@link Long%7D or %7B@link String%7D.%0A */%0Apublic class VirtualRestResource%3CResourceT, IdT%3E%0A        implements IdentifiableHttpResource%3CResourceT, IdT%3E %7B%0A%0A    private final ResourceEnum resourceEnum;%0A    private final ServiceNamespace serviceNamespace;%0A%0A    private VirtualRestResource(ResourceEnum resourceEnum, ServiceNamespace serviceNamespace) %7B%0A        this.resourceEnum = resourceEnum;%0A        this.serviceNamespace = serviceNamespace;%0A    %7D%0A%0A    public static %3CResourceT, IdT%3E VirtualRestResource%3CResourceT, IdT%3E of(%0A            ResourceEnum resourceEnum) %7B%0A        return new VirtualRestResource%3C%3E(resourceEnum, ServiceNamespace.instance());%0A    %7D%0A%0A    public static %3CResourceT, IdT%3E VirtualRestResource%3CResourceT, IdT%3E of(ResourceEnum resourceEnum,%0A            ServiceNamespace serviceNamespace) %7B%0A        return new VirtualRestResource%3C%3E(resourceEnum, serviceNamespace);%0A    %7D%0A%0A    @Override%0A    public QueryId%3CResourceT, IdT%3E id(IdT id) %7B%0A        return new QueryId%3C%3E(this, id);%0A    %7D%0A%0A    @Override%0A    public UriBuilder getResourceUrl() %7B%0A        return getBaseUrl().resource(resourceEnum.getResourceName());%0A    %7D%0A%0A    @Override%0A    public UriBuilder getResourceUrl(Object resourceId) %7B%0A        return getBaseUrl().resource(resourceEnum.getResourceName(), resourceId);%0A    %7D%0A%0A    @Override%0A    public UriBuilder getBaseUrl() %7B%0A        return resourceEnum.getCoLabService().getBaseUrl(serviceNamespace);%0A    %7D%0A%7D%0A

Create VirtualRestResource to allow creating nested resources with entities of other services