2 * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.generator.util;
11 * Factory class for creating SourceCodeGenerator instances.
13 * @author Thomas Pantelis
14 * @deprecated Code generation is a concert separate from type mapping and is an implementation detail.
17 public class SourceCodeGeneratorFactory {
19 private static final String GENERATE_CODEC_SOURCE_PROP = "org.opendaylight.yangtools.sal.generateCodecSource";
21 private static final SourceCodeGenerator NULL_GENERATOR = new NullSourceCodeGenerator();
24 * Gets a SourceCodeGenerator instance.
27 * Generation of source code is controlled by the <i>org.opendaylight.yangtools.sal.generateCodecSource</i>
28 * system property. If set to true, a DefaultSourceCodeGenerator instance is returned, otherwise a
29 * NullSourceCodeGenerator is returned.
31 * @param generatedSourceDir the directory in which to put generated source files. If null,
32 * a default is used (see DefaultSourceCodeGenerator).
34 public SourceCodeGenerator getInstance(final String generatedSourceDir) {
35 boolean generateSource = Boolean.getBoolean(GENERATE_CODEC_SOURCE_PROP);
37 return new DefaultSourceCodeGenerator(generatedSourceDir);
40 return NULL_GENERATOR;