Add docs and copyright information

Add copyright information to all ConfigNode classes. Document
the ConfigNode interface.
This commit is contained in:
Preben Ingvaldsen 2015-03-11 11:45:05 -07:00
parent cce8c204ac
commit 0a804deff5
8 changed files with 47 additions and 8 deletions

View File

@ -1,5 +1,27 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config;
/**
* An immutable node that makes up the ConfigDocument AST, and which can be
* used to reproduce part or all of the original text of an input.
*
* <p>
* Because this object is immutable, it is safe to use from multiple threads and
* there's no need for "defensive copies."
*
* <p>
* <em>Do not implement interface {@code ConfigNode}</em>; it should only be
* implemented by the config library. Arbitrary implementations will not work
* because the library internals assume a specific concrete implementation.
* Also, this interface is likely to grow new methods over time, so third-party
* implementations will break.
*/
public interface ConfigNode {
/**
* The original text of the input which was used to form this particular node.
* @return the original text used to form this node as a String
*/
public String render();
}

View File

@ -1,3 +1,6 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import com.typesafe.config.ConfigNode;

View File

@ -1,7 +1,9 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
// This is gross. We currently have a class that doesn't do anything, but is needed
// to distinguish certain types of nodes from other types. This is required if we want
// This is required if we want
// to be referencing the AbstractConfigNode class in implementation rather than the
// ConfigNode interface, as we can't cast an AbstractConfigNode to an interface
abstract class AbstractConfigNodeValue extends AbstractConfigNode {

View File

@ -1,3 +1,6 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import com.typesafe.config.ConfigNode;

View File

@ -1,3 +1,6 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import java.util.Collection;

View File

@ -1,3 +1,6 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import com.typesafe.config.ConfigException;
@ -6,7 +9,7 @@ import com.typesafe.config.ConfigNode;
import java.util.ArrayList;
import java.util.Collection;
public class ConfigNodeKeyValue extends AbstractConfigNode {
final class ConfigNodeKeyValue extends AbstractConfigNode {
final private ArrayList<AbstractConfigNode> children;
public ConfigNodeKeyValue(Collection<AbstractConfigNode> children) {

View File

@ -1,13 +1,13 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import java.util.Collection;
import java.util.Collections;
/**
* This class represents a leaf ConfigNode. This type of ConfigNode has no children.
*/
class ConfigNodeSimpleValue extends AbstractConfigNodeValue {
Token token;
final Token token;
ConfigNodeSimpleValue(Token value) {
token = value;
}

View File

@ -1,10 +1,13 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://typesafe.com>
*/
package com.typesafe.config.impl;
import java.util.Collection;
import java.util.Collections;
final class ConfigNodeSingleToken extends AbstractConfigNode{
Token token;
final Token token;
ConfigNodeSingleToken(Token t) {
token = t;
}