Skip to content

Commit 9fb1b8e

Browse files
committed
Small simplification and indent style
Signed-off-by:Bart Hanssens <bart.hanssens@fedict.be>
1 parent 9bc5627 commit 9fb1b8e

2 files changed

Lines changed: 27 additions & 28 deletions

File tree

core/model/src/main/java/org/eclipse/rdf4j/model/util/VocabularyUtil.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.eclipse.rdf4j.model.util;
99

1010
import java.lang.reflect.Field;
11-
import java.lang.reflect.Modifier;
1211
import java.util.HashSet;
1312
import java.util.Set;
1413

@@ -20,24 +19,24 @@
2019
* @author Bart Hanssens
2120
*/
2221
public class VocabularyUtil {
23-
/**
24-
* Get all the {@link IRI IRIs} of the classes and properties of a vocabulary.
25-
*
26-
* @param vocabulary RDF vocabulary
27-
* @return set of IRIs
28-
*/
29-
public static Set<IRI> getAllIRIs(Class vocabulary) {
30-
Set<IRI> iris = new HashSet<>();
22+
/**
23+
* Get all the {@link IRI IRIs} of the classes and properties of a vocabulary.
24+
*
25+
* @param vocabulary RDF vocabulary
26+
* @return set of IRIs
27+
*/
28+
public static Set<IRI> getAllIRIs(Class vocabulary) {
29+
Set<IRI> iris = new HashSet<>();
3130

32-
for (Field f : vocabulary.getFields()) {
33-
if (f.getType().equals(IRI.class) && Modifier.isPublic(f.getModifiers())) {
34-
try {
35-
iris.add((IRI) f.get(f));
36-
} catch (IllegalArgumentException | IllegalAccessException ex) {
37-
// should not happen
31+
for (Field f : vocabulary.getFields()) {
32+
if (f.getType().equals(IRI.class)) {
33+
try {
34+
iris.add((IRI) f.get(vocabulary));
35+
} catch (IllegalAccessException ex) {
36+
// should not happen
37+
}
38+
}
3839
}
39-
}
40+
return iris;
4041
}
41-
return iris;
42-
}
4342
}

core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabularyUtilTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323
public class VocabularyUtilTest {
2424

25-
@Test
26-
public void testVocabAllIRI() throws Exception {
27-
Set<IRI> dcIRIs = new HashSet<>(Arrays.asList(
28-
DC.CONTRIBUTOR, DC.COVERAGE, DC.CREATOR, DC.DATE, DC.DESCRIPTION,
29-
DC.FORMAT, DC.IDENTIFIER, DC.LANGUAGE, DC.PUBLISHER, DC.RELATION,
30-
DC.RIGHTS, DC.SOURCE, DC.SUBJECT, DC.TITLE, DC.TYPE));
25+
@Test
26+
public void testVocabAllIRI() throws Exception {
27+
Set<IRI> dcIRIs = new HashSet<>(Arrays.asList(
28+
DC.CONTRIBUTOR, DC.COVERAGE, DC.CREATOR, DC.DATE, DC.DESCRIPTION,
29+
DC.FORMAT, DC.IDENTIFIER, DC.LANGUAGE, DC.PUBLISHER, DC.RELATION,
30+
DC.RIGHTS, DC.SOURCE, DC.SUBJECT, DC.TITLE, DC.TYPE));
3131

32-
Set<IRI> allIRIs = VocabularyUtil.getAllIRIs(DC.class);
32+
Set<IRI> allIRIs = VocabularyUtil.getAllIRIs(DC.class);
3333

34-
assertEquals(dcIRIs, allIRIs);
35-
}
36-
}
34+
assertEquals(dcIRIs, allIRIs);
35+
}
36+
}

0 commit comments

Comments
 (0)