• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2008, http://www.snakeyaml.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.yaml.snakeyaml.nodes;
17 
18 /**
19  * Stores one key value pair used in a map.
20  */
21 public final class NodeTuple {
22 
23     private Node keyNode;
24     private Node valueNode;
25 
NodeTuple(Node keyNode, Node valueNode)26     public NodeTuple(Node keyNode, Node valueNode) {
27         if (keyNode == null || valueNode == null) {
28             throw new NullPointerException("Nodes must be provided.");
29         }
30         this.keyNode = keyNode;
31         this.valueNode = valueNode;
32     }
33 
34     /**
35      * Key node.
36      */
getKeyNode()37     public Node getKeyNode() {
38         return keyNode;
39     }
40 
41     /**
42      * Value node.
43      *
44      * @return value
45      */
getValueNode()46     public Node getValueNode() {
47         return valueNode;
48     }
49 
50     @Override
toString()51     public String toString() {
52         return "<NodeTuple keyNode=" + keyNode.toString() + "; valueNode=" + valueNode.toString()
53                 + ">";
54     }
55 }
56