Index: lutinutil/src/java/org/codelutin/util/ApplicationDefinition.java diff -u /dev/null lutinutil/src/java/org/codelutin/util/ApplicationDefinition.java:1.1 --- /dev/null Wed Dec 5 02:58:08 2007 +++ lutinutil/src/java/org/codelutin/util/ApplicationDefinition.java Wed Dec 5 02:58:03 2007 @@ -0,0 +1,72 @@ +/** + * ##% Copyright (C) 2002, 2007 Code Lutin This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. ##%* + */ + +package org.codelutin.util; + +import org.codelutin.util.OptionParserAnnotationHelper.ArgumentA; +import org.codelutin.util.OptionParserAnnotationHelper.OptionA; +import org.codelutin.util.OptionParserAnnotationHelper.ApplicationA; + +/** + * This class represents a application definition (with his arguments and options) + * + * @author chemit + */ + +public class ApplicationDefinition { + + /** les options de l'application */ + protected OptionDefinition[] options; + + /** les arguments de l'application */ + protected OptionArgumentDefinition[] arguments; + + /** l'implantation du conteneur des arguments */ + protected Class argumentsImpl; + + public ApplicationDefinition(OptionArgumentDefinition[] arguments, OptionDefinition[] options,Class impl) { + this.arguments = arguments; + this.options = options; + this.argumentsImpl=impl; + } + + public ApplicationDefinition(ApplicationA anno) { + ArgumentA[] argumentAs = anno.arguments(); + OptionA[] optionAs = anno.options(); + this.argumentsImpl=anno.argumentsImpl(); + OptionArgumentDefinition[] _arguments = new OptionArgumentDefinition[argumentAs.length]; + for (int i = 0; i < argumentAs.length; i++) { + ArgumentA argumentA = argumentAs[i]; + _arguments[i] = new OptionArgumentDefinition(argumentA); + } + OptionDefinition[] _options = new OptionDefinition[optionAs.length]; + for (int i = 0; i < optionAs.length; i++) { + OptionA optionA = optionAs[i]; + _options[i] = new OptionDefinition(optionA); + } + this.arguments = _arguments; + this.options = _options; + } + + public OptionArgumentDefinition[] getArguments() { + return arguments; + } + + public OptionDefinition[] getOptions() { + return options; + } + + public Class getArgumentsImpl() { + return argumentsImpl; + } +}