Add generalized FileGenerator interface
[yangtools.git] / plugin / plugin-generator-api / src / main / java / org / opendaylight / yangtools / plugin / generator / api / FileGeneratorFactory.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.yangtools.plugin.generator.api;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Map;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.concepts.Identifiable;
14
15 /**
16  * A {@link java.util.ServiceLoader} factory for instantiating {@link FileGenerator} instances.
17  *
18  * @author Robert Varga
19  */
20 @Beta
21 @NonNullByDefault
22 public interface FileGeneratorFactory extends Identifiable<String> {
23     /**
24      * {@inheritDoc}
25      *
26      * <p>
27      * This identifier must be a simple string without any whitespace, such as produced by
28      * {@link Class#getSimpleName()}.
29      */
30     @Override
31     String getIdentifier();
32
33     /**
34      * Create a new {@link FileGenerator}.
35      *
36      * @param configuration Configuration properties
37      * @return a new FileGenerator
38      * @throws FileGeneratorException if the configuration is not acceptable, or any other issue occurs.
39      */
40     FileGenerator newFileGenerator(Map<String, String> configuration) throws FileGeneratorException;
41 }