/* * Copyright 2017 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.workbench.common.stunner.svg.gen.codegen.impl; import java.util.HashMap; import java.util.Map; import org.kie.workbench.common.stunner.svg.gen.codegen.ShapeDefinitionGenerator; import org.kie.workbench.common.stunner.svg.gen.exception.GeneratorException; import org.kie.workbench.common.stunner.svg.gen.model.impl.MultiPathDefinition; import org.uberfire.annotations.processors.exceptions.GenerationException; public class MultiPathDefinitionGenerator extends AbstractShapeDefinitionGenerator<MultiPathDefinition> implements ShapeDefinitionGenerator<MultiPathDefinition> { @Override public StringBuffer doGenerate(final MultiPathDefinition input) throws GeneratorException { final String path = input.getPath(); final Map<String, Object> root = new HashMap<String, Object>(); root.put("path", path); // Generate the code using the given template. try { return writeTemplate(root); } catch (final GenerationException e) { throw new GeneratorException(e); } } @Override protected String getTemplatePath() { return "MultiPath"; } @Override public Class<MultiPathDefinition> getDefinitionType() { return MultiPathDefinition.class; } }