49
49
public class YamlReader implements AutoCloseable {
50
50
private final YamlConfig config ;
51
51
Parser parser ;
52
- private final Map <String , Object > anchors = new HashMap ();
52
+ private final Map <String , Object > anchorMap = new HashMap ();
53
53
54
54
public YamlReader (Reader reader ) {
55
55
this (reader , new YamlConfig ());
@@ -75,16 +75,16 @@ public YamlConfig getConfig () {
75
75
/** Return the object with the given alias, or null. This is only valid after objects have been read and before
76
76
* {@link #close()} */
77
77
public Object get (String alias ) {
78
- return anchors .get (alias );
78
+ return anchorMap .get (alias );
79
79
}
80
80
81
81
private void addAnchor (String key , Object value ) {
82
- if (config .readConfig .anchors ) anchors .put (key , value );
82
+ if (config .readConfig .anchors ) anchorMap .put (key , value );
83
83
}
84
84
85
85
public void close () throws IOException {
86
86
parser .close ();
87
- anchors .clear ();
87
+ anchorMap .clear ();
88
88
}
89
89
90
90
/** Reads the next YAML document and deserializes it into an object. The type of object is defined by the YAML tag. If there is
@@ -107,7 +107,7 @@ public <T> T read (Class<T> type) throws YamlException {
107
107
* @param type The type of object to read. If null, behaves the same as {{@link #read()}.
108
108
* @throws YamlReaderException if the YAML data specifies a type that is incompatible with the specified type. */
109
109
public <T > T read (Class <T > type , Class elementType ) throws YamlException {
110
- anchors .clear ();
110
+ anchorMap .clear ();
111
111
try {
112
112
while (true ) {
113
113
Event event = parser .getNextEvent ();
@@ -160,7 +160,7 @@ protected Object readValue (Class type, Class elementType, Class defaultType)
160
160
case ALIAS :
161
161
parser .getNextEvent ();
162
162
anchor = ((AliasEvent )event ).anchor ;
163
- Object value = anchors .get (anchor );
163
+ Object value = anchorMap .get (anchor );
164
164
if (value == null && config .readConfig .anchors ) throw new YamlReaderException ("Unknown anchor: " + anchor );
165
165
return value ;
166
166
case MAPPING_START :
0 commit comments