Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions solid/src/main/java/com/inrupt/client/solid/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Metadata {

private final URI acl;
private final URI storage;
private final Set<URI> type = new HashSet<>();
private final Set<URI> types = new HashSet<>();
private final Map<String, Set<String>> wacAllow = new HashMap<>();
private final Set<String> allowedMethods = new HashSet<>();
private final Set<String> allowedPatchSyntaxes = new HashSet<>();
Expand All @@ -58,9 +58,23 @@ public Optional<URI> getStorage() {
* {@code rdf:type} data explicitly set on a resource.
*
* @return the type values for a resource
* @deprecated as of Beta3, please use the {@link #getTypes} method
*/
@Deprecated
public Set<URI> getType() {
return type;
return getTypes();
}

/**
* The Solid Resource types.
*
* <p>This data typically comes from HTTP Link headers and may be different than
* {@code rdf:type} data explicitly set on a resource.
*
* @return the type values for a resource
*/
public Set<URI> getTypes() {
return types;
}

/**
Expand Down Expand Up @@ -294,7 +308,7 @@ public Builder contentType(final String type) {
public Metadata build() {
final Metadata metadata = new Metadata(builderStorage, builderAcl, builderContentType);
metadata.wacAllow.putAll(builderWacAllow);
metadata.type.addAll(builderType);
metadata.types.addAll(builderType);
metadata.allowedMethods.addAll(builderAllowedMethods);
metadata.allowedPatchSyntaxes.addAll(builderAllowedPatchSyntaxes);
metadata.allowedPostSyntaxes.addAll(builderAllowedPostSyntaxes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void testGetOfSolidRDFSource() throws IOException, InterruptedException {
try (final SolidRDFSource resource = response.body()) {
assertEquals(uri, resource.getIdentifier());
assertTrue(resource.getMetadata().getType().contains(LDP.BasicContainer));
assertTrue(resource.getMetadata().getTypes().contains(LDP.BasicContainer));
assertEquals(Optional.of(URI.create("http://acl.example/solid/")),
resource.getMetadata().getAcl());
assertEquals(Optional.of(URI.create("http://storage.example/")),
Expand Down Expand Up @@ -116,6 +117,7 @@ void testCheckRootOfSolidRDFSource() throws IOException, InterruptedException {
try (final SolidRDFSource resource = response.body()) {
assertEquals(uri, resource.getIdentifier());
assertTrue(resource.getMetadata().getType().contains(LDP.BasicContainer));
assertTrue(resource.getMetadata().getTypes().contains(LDP.BasicContainer));
assertEquals(Optional.of(URI.create("http://acl.example/")),
resource.getMetadata().getAcl());
assertEquals(Optional.of(uri), resource.getMetadata().getStorage());
Expand Down