• 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.constructor;
15 
16 import org.yaml.snakeyaml.error.YAMLException;
17 import org.yaml.snakeyaml.nodes.Node;
18 
19 /**
20  * Because recursive structures are not very common we provide a way to save some typing when
21  * extending a constructor
22  */
23 public abstract class AbstractConstruct implements Construct {
24 
25   /**
26    * Fail with a reminder to provide the seconds step for a recursive structure
27    *
28    * @see org.yaml.snakeyaml.constructor.Construct#construct2ndStep(org.yaml.snakeyaml.nodes.Node,
29    *      java.lang.Object)
30    */
construct2ndStep(Node node, Object data)31   public void construct2ndStep(Node node, Object data) {
32     if (node.isTwoStepsConstruction()) {
33       throw new IllegalStateException("Not Implemented in " + getClass().getName());
34     } else {
35       throw new YAMLException("Unexpected recursive structure for Node: " + node);
36     }
37   }
38 }
39