From fc684d4b735cbc0d1eefb1e828570d188571ef41 Mon Sep 17 00:00:00 2001 From: Michael Dowling <mtdowling@gmail.com> Date: Thu, 23 Jan 2020 14:14:26 -0800 Subject: [PATCH] Remove NodeFactory Closes #219 --- .../smithy/model/node/DefaultNodeFactory.java | 15 ++----- .../amazon/smithy/model/node/NodeFactory.java | 39 ------------------- 2 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 smithy-model/src/main/java/software/amazon/smithy/model/node/NodeFactory.java diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/node/DefaultNodeFactory.java b/smithy-model/src/main/java/software/amazon/smithy/model/node/DefaultNodeFactory.java index 0158ec6e038..9c10c1c701e 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/node/DefaultNodeFactory.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/node/DefaultNodeFactory.java @@ -39,29 +39,20 @@ * * <p>Uses Jackson internally, but that is free to change in the * future if needed. - * - * <p>Using this class directly is deprecated and it will be made - * package-private in 0.10.0. Use {@link Node#parse} instead. */ -@Deprecated -public final class DefaultNodeFactory implements NodeFactory { +final class DefaultNodeFactory { private final JsonFactory jsonFactory; - public DefaultNodeFactory() { - this(new JsonFactory()); - } - DefaultNodeFactory(JsonFactory jsonFactory) { this.jsonFactory = jsonFactory; } - @Override - public Node createNode(String filename, String text) { + Node createNode(String filename, String text) { InputStream targetStream = new ByteArrayInputStream(text.getBytes(Charset.forName("UTF-8"))); return createNode(filename, targetStream); } - public Node createNode(String filename, InputStream input) { + Node createNode(String filename, InputStream input) { JsonParser parser = createParser(filename, input); try { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/node/NodeFactory.java b/smithy-model/src/main/java/software/amazon/smithy/model/node/NodeFactory.java deleted file mode 100644 index 0e788c77d29..00000000000 --- a/smithy-model/src/main/java/software/amazon/smithy/model/node/NodeFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package software.amazon.smithy.model.node; - -import software.amazon.smithy.model.loader.ModelSyntaxException; - -/** - * A {@code NodeFactory} is responsible for creating a {@link Node} objects - * from strings. - */ -@FunctionalInterface -@Deprecated -public interface NodeFactory { - /** - * Creates a {@link Node} from a document {@code String}. - * - * <p>The filename is used in error messages and for populating source - * locations for the built node objects. - * - * @param filename The name of the document that is being parsed to create nodes. - * @param document The document to parse into nodes. - * @return Returns a {@link Node} representing the document. - * @throws ModelSyntaxException when a RuntimeException occurs. - */ - Node createNode(String filename, String document); -}