5175ade438e168ecc27b72ae831d0c57dff230ae
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / directives / UnimplementedExceptionDirective.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.directives;
9
10 import java.io.IOException;
11 import java.io.Writer;
12 import java.util.Map;
13
14 import freemarker.core.Environment;
15 import freemarker.template.TemplateDirectiveBody;
16 import freemarker.template.TemplateDirectiveModel;
17 import freemarker.template.TemplateException;
18 import freemarker.template.TemplateModel;
19
20 /**
21  * Add annotations to freemarker template.
22  */
23 public class UnimplementedExceptionDirective implements TemplateDirectiveModel {
24
25     @Override
26     public void execute(Environment env, Map params, TemplateModel[] loopVars,
27             TemplateDirectiveBody body) throws TemplateException, IOException {
28
29         Writer out = env.getOut();
30         StringBuilder build = new StringBuilder();
31         build.append("        ");
32         build.append("throw new "
33                 + UnsupportedOperationException.class.getCanonicalName()
34                 + "(\"Unimplemented stub method\");");
35         build.append(System.lineSeparator());
36
37         out.write(build.toString().toCharArray());
38     }
39 }