ANY23-402 deprecate nonstandard JSONWriter
authorHans <firedrake93@gmail.com>
Mon, 29 Oct 2018 16:07:51 +0000 (11:07 -0500)
committerHans <firedrake93@gmail.com>
Mon, 29 Oct 2018 16:07:51 +0000 (11:07 -0500)
core/src/main/java/org/apache/any23/writer/JSONWriter.java
core/src/main/java/org/apache/any23/writer/JSONWriterFactory.java
core/src/test/java/org/apache/any23/writer/JSONWriterTest.java

index 58d869a..2df37b3 100644 (file)
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Optional;
 
-import org.apache.any23.configuration.Settings;
 import org.eclipse.rdf4j.model.BNode;
 import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.Literal;
@@ -34,7 +33,10 @@ import org.eclipse.rdf4j.model.Value;
  * Implementation of <i>JSON</i> {@link TripleWriter}.
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
+ *
+ * @deprecated since 2.3. Use {@link JSONLDWriter} instead.
  */
+@Deprecated
 public class JSONWriter extends TripleWriterHandler implements FormatWriter {
 
     private JsonGenerator ps;
index 8877a25..9e85e99 100644 (file)
@@ -26,7 +26,10 @@ import java.util.Collections;
 /**
  * @author Peter Ansell p_ansell@yahoo.com
  * @author Hans Brende (hansbrende@apache.org)
+ *
+ * @deprecated since 2.3. Use {@link JSONLDWriterFactory} instead.
  */
+@Deprecated
 public class JSONWriterFactory implements TripleWriterFactory {
 
 
index 0099d9f..8b305ef 100644 (file)
@@ -25,7 +25,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Test case for {@link JSONWriter} and {@link JSONLDWriter} class.
+ * Test case for {@link JSONLDWriter} and deprecated JSONWriter classes.
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
  * @author Julio Caguano
@@ -33,6 +33,7 @@ import org.junit.Test;
 public class JSONWriterTest {
 
     @Test
+    @Deprecated
     public void testJSONWriting() throws TripleHandlerException, IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         writeContentComplicated(new JSONWriter(baos));
@@ -150,7 +151,7 @@ public class JSONWriterTest {
                 SimpleValueFactory.getInstance().createIRI("http://graph/2"),
                 null
         );
-        if (writer instanceof JSONWriter) {
+        if (!(writer instanceof JSONLDWriter)) {
             writer.receiveTriple(
                     SimpleValueFactory.getInstance().createIRI("http://sub/3"),
                     SimpleValueFactory.getInstance().createIRI("http://pred/3"),
@@ -158,7 +159,7 @@ public class JSONWriterTest {
                     null,
                     null
             );
-        } else if (writer instanceof JSONLDWriter) {
+        } else {
             //creating a fake extraction context in order to write triples is terrible.
             //see improved solution in "writeContentSimple"!
             ExtractionContext extractionContext = new ExtractionContext("rdf-nq", SimpleValueFactory.getInstance().createIRI("http://any23.org/tmp/"));