mirror of
https://github.com/lightbend/config.git
synced 2025-03-22 07:10:23 +08:00
make a bunch of fields final
This commit is contained in:
parent
00241585bd
commit
ae2cd72eed
@ -5,7 +5,7 @@ package com.typesafe.config;
|
|||||||
*/
|
*/
|
||||||
public final class ConfigConfig {
|
public final class ConfigConfig {
|
||||||
|
|
||||||
private String rootPath;
|
final private String rootPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new configuration configuration.
|
* Creates a new configuration configuration.
|
||||||
|
@ -17,7 +17,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
abstract class AbstractConfigObject extends AbstractConfigValue implements
|
abstract class AbstractConfigObject extends AbstractConfigValue implements
|
||||||
ConfigObject {
|
ConfigObject {
|
||||||
protected ConfigTransformer transformer;
|
final protected ConfigTransformer transformer;
|
||||||
|
|
||||||
protected AbstractConfigObject(ConfigOrigin origin,
|
protected AbstractConfigObject(ConfigOrigin origin,
|
||||||
ConfigTransformer transformer) {
|
ConfigTransformer transformer) {
|
||||||
|
@ -5,7 +5,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class ConfigBoolean extends AbstractConfigValue {
|
final class ConfigBoolean extends AbstractConfigValue {
|
||||||
|
|
||||||
private boolean value;
|
final private boolean value;
|
||||||
|
|
||||||
ConfigBoolean(ConfigOrigin origin, boolean value) {
|
ConfigBoolean(ConfigOrigin origin, boolean value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -5,7 +5,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class ConfigDouble extends AbstractConfigValue {
|
final class ConfigDouble extends AbstractConfigValue {
|
||||||
|
|
||||||
private double value;
|
final private double value;
|
||||||
|
|
||||||
ConfigDouble(ConfigOrigin origin, double value) {
|
ConfigDouble(ConfigOrigin origin, double value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -5,7 +5,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class ConfigInt extends AbstractConfigValue {
|
final class ConfigInt extends AbstractConfigValue {
|
||||||
|
|
||||||
private int value;
|
final private int value;
|
||||||
|
|
||||||
ConfigInt(ConfigOrigin origin, int value) {
|
ConfigInt(ConfigOrigin origin, int value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -5,7 +5,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class ConfigLong extends AbstractConfigValue {
|
final class ConfigLong extends AbstractConfigValue {
|
||||||
|
|
||||||
private long value;
|
final private long value;
|
||||||
|
|
||||||
ConfigLong(ConfigOrigin origin, long value) {
|
ConfigLong(ConfigOrigin origin, long value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -5,7 +5,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class ConfigString extends AbstractConfigValue {
|
final class ConfigString extends AbstractConfigValue {
|
||||||
|
|
||||||
private String value;
|
final private String value;
|
||||||
|
|
||||||
ConfigString(ConfigOrigin origin, String value) {
|
ConfigString(ConfigOrigin origin, String value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -17,7 +17,7 @@ final class ConfigSubstitution extends AbstractConfigValue {
|
|||||||
// this is a list of String and Path where the Path
|
// this is a list of String and Path where the Path
|
||||||
// have to be resolved to values, then if there's more
|
// have to be resolved to values, then if there's more
|
||||||
// than one piece everything is stringified and concatenated
|
// than one piece everything is stringified and concatenated
|
||||||
private List<Object> pieces;
|
final private List<Object> pieces;
|
||||||
|
|
||||||
ConfigSubstitution(ConfigOrigin origin, List<Object> pieces) {
|
ConfigSubstitution(ConfigOrigin origin, List<Object> pieces) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -106,11 +106,11 @@ final class Parser {
|
|||||||
|
|
||||||
static private final class ParseContext {
|
static private final class ParseContext {
|
||||||
private int lineNumber;
|
private int lineNumber;
|
||||||
private Stack<Token> buffer;
|
final private Stack<Token> buffer;
|
||||||
private Iterator<Token> tokens;
|
final private Iterator<Token> tokens;
|
||||||
private IncludeHandler includer;
|
final private IncludeHandler includer;
|
||||||
private SyntaxFlavor flavor;
|
final private SyntaxFlavor flavor;
|
||||||
private ConfigOrigin baseOrigin;
|
final private ConfigOrigin baseOrigin;
|
||||||
|
|
||||||
ParseContext(SyntaxFlavor flavor, ConfigOrigin origin,
|
ParseContext(SyntaxFlavor flavor, ConfigOrigin origin,
|
||||||
Iterator<Token> tokens, IncludeHandler includer) {
|
Iterator<Token> tokens, IncludeHandler includer) {
|
||||||
|
@ -4,8 +4,8 @@ import com.typesafe.config.ConfigException;
|
|||||||
|
|
||||||
final class Path {
|
final class Path {
|
||||||
|
|
||||||
private String first;
|
final private String first;
|
||||||
private Path remainder;
|
final private Path remainder;
|
||||||
|
|
||||||
Path(String first, Path remainder) {
|
Path(String first, Path remainder) {
|
||||||
this.first = first;
|
this.first = first;
|
||||||
|
@ -6,7 +6,7 @@ import com.typesafe.config.ConfigException;
|
|||||||
|
|
||||||
final class PathBuilder {
|
final class PathBuilder {
|
||||||
// the keys are kept "backward" (top of stack is end of path)
|
// the keys are kept "backward" (top of stack is end of path)
|
||||||
private Stack<String> keys;
|
final private Stack<String> keys;
|
||||||
private Path result;
|
private Path result;
|
||||||
|
|
||||||
PathBuilder() {
|
PathBuilder() {
|
||||||
|
@ -14,7 +14,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class SimpleConfigList extends AbstractConfigValue implements ConfigList {
|
final class SimpleConfigList extends AbstractConfigValue implements ConfigList {
|
||||||
|
|
||||||
private List<AbstractConfigValue> value;
|
final private List<AbstractConfigValue> value;
|
||||||
|
|
||||||
SimpleConfigList(ConfigOrigin origin, List<AbstractConfigValue> value) {
|
SimpleConfigList(ConfigOrigin origin, List<AbstractConfigValue> value) {
|
||||||
super(origin);
|
super(origin);
|
||||||
|
@ -18,7 +18,7 @@ import com.typesafe.config.ConfigValue;
|
|||||||
class SimpleConfigObject extends AbstractConfigObject {
|
class SimpleConfigObject extends AbstractConfigObject {
|
||||||
|
|
||||||
// this map should never be modified - assume immutable
|
// this map should never be modified - assume immutable
|
||||||
private Map<String, AbstractConfigValue> value;
|
final private Map<String, AbstractConfigValue> value;
|
||||||
|
|
||||||
SimpleConfigObject(ConfigOrigin origin, ConfigTransformer transformer,
|
SimpleConfigObject(ConfigOrigin origin, ConfigTransformer transformer,
|
||||||
Map<String, AbstractConfigValue> value) {
|
Map<String, AbstractConfigValue> value) {
|
||||||
|
@ -4,7 +4,7 @@ import com.typesafe.config.ConfigOrigin;
|
|||||||
|
|
||||||
final class SimpleConfigOrigin implements ConfigOrigin {
|
final class SimpleConfigOrigin implements ConfigOrigin {
|
||||||
|
|
||||||
private String description;
|
final private String description;
|
||||||
|
|
||||||
SimpleConfigOrigin(String description) {
|
SimpleConfigOrigin(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
@ -6,7 +6,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
|
|
||||||
final class StackTransformer implements ConfigTransformer {
|
final class StackTransformer implements ConfigTransformer {
|
||||||
|
|
||||||
private List<ConfigTransformer> stack;
|
final private List<ConfigTransformer> stack;
|
||||||
|
|
||||||
StackTransformer(List<ConfigTransformer> stack) {
|
StackTransformer(List<ConfigTransformer> stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
|
@ -9,8 +9,8 @@ import java.util.Map;
|
|||||||
* of values or whole trees of values as we follow chains of substitutions.
|
* of values or whole trees of values as we follow chains of substitutions.
|
||||||
*/
|
*/
|
||||||
final class SubstitutionResolver {
|
final class SubstitutionResolver {
|
||||||
private AbstractConfigObject root;
|
final private AbstractConfigObject root;
|
||||||
private Map<AbstractConfigValue, AbstractConfigValue> memos;
|
final private Map<AbstractConfigValue, AbstractConfigValue> memos;
|
||||||
|
|
||||||
SubstitutionResolver(AbstractConfigObject root) {
|
SubstitutionResolver(AbstractConfigObject root) {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.typesafe.config.impl;
|
package com.typesafe.config.impl;
|
||||||
|
|
||||||
class Token {
|
class Token {
|
||||||
private TokenType tokenType;
|
final private TokenType tokenType;
|
||||||
|
|
||||||
Token(TokenType tokenType) {
|
Token(TokenType tokenType) {
|
||||||
this.tokenType = tokenType;
|
this.tokenType = tokenType;
|
||||||
|
@ -81,12 +81,12 @@ final class Tokenizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigOrigin origin;
|
final private ConfigOrigin origin;
|
||||||
private Reader input;
|
final private Reader input;
|
||||||
private int oneCharBuffer;
|
private int oneCharBuffer;
|
||||||
private int lineNumber;
|
private int lineNumber;
|
||||||
private Queue<Token> tokens;
|
final private Queue<Token> tokens;
|
||||||
private WhitespaceSaver whitespaceSaver;
|
final private WhitespaceSaver whitespaceSaver;
|
||||||
|
|
||||||
TokenIterator(ConfigOrigin origin, Reader input) {
|
TokenIterator(ConfigOrigin origin, Reader input) {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
|
@ -9,7 +9,7 @@ import com.typesafe.config.ConfigValueType;
|
|||||||
final class Tokens {
|
final class Tokens {
|
||||||
static private class Value extends Token {
|
static private class Value extends Token {
|
||||||
|
|
||||||
private AbstractConfigValue value;
|
final private AbstractConfigValue value;
|
||||||
|
|
||||||
Value(AbstractConfigValue value) {
|
Value(AbstractConfigValue value) {
|
||||||
super(TokenType.VALUE);
|
super(TokenType.VALUE);
|
||||||
@ -45,7 +45,7 @@ final class Tokens {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static private class Line extends Token {
|
static private class Line extends Token {
|
||||||
private int lineNumber;
|
final private int lineNumber;
|
||||||
|
|
||||||
Line(int lineNumber) {
|
Line(int lineNumber) {
|
||||||
super(TokenType.NEWLINE);
|
super(TokenType.NEWLINE);
|
||||||
@ -80,8 +80,8 @@ final class Tokens {
|
|||||||
|
|
||||||
// This is not a Value, because it requires special processing
|
// This is not a Value, because it requires special processing
|
||||||
static private class UnquotedText extends Token {
|
static private class UnquotedText extends Token {
|
||||||
private ConfigOrigin origin;
|
final private ConfigOrigin origin;
|
||||||
private String value;
|
final private String value;
|
||||||
|
|
||||||
UnquotedText(ConfigOrigin origin, String s) {
|
UnquotedText(ConfigOrigin origin, String s) {
|
||||||
super(TokenType.UNQUOTED_TEXT);
|
super(TokenType.UNQUOTED_TEXT);
|
||||||
@ -121,8 +121,8 @@ final class Tokens {
|
|||||||
|
|
||||||
// This is not a Value, because it requires special processing
|
// This is not a Value, because it requires special processing
|
||||||
static private class Substitution extends Token {
|
static private class Substitution extends Token {
|
||||||
private ConfigOrigin origin;
|
final private ConfigOrigin origin;
|
||||||
private List<Token> value;
|
final private List<Token> value;
|
||||||
|
|
||||||
Substitution(ConfigOrigin origin, List<Token> expression) {
|
Substitution(ConfigOrigin origin, List<Token> expression) {
|
||||||
super(TokenType.SUBSTITUTION);
|
super(TokenType.SUBSTITUTION);
|
||||||
@ -234,14 +234,14 @@ final class Tokens {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Token START = new Token(TokenType.START);
|
final static Token START = new Token(TokenType.START);
|
||||||
static Token END = new Token(TokenType.END);
|
final static Token END = new Token(TokenType.END);
|
||||||
static Token COMMA = new Token(TokenType.COMMA);
|
final static Token COMMA = new Token(TokenType.COMMA);
|
||||||
static Token COLON = new Token(TokenType.COLON);
|
final static Token COLON = new Token(TokenType.COLON);
|
||||||
static Token OPEN_CURLY = new Token(TokenType.OPEN_CURLY);
|
final static Token OPEN_CURLY = new Token(TokenType.OPEN_CURLY);
|
||||||
static Token CLOSE_CURLY = new Token(TokenType.CLOSE_CURLY);
|
final static Token CLOSE_CURLY = new Token(TokenType.CLOSE_CURLY);
|
||||||
static Token OPEN_SQUARE = new Token(TokenType.OPEN_SQUARE);
|
final static Token OPEN_SQUARE = new Token(TokenType.OPEN_SQUARE);
|
||||||
static Token CLOSE_SQUARE = new Token(TokenType.CLOSE_SQUARE);
|
final static Token CLOSE_SQUARE = new Token(TokenType.CLOSE_SQUARE);
|
||||||
|
|
||||||
static Token newLine(int lineNumberJustEnded) {
|
static Token newLine(int lineNumberJustEnded) {
|
||||||
return new Line(lineNumberJustEnded);
|
return new Line(lineNumberJustEnded);
|
||||||
|
@ -8,7 +8,7 @@ import com.typesafe.config.ConfigValue;
|
|||||||
|
|
||||||
class TransformedConfigObject extends AbstractConfigObject {
|
class TransformedConfigObject extends AbstractConfigObject {
|
||||||
|
|
||||||
private AbstractConfigObject underlying;
|
final private AbstractConfigObject underlying;
|
||||||
|
|
||||||
TransformedConfigObject(ConfigTransformer transformer,
|
TransformedConfigObject(ConfigTransformer transformer,
|
||||||
AbstractConfigObject underlying) {
|
AbstractConfigObject underlying) {
|
||||||
|
Loading…
Reference in New Issue
Block a user