Skip to content

Commit bef549d

Browse files
committed
Additional javadocs
1 parent 0bc4c26 commit bef549d

File tree

3 files changed

+50
-23
lines changed

3 files changed

+50
-23
lines changed

acp/src/main/java/com/inrupt/client/acp/Matcher.java

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
*/
2121
package com.inrupt.client.acp;
2222

23-
import static com.inrupt.client.vocabulary.RDF.type;
23+
import static com.inrupt.client.acp.AccessControlResource.asIRI;
2424

25-
import com.inrupt.client.spi.RDFFactory;
2625
import com.inrupt.client.vocabulary.ACP;
26+
import com.inrupt.client.vocabulary.RDF;
2727
import com.inrupt.rdf.wrapping.commons.TermMappings;
2828
import com.inrupt.rdf.wrapping.commons.ValueMappings;
2929
import com.inrupt.rdf.wrapping.commons.WrapperIRI;
@@ -33,48 +33,74 @@
3333

3434
import org.apache.commons.rdf.api.Graph;
3535
import org.apache.commons.rdf.api.IRI;
36-
import org.apache.commons.rdf.api.RDF;
3736
import org.apache.commons.rdf.api.RDFTerm;
3837

38+
/**
39+
* A Matcher type for use with Access Control Policies.
40+
*
41+
* <p>A matcher is associated with {@link Policy} objects, defining
42+
* agents, clients, issuers or verifiable credential (vc) types.
43+
*/
3944
public class Matcher extends WrapperIRI {
4045

41-
static final RDF rdf = RDFFactory.getInstance();
42-
43-
public Matcher(final RDFTerm original, final Graph graph) {
44-
super(original, graph);
45-
graph.add((IRI) original, rdf.createIRI(type.toString()), rdf.createIRI(ACP.Matcher.toString()));
46+
/**
47+
* Create a new Matcher.
48+
*
49+
* @param identifier the matcher identifier
50+
* @param graph the underlying graph
51+
*/
52+
public Matcher(final RDFTerm identifier, final Graph graph) {
53+
super(identifier, graph);
54+
graph.add((IRI) identifier, asIRI(RDF.type), asIRI(ACP.Matcher));
4655
}
4756

57+
58+
/**
59+
* Retrieve the acp:vc values.
60+
*
61+
* @return a collection of verifiable credential types
62+
*/
4863
public Set<URI> vc() {
49-
return objects(rdf.createIRI(ACP.vc.toString()),
50-
TermMappings::asIri, ValueMappings::iriAsUri);
64+
return objects(asIRI(ACP.vc), TermMappings::asIri, ValueMappings::iriAsUri);
5165
}
5266

67+
/**
68+
* Retrieve the acp:agent values.
69+
*
70+
* @return a collection of agent identifiers
71+
*/
5372
public Set<URI> agent() {
54-
return objects(rdf.createIRI(ACP.agent.toString()),
55-
TermMappings::asIri, ValueMappings::iriAsUri);
73+
return objects(asIRI(ACP.agent), TermMappings::asIri, ValueMappings::iriAsUri);
5674
}
5775

76+
/**
77+
* Retrieve the acp:client values.
78+
*
79+
* @return a collection of client identifiers
80+
*/
5881
public Set<URI> client() {
59-
return objects(rdf.createIRI(ACP.client.toString()),
60-
TermMappings::asIri, ValueMappings::iriAsUri);
82+
return objects(asIRI(ACP.client), TermMappings::asIri, ValueMappings::iriAsUri);
6183
}
6284

85+
/**
86+
* Retrieve the acp:issuer values.
87+
*
88+
* @return a collection of issuer identifiers
89+
*/
6390
public Set<URI> issuer() {
64-
return objects(rdf.createIRI(ACP.issuer.toString()),
65-
TermMappings::asIri, ValueMappings::iriAsUri);
91+
return objects(asIRI(ACP.issuer), TermMappings::asIri, ValueMappings::iriAsUri);
6692
}
6793

6894
static RDFTerm asResource(final Matcher matcher, final Graph graph) {
69-
graph.add(matcher, rdf.createIRI(type.toString()), rdf.createIRI(ACP.Matcher.toString()));
95+
graph.add(matcher, asIRI(RDF.type), asIRI(ACP.Matcher));
7096
matcher.vc().forEach(vc ->
71-
graph.add(matcher, rdf.createIRI(ACP.vc.toString()), rdf.createIRI(vc.toString())));
97+
graph.add(matcher, asIRI(ACP.vc), asIRI(vc)));
7298
matcher.agent().forEach(agent ->
73-
graph.add(matcher, rdf.createIRI(ACP.agent.toString()), rdf.createIRI(agent.toString())));
99+
graph.add(matcher, asIRI(ACP.agent), asIRI(agent)));
74100
matcher.client().forEach(client ->
75-
graph.add(matcher, rdf.createIRI(ACP.client.toString()), rdf.createIRI(client.toString())));
101+
graph.add(matcher, asIRI(ACP.client), asIRI(client)));
76102
matcher.issuer().forEach(issuer ->
77-
graph.add(matcher, rdf.createIRI(ACP.issuer.toString()), rdf.createIRI(issuer.toString())));
103+
graph.add(matcher, asIRI(ACP.issuer), asIRI(issuer)));
78104
return matcher;
79105
}
80106
}

acp/src/main/java/com/inrupt/client/acp/Policy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
*/
4444
public class Policy extends WrapperIRI {
4545

46-
/** Create a new Policy.
46+
/**
47+
* Create a new Policy.
4748
*
4849
* @param identifier the policy identifier
4950
* @param graph the underlying graph for this resource

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
<link>https://jena.apache.org/documentation/javadoc/arq/</link>
207207
<link>https://www.antlr.org/api/Java/</link>
208208
<link>https://rdf4j.org/javadoc/5.1.0/</link>
209-
<link>http://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/</link>
209+
<link>http://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/latest/</link>
210210
</links>
211211
<header>
212212
<![CDATA[

0 commit comments

Comments
 (0)