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