Skip to content

Commit 95b6fb7

Browse files
committed
Annotate deprecated classes
1 parent d311131 commit 95b6fb7

9 files changed

+48
-55
lines changed

src/main/java/com/apicatalog/jsonld/lang/BlankNode.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.util.Arrays;
1919

20-
import com.apicatalog.rdf.lang.RdfAlphabet;
20+
import com.apicatalog.rdf.nquads.NQuadsAlphabet;
2121

2222
/**
2323
*
@@ -63,8 +63,8 @@ public static boolean isWellFormed(final String blankNodeId) {
6363

6464
if (chars[0] != '_'
6565
|| chars[1] != ':'
66-
|| (RdfAlphabet.PN_CHARS_U.negate().test(chars[2])
67-
&& RdfAlphabet.ASCII_DIGIT.negate().test(chars[2]))
66+
|| (NQuadsAlphabet.PN_CHARS_U.negate().test(chars[2])
67+
&& NQuadsAlphabet.ASCII_DIGIT.negate().test(chars[2]))
6868
|| chars[chars.length - 1] == '.'
6969
) {
7070
return false;
@@ -74,6 +74,6 @@ public static boolean isWellFormed(final String blankNodeId) {
7474
return true;
7575
}
7676

77-
return Arrays.stream(chars, 3, chars.length - 1).allMatch(RdfAlphabet.PN_CHARS.or(ch -> ch == '.'));
77+
return Arrays.stream(chars, 3, chars.length - 1).allMatch(NQuadsAlphabet.PN_CHARS.or(ch -> ch == '.'));
7878
}
7979
}

src/main/java/com/apicatalog/jsonld/lang/LanguageTagParser.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.regex.Pattern;
2222

2323
import com.apicatalog.jsonld.lang.LanguageTag.Extension;
24-
import com.apicatalog.rdf.lang.RdfAlphabet;
24+
import com.apicatalog.rdf.nquads.NQuadsAlphabet;
2525

2626
/**
2727
* Language tags are used to help identify languages and are defined by
@@ -77,8 +77,8 @@ private static final LanguageTagParser create(final String languageTag, boolean
7777

7878
// must start with ALPHA and ends with ALPHANUM
7979
if (stripped.length() == 0
80-
|| RdfAlphabet.ASCII_ALPHA.negate().test(stripped.codePointAt(0))
81-
|| RdfAlphabet.ASCII_ALPHA_NUM.negate().test(stripped.codePointAt(stripped.length() - 1))) {
80+
|| NQuadsAlphabet.ASCII_ALPHA.negate().test(stripped.codePointAt(0))
81+
|| NQuadsAlphabet.ASCII_ALPHA_NUM.negate().test(stripped.codePointAt(stripped.length() - 1))) {
8282
return new LanguageTagParser(languageTag, null, verifierMode);
8383
}
8484

@@ -200,7 +200,7 @@ boolean acceptAlpha(int length, Consumer<String> consumer) {
200200
}
201201

202202
boolean acceptAlpha(int min, int max, Consumer<String> consumer) {
203-
return accept(min, max, RdfAlphabet.ASCII_ALPHA, consumer);
203+
return accept(min, max, NQuadsAlphabet.ASCII_ALPHA, consumer);
204204
}
205205

206206
boolean acceptDigit(int length) {
@@ -212,11 +212,11 @@ boolean acceptDigit(int length, Consumer<String> consumer) {
212212
}
213213

214214
boolean acceptDigit(int min, int max, Consumer<String> consumer) {
215-
return accept(min, max, RdfAlphabet.ASCII_DIGIT, consumer);
215+
return accept(min, max, NQuadsAlphabet.ASCII_DIGIT, consumer);
216216
}
217217

218218
boolean acceptAlphaNun(int min, int max, Consumer<String> consumer) {
219-
return accept(min, max, RdfAlphabet.ASCII_ALPHA_NUM, consumer);
219+
return accept(min, max, NQuadsAlphabet.ASCII_ALPHA_NUM, consumer);
220220
}
221221

222222
boolean accept(int min, int max, IntPredicate predicate, Consumer<String> consumer) {
@@ -253,15 +253,15 @@ boolean accept(int length, Consumer<String> consumer) {
253253
}
254254

255255
boolean alphaRange(int index, int length) {
256-
return range(index, length, RdfAlphabet.ASCII_ALPHA);
256+
return range(index, length, NQuadsAlphabet.ASCII_ALPHA);
257257
}
258258

259259
boolean alphaNumRange(int index, int length) {
260-
return range(index, length, RdfAlphabet.ASCII_ALPHA_NUM);
260+
return range(index, length, NQuadsAlphabet.ASCII_ALPHA_NUM);
261261
}
262262

263263
boolean digitRange(int index, int length) {
264-
return range(index, length, RdfAlphabet.ASCII_DIGIT);
264+
return range(index, length, NQuadsAlphabet.ASCII_DIGIT);
265265
}
266266

267267
boolean range(int index, int length, IntPredicate predicate) {

src/main/java/com/apicatalog/rdf/RdfGraph.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@
1919

2020
import com.apicatalog.jsonld.JsonLd;
2121

22-
2322
/**
2423
* The {@link RdfGraph} interface describes operations on an RDF graph used by
25-
* the @link {@link JsonLd#fromRdf} and
26-
* {@link JsonLd#toRdf(java.net.URI)} methods in the
27-
* {@link JsonLd} interface. The interface may be used for constructing
28-
* a new {@link RdfGraph}, which is composed of zero or more {@link RdfTriple}
29-
* instances.
24+
* the @link {@link JsonLd#fromRdf} and {@link JsonLd#toRdf(java.net.URI)}
25+
* methods in the {@link JsonLd} interface. The interface may be used for
26+
* constructing a new {@link RdfGraph}, which is composed of zero or more
27+
* {@link RdfTriple} instances.
3028
*
3129
* @see <a href="https://www.w3.org/TR/json-ld11-api/#webidl-140206580">RdfGraph
3230
* IDL</a>
@@ -36,7 +34,6 @@ public interface RdfGraph {
3634

3735
boolean contains(RdfTriple triple);
3836

39-
@Deprecated
4037
List<RdfTriple> toList();
4138

4239
}

src/main/java/com/apicatalog/rdf/impl/ImmutableRdfLiteral.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import java.util.Optional;
2020

2121
import com.apicatalog.rdf.RdfLiteral;
22-
import com.apicatalog.rdf.io.nquad.NQuadsWriter;
2322
import com.apicatalog.rdf.lang.RdfConstants;
2423
import com.apicatalog.rdf.lang.XsdConstants;
24+
import com.apicatalog.rdf.nquads.NQuadsAlphabet;
2525

2626
final class ImmutableRdfLiteral implements RdfLiteral {
2727

@@ -88,7 +88,7 @@ public String toString() {
8888
StringBuilder builder = new StringBuilder();
8989

9090
builder.append('"');
91-
builder.append(NQuadsWriter.escape(value));
91+
builder.append(NQuadsAlphabet.escape(value));
9292
builder.append('"');
9393

9494
if (langTag != null) {

src/main/java/com/apicatalog/rdf/io/error/RdfReaderException.java

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package com.apicatalog.rdf.io.error;
1717

18-
@Deprecated
1918
public class RdfReaderException extends Exception {
2019

2120
private static final long serialVersionUID = -5357042008536435090L;

src/main/java/com/apicatalog/rdf/io/error/RdfWriterException.java

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package com.apicatalog.rdf.io.error;
1717

18-
@Deprecated
1918
public class RdfWriterException extends Exception {
2019

2120
private static final long serialVersionUID = 5939850604399297830L;

src/main/java/com/apicatalog/rdf/io/nquad/NQuadsReader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.apicatalog.rdf.nquads.NQuadsReaderException;
2828

2929
/**
30-
*
30+
* @deprecated since 1.6.0, use {@link com.apicatalog.rdf.nquads.NQuadsReader}.
3131
* @see <a href="https://www.w3.org/TR/n-quads/">RDF 1.1. N-Quads</a>
3232
*
3333
*/

src/main/java/com/apicatalog/rdf/io/nquad/NQuadsWriter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.apicatalog.rdf.nquads.NQuadsAlphabet;
2828

2929
/**
30-
*
30+
* @deprecated since 1.6.0, use {@link com.apicatalog.rdf.nquads.NQuadsWriter}.
3131
* @see <a href="https://www.w3.org/TR/n-quads/">RDF 1.1. N-Quads</a>
3232
*
3333
*/

src/main/java/com/apicatalog/rdf/lang/RdfAlphabet.java

+27-29
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717

1818
import java.util.function.IntPredicate;
1919

20+
import com.apicatalog.rdf.nquads.NQuadsAlphabet;
21+
22+
/**
23+
* @deprecated since 1.6.0, use {@link NQuadsAlphabet} as an alternative.
24+
*/
2025
@Deprecated
2126
public final class RdfAlphabet {
2227

23-
public static final IntPredicate ASCII_ALPHA =
24-
ch -> 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z';
28+
public static final IntPredicate ASCII_ALPHA = ch -> 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z';
2529

2630
public static final IntPredicate ASCII_DIGIT = ch -> '0' <= ch && ch <= '9';
2731

@@ -31,33 +35,27 @@ public final class RdfAlphabet {
3135

3236
public static final IntPredicate EOL = ch -> ch == 0x0A || ch == 0x0D;
3337

34-
public static final IntPredicate HEX = ASCII_DIGIT.or(ch -> 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F');
35-
36-
public static final IntPredicate PN_CHARS_BASE =
37-
ASCII_ALPHA.or(ch ->
38-
(0x00C0 <= ch && ch <= 0x00D6)
39-
|| (0x00D8 <= ch && ch <= 0x00F6)
40-
|| (0x00F8 <= ch && ch <= 0x02FF)
41-
|| (0x0370 <= ch && ch <= 0x037D)
42-
|| (0x037F <= ch && ch <= 0x1FFF)
43-
|| (0x200C <= ch && ch <= 0x200D)
44-
|| (0x2070 <= ch && ch <= 0x218F)
45-
|| (0x2C00 <= ch && ch <= 0x2FEF)
46-
|| (0x3001 <= ch && ch <= 0xD7FF)
47-
|| (0xF900 <= ch && ch <= 0xFDCF)
48-
|| (0xFDF0 <= ch && ch <= 0xFFFD)
49-
|| (0x10000 <= ch && ch <= 0xEFFFF)
50-
);
51-
52-
public static final IntPredicate PN_CHARS_U = PN_CHARS_BASE.or(ch -> '_' == ch|| ':' == ch);
53-
54-
public static final IntPredicate PN_CHARS =
55-
PN_CHARS_U.or(ASCII_DIGIT).or(ch ->
56-
'-' == ch
57-
|| 0x00B7 == ch
58-
|| (0x0300 <= ch && ch <= 0x036F)
59-
|| (0x203F <= ch && ch <= 0x2040)
60-
);
38+
public static final IntPredicate HEX = ASCII_DIGIT.or(ch -> 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F');
39+
40+
public static final IntPredicate PN_CHARS_BASE = ASCII_ALPHA.or(ch -> (0x00C0 <= ch && ch <= 0x00D6)
41+
|| (0x00D8 <= ch && ch <= 0x00F6)
42+
|| (0x00F8 <= ch && ch <= 0x02FF)
43+
|| (0x0370 <= ch && ch <= 0x037D)
44+
|| (0x037F <= ch && ch <= 0x1FFF)
45+
|| (0x200C <= ch && ch <= 0x200D)
46+
|| (0x2070 <= ch && ch <= 0x218F)
47+
|| (0x2C00 <= ch && ch <= 0x2FEF)
48+
|| (0x3001 <= ch && ch <= 0xD7FF)
49+
|| (0xF900 <= ch && ch <= 0xFDCF)
50+
|| (0xFDF0 <= ch && ch <= 0xFFFD)
51+
|| (0x10000 <= ch && ch <= 0xEFFFF));
52+
53+
public static final IntPredicate PN_CHARS_U = PN_CHARS_BASE.or(ch -> '_' == ch || ':' == ch);
54+
55+
public static final IntPredicate PN_CHARS = PN_CHARS_U.or(ASCII_DIGIT).or(ch -> '-' == ch
56+
|| 0x00B7 == ch
57+
|| (0x0300 <= ch && ch <= 0x036F)
58+
|| (0x203F <= ch && ch <= 0x2040));
6159

6260
private RdfAlphabet() {
6361
}

0 commit comments

Comments
 (0)