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