All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.codegen.generator.GeneratorOptions Maven / Gradle / Ivy

There is a newer version: 3.5.0
Show newest version
package net.gdface.codegen.generator;

import java.io.File;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;

import net.gdface.codegen.CreateInterfaceSourceConstants;
import net.gdface.codegen.DuplicatedConstants;

public class GeneratorOptions implements CreateInterfaceSourceConstants, DuplicatedConstants  {
	protected final Options options = new Options();
	private final static GeneratorOptions instance = new GeneratorOptions();

	/**
	 * 加入可选项的选项子类可以重写此方法,以增加或减少选项
	 */
	protected void addOptionalOptions(){
		options.addOption(Option.builder(PACKAGE_OPTION).longOpt(PACKAGE_OPTION_LONG).desc(PACKAGE_OPTION_DESC)
				.numberOfArgs(1).required().build());
	}
	/**
	 * 
	 */
	protected GeneratorOptions() {
		addOptionalOptions();
		options.addOption(Option.builder(OUTPUT_LOCATION_OPTION).longOpt(OUTPUT_LOCATION_OPTION_LONG)
				.desc(OUTPUT_LOCATION_OPTION_DESC).numberOfArgs(1).type(File.class).required().build());
		options.addOption(Option.builder(TEMPLATE_ROOT_OPTION).longOpt(TEMPLATE_ROOT_OPTION_LONG).desc(TEMPLATE_ROOT_OPTION_DESC)
				.numberOfArgs(1).build());
		options.addOption(Option.builder(TEMPLATE_FOLDER_OPTION).longOpt(TEMPLATE_FOLDER_OPTION_LONG).desc(TEMPLATE_FOLDER_OPTION_DESC)
				.numberOfArgs(1).build());
		options.addOption(Option.builder(TEMPLATE_INCLUDE_OPTION).longOpt(TEMPLATE_INCLUDE_OPTION_LONG).desc(TEMPLATE_INCLUDE_OPTION_DESC)
				.numberOfArgs(1).build());
		options.addOption(Option.builder(EXCLUDE_VMS_OPTION).longOpt(EXCLUDE_VMS_OPTION_LONG).desc(EXCLUDE_VMS_OPTION_DESC)
				.numberOfArgs(1).build());
		options.addOption(Option.builder(INCLUDE_VMS_OPTION).longOpt(INCLUDE_VMS_OPTION_LONG).desc(INCLUDE_VMS_OPTION_DESC)
				.numberOfArgs(1).build());
		options.addOption(Option.builder(RESOURCE_LOADER_OPTION).longOpt(RESOURCE_LOADER_OPTION_LONG).desc(RESOURCE_LOADER_OPTION_DESC)
				.numberOfArgs(1).build());	
		options.addOption(Option.builder( DEFINE_OPTION).desc(DEFINE_OPTION_DESC).argName("property=value").numberOfArgs(2).valueSeparator().build());
	}

	/**
	 * @return instance
	 */
	public static GeneratorOptions getInstance() {
		return instance;
	}

	/**
	 * @return options
	 */
	public Options getOptions() {
		return options;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy