[Lutingenerator-commits] r451 - in lutingenerator/trunk/src/main/java/org/codelutin/generator: . models models/object models/object/validator models/object/xml models/state models/state/xml models/ui models/ui/impl models/ui/javaxml models/ui/xml
Author: chatellier Date: 2009-02-19 09:36:12 +0000 (Thu, 19 Feb 2009) New Revision: 451 Added: lutingenerator/trunk/src/main/java/org/codelutin/generator/package-info.java Removed: lutingenerator/trunk/src/main/java/org/codelutin/generator/package.html Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/ChildGenerator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/Generator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorException.java lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java lutingenerator/trunk/src/main/java/org/codelutin/generator/MonitorWriter.java lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/PackageValidator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/StateModelGenerator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/Model.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModel.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAssociationClass.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAttribute.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClass.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClassifier.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelInterface.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelOperation.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelParameter.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/AttributeNamesValidator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ClassNamesValidator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/NameBasedValidator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ObjectModelValidator.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/DigesterObjectModelRuleSet.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAssociationClassImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassifierImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplRef.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplSuperClassRef.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplTagValue.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelInterfaceImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelOperationImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelParameterImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModel.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelComplexState.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelSimpleState.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelState.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelStateChart.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelTransition.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/DigesterStateModelRuleSet.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelComplexeStateImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelSimpleStateImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateChartImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelTransitionImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModel.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelArguments.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelChild.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelConstraint.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelEvent.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelObject.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelProperty.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelArgumentsImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelChildImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelConstraintImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelEventImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelObjectImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelPropertyImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java Log: Format code, update code style Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * AbstractObjectModelGenerator.java +package org.codelutin.generator; + +import org.codelutin.generator.models.object.ObjectModelElement; + +/** + * AbstractObjectModelGenerator. * * Created: Jun 25, 2004 * @@ -27,28 +31,23 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class AbstractObjectModelGenerator extends ObjectModelGenerator { // AbstractObjectModelGenerator -package org.codelutin.generator; - -import org.codelutin.generator.models.object.ObjectModelElement; - -public class AbstractObjectModelGenerator extends ObjectModelGenerator{ // AbstractObjectModelGenerator - - public AbstractObjectModelGenerator(){ + public AbstractObjectModelGenerator() { super(); } - public AbstractObjectModelGenerator(Generator parent){ + public AbstractObjectModelGenerator(Generator parent) { super(parent); } - public String capitalizeName(ObjectModelElement e){ + public String capitalizeName(ObjectModelElement e) { String name = e.getName(); - if(name == null){ - throw new GeneratorException("L'element "+ e +" doit avoir un nom valide" ); - }else{ - return GeneratorUtil.capitalize(name); + if (name == null) { + throw new GeneratorException("Element " + e + + " must have an valid name"); } + return GeneratorUtil.capitalize(name); } } // AbstractObjectModelGenerator Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/ChildGenerator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/ChildGenerator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/ChildGenerator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,10 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * ChildGenerator.java +package org.codelutin.generator; + +/** + * ChildGenerator. * * Created: 5 août 2004 * @@ -26,52 +28,54 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator; - public abstract class ChildGenerator extends Generator { // ChildGenerator protected Generator parent = null; - public ChildGenerator(){ + public ChildGenerator() { super(); } - public ChildGenerator(Generator parent){ - setParent(parent); + public ChildGenerator(Generator parent) { + setParent(parent); } @Override - public String getProperty(String name){ - if(parent == null){ - return super.getProperty(name); - }else{ - return parent.getProperty(name); + public String getProperty(String name) { + String propName = null; + if (parent == null) { + propName = super.getProperty(name); + } else { + propName = parent.getProperty(name); } + return propName; } @Override - public boolean getOverwrite(){ - if(parent == null){ - return super.getOverwrite(); - }else{ - return parent.getOverwrite(); + public boolean getOverwrite() { + boolean overwrite = false; + if (parent == null) { + overwrite = super.getOverwrite(); + } else { + overwrite = parent.getOverwrite(); } + return overwrite; } @Override - protected long getLastModifiedSource(){ - if(parent == null){ - return super.getLastModifiedSource(); - }else{ - return parent.getLastModifiedSource(); + protected long getLastModifiedSource() { + long lastModified = 0; + if (parent == null) { + lastModified = super.getLastModifiedSource(); + } else { + lastModified = parent.getLastModifiedSource(); } + return lastModified; } public void setParent(Generator parent) { this.parent = parent; setEncoding(parent.getEncoding()); } - + } // ChildGenerator - Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/Generator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/Generator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/Generator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,6 +1,5 @@ -/* - * *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin +/* *##% Lutin Generator + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -33,11 +32,17 @@ /** * Generator. * - * @author cedric + * Created: 5 août 2004 + * + * @author Cedric Pineau <pineau@codelutin.com> + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ */ public abstract class Generator { - protected static final Log log = LogFactory.getLog(Generator.class); + protected static Log log = LogFactory.getLog(Generator.class); protected Properties properties = new Properties(); protected boolean overwrite = true; @@ -51,13 +56,12 @@ public Generator() { } - public void generate(File file, File destDir) { - generate(new File[]{file}, destDir); + generate(new File[] { file }, destDir); } public void generate(File file) { - generate(new File[]{file}, new File(".")); + generate(new File[] { file }, new File(".")); } public void setProperties(Properties p) { @@ -94,7 +98,9 @@ for (File file : files) { if (isNewerThanSource(file)) { lastModifiedSource = file.lastModified(); - log.debug("source date: " + lastModifiedSource + " files[i] date: " + file.lastModified() + "(" + file + ")"); + log.debug("source date: " + lastModifiedSource + + " files[i] date: " + file.lastModified() + "(" + file + + ")"); } } } @@ -111,7 +117,8 @@ */ protected boolean isNewerThanSource(File file) { if (log.isDebugEnabled()) { - log.debug("source date: " + getLastModifiedSource() + " file date: " + file.lastModified() + "(" + file + ")"); + log.debug("source date: " + getLastModifiedSource() + + " file date: " + file.lastModified() + "(" + file + ")"); } return file.lastModified() > getLastModifiedSource(); } @@ -121,29 +128,32 @@ } protected void write(File outputFile, MonitorWriter out) { + File write0utputFile = outputFile; if (out.isModified()) { try { - outputFile = outputFile.getCanonicalFile(); - outputFile.getParentFile().mkdirs(); + write0utputFile = outputFile.getCanonicalFile(); + write0utputFile.getParentFile().mkdirs(); Writer output = null; - - if ( encoding != null) { + + if (encoding != null) { if (log.isDebugEnabled()) { - log.debug("Force encoding to " + encoding + " : " + this); + log.debug("Force encoding to " + encoding + " : " + + this); } - output = new OutputStreamWriter(new FileOutputStream(outputFile), encoding); + output = new OutputStreamWriter(new FileOutputStream( + write0utputFile), encoding); + } else { + output = new OutputStreamWriter(new FileOutputStream( + write0utputFile)); } - else { - output = new OutputStreamWriter(new FileOutputStream(outputFile)); - } output.write(out.getBuffer().toString()); output.close(); } catch (IOException eee) { if (log.isWarnEnabled()) { - log.warn( - "Unable to write file : " + outputFile.getAbsolutePath(), eee); + log.warn("Unable to write file : " + + write0utputFile.getAbsolutePath(), eee); } throw new RuntimeException(eee); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorException.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorException.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorException.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,10 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * GeneratorException.java +package org.codelutin.generator; + +/** + * GeneratorException. * * Created: 21 juin 2004 * @@ -27,19 +29,16 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator; - public class GeneratorException extends RuntimeException { // GeneratorException - /** */ + /** serialVersionUID */ private static final long serialVersionUID = 5861583066249595300L; - public GeneratorException(String msg){ + public GeneratorException(String msg) { super(msg); } - public GeneratorException(String msg, Throwable e){ + public GeneratorException(String msg, Throwable e) { super(msg, e); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorTask.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -16,16 +16,9 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ /* * - * GeneratorTemplatesTask.java + * .java * - * Created: 14 janv. 2004 - * - * @author Benjamin Poussin <poussin@codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ + * */ package org.codelutin.generator; @@ -43,59 +36,71 @@ import java.util.logging.Logger; /** - * exemple d'utilisation dans ant <generator + * Ant generator Task. + * + * Exemple d'utilisation dans ant <generator * template="org.codelutin.generator.generators.persistence.TopiaModelToDTOGenerator.java,org.codelutin.generator.generators.persistence.TopiaModelToTJDOGenerator.java" * destdir="target/gen/java" srcdir="target/gen/model" includes="*.xmi"/> + * + * Created: 14 janv. 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ */ public class GeneratorTask extends MatchingTask { // GeneratorTask - public GeneratorTask() { - } + public GeneratorTask() { + } - protected void doExecute(File srcFile, File destDir, Generator[] generators) - throws BuildException { - doExecute(new File[] { srcFile }, destDir, generators); + protected void doExecute(File srcFile, File destDir, Generator[] generators) + throws BuildException { + doExecute(new File[] { srcFile }, destDir, generators); - } + } - protected void doExecute(File[] srcFiles, File destDir, - Generator[] generators) throws BuildException { + protected void doExecute(File[] srcFiles, File destDir, + Generator[] generators) throws BuildException { for (Generator generator : generators) { if (generator != null) { - log("Applying " + generator.getClass().getName() + " into " + destDir); + log("Applying " + generator.getClass().getName() + " into " + + destDir); generator.setProperties(properties); generator.setOverwrite(overwrite); generator.generate(srcFiles, destDir); } } - } + } - protected String templates = null; + protected String templates = null; protected List<String> excludeTemplates; protected File srcDir = null; - protected File srcFile = null; + protected File srcFile = null; - protected File destDir = null; + protected File destDir = null; - protected Properties properties = new Properties(); + protected Properties properties = new Properties(); - protected boolean overwrite = true; + protected boolean overwrite = true; // to enable a customized classloader protected ClassLoader loader; protected String encoding; - public void setOverwrite(boolean v) { - overwrite = v; - } + public void setOverwrite(boolean v) { + overwrite = v; + } - public void setTemplates(String templates) { - this.templates = templates; - } + public void setTemplates(String templates) { + this.templates = templates; + } public void setExcludeTemplates(List<String> excludeTemplates) { this.excludeTemplates = excludeTemplates; @@ -106,30 +111,30 @@ } /** - * Permet d'ajouter des properties. exemple: toto=1,package=org.codelutin - * @param properties TODO + * Permet d'ajouter des properties. exemple: toto=1,package=org.codelutin + * @param properties properties */ - public void setProperties(String properties) { - String[] props = properties.split(","); + public void setProperties(String properties) { + String[] props = properties.split(","); for (String prop : props) { String[] pv = prop.split("="); this.properties.put(pv[0], pv[1]); } - Logger.getLogger(getClass().getName() + ".setProperties").log( - Level.FINE, "Properties " + this.properties); - } + Logger.getLogger(getClass().getName() + ".setProperties").log( + Level.FINE, "Properties " + this.properties); + } - public void setSrcdir(File srcDir) { - this.srcDir = srcDir; - } + public void setSrcdir(File srcDir) { + this.srcDir = srcDir; + } - public void setDestdir(File destDir) { - this.destDir = destDir; - } + public void setDestdir(File destDir) { + this.destDir = destDir; + } - public void setSrcFile(File srcFile) { - this.srcFile = srcFile; - } + public void setSrcFile(File srcFile) { + this.srcFile = srcFile; + } public void setLoader(ClassLoader loader) { this.loader = loader; @@ -137,12 +142,12 @@ @Override public void execute() throws BuildException { - Generator[] generators; - if (templates == null) { - throw new BuildException("templates attribute must be set!", - getLocation()); - } - List<String> templateGenerators = Arrays.asList(templates.split(",")); + Generator[] generators; + if (templates == null) { + throw new BuildException("templates attribute must be set!", + getLocation()); + } + List<String> templateGenerators = Arrays.asList(templates.split(",")); for (Iterator<String> it = templateGenerators.iterator(); it.hasNext();) { String templateGenerator = it.next(); if (excludeTemplates.contains(templateGenerator)) { @@ -150,83 +155,82 @@ } } generators = new Generator[templateGenerators.size()]; - for (int i = 0; i < templateGenerators.size(); i++) { + for (int i = 0; i < templateGenerators.size(); i++) { String templateName = templateGenerators.get(i); try { generators[i] = newGeneratorInstance(templateName); - + //generators[i] = (Generator) Class.forName(templateName).newInstance(); generators[i].setExcludeTemplates(excludeTemplates); generators[i].setEncoding(encoding); } catch (ClassCastException eee) { - System.out.println("Generator don't herite Generator Class : " - + templateName); - eee.printStackTrace(); - } catch (ClassNotFoundException eee) { - System.out.println("Unable to find generator : " - + templateName); - eee.printStackTrace(); - } catch (InstantiationException eee) { - System.out.println("Unable to instanciate template : " - + templateName); - eee.printStackTrace(); - } catch (IllegalAccessException eee) { - System.out.println("Unable to parse topia input file : " - + templateName); - eee.printStackTrace(); - } - } + System.out.println("Generator don't herite Generator Class : " + + templateName); + eee.printStackTrace(); + } catch (ClassNotFoundException eee) { + System.out + .println("Unable to find generator : " + templateName); + eee.printStackTrace(); + } catch (InstantiationException eee) { + System.out.println("Unable to instanciate template : " + + templateName); + eee.printStackTrace(); + } catch (IllegalAccessException eee) { + System.out.println("Unable to parse topia input file : " + + templateName); + eee.printStackTrace(); + } + } - if (generators == null) { - throw new BuildException("templates " + templates - + " can't be found!", getLocation()); - } + if (destDir == null) { + throw new BuildException("destDir attribute must be set!", + getLocation()); + } - if (destDir == null) { - throw new BuildException("destDir attribute must be set!", - getLocation()); - } + if (!destDir.isDirectory()) { + throw new BuildException("destination directory \"" + destDir + + "\" does not exist or is not a directory", getLocation()); + } - if (!destDir.isDirectory()) { - throw new BuildException("destination directory \"" + destDir - + "\" does not exist or is not a directory", getLocation()); - } + if (srcFile == null && srcDir == null) { + throw new BuildException( + "srcFile or srcdir attribute must be set!", getLocation()); + } - if (srcFile == null && srcDir == null) { - throw new BuildException( - "srcFile or srcdir attribute must be set!", getLocation()); - } + if (srcFile != null && !srcFile.isFile()) { + throw new BuildException("src file \"" + srcFile + + "\" does not exist or is not a file", getLocation()); + } - if (srcFile != null && !srcFile.isFile()) { - throw new BuildException("src file \"" + srcFile - + "\" does not exist or is not a file", getLocation()); - } + if (srcFile != null) { + // generate the source files + doExecute(srcFile, destDir, generators); + } else { + DirectoryScanner scanner; + String[] includedFilenames; + scanner = getDirectoryScanner(srcDir); - if (srcFile != null) { - // generate the source files - doExecute(srcFile, destDir, generators); - } else { - DirectoryScanner scanner; - String[] includedFilenames; - scanner = getDirectoryScanner(srcDir); + // Process all the files marked for styling + includedFilenames = scanner.getIncludedFiles(); + File[] includedFiles = new File[includedFilenames.length]; + for (int i = 0; i < includedFilenames.length; ++i) { + includedFiles[i] = new File(srcDir, includedFilenames[i]); + } + doExecute(includedFiles, destDir, generators); + } + } - // Process all the files marked for styling - includedFilenames = scanner.getIncludedFiles(); - File[] includedFiles = new File[includedFilenames.length]; - for (int i = 0; i < includedFilenames.length; ++i) { - includedFiles[i] = new File(srcDir, includedFilenames[i]); - } - doExecute(includedFiles, destDir, generators); - } - } - - protected Generator newGeneratorInstance(String fqn) throws ClassNotFoundException, IllegalAccessException, InstantiationException { - if (loader==null) { - return (Generator) Class.forName(fqn).newInstance(); + protected Generator newGeneratorInstance(String fqn) + throws ClassNotFoundException, IllegalAccessException, + InstantiationException { + Generator newInstance = null; + if (loader == null) { + newInstance = (Generator) Class.forName(fqn).newInstance(); } else { - - return (Generator) Class.forName(fqn,true,loader).newInstance(); + newInstance = (Generator) Class.forName(fqn, true, loader) + .newInstance(); } + return newInstance; } } // GeneratorTask Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,6 +1,5 @@ -/* - * *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin +/* *##% Lutin Generator + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -17,16 +16,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ -/* * - * Util.java Created: 25 ao?t 2003 - * - *@author Benjamin Poussin <poussin@codelutin.com> - * - * Copyright Code Lutin - *@version $Revision: 317 $ Mise a jour: $Date: 2008-09-25 10:45:22 +0200 (jeu 25 sep 2008) $ par : - * $Author: thimel $ - */ - package org.codelutin.generator; import java.io.File; @@ -44,38 +33,45 @@ import org.codelutin.generator.models.object.ObjectModelParameter; /** - * TODO Description of the Class + * GeneratorUtil. + * + * Created: 25 ao?t 2003 * - *@author poussin - *@created 26 ao?t 2003 + * @author Benjamin Poussin <poussin@codelutin.com> Copyright Code Lutin + * @version $Revision: 317 $ + * Mise à jour: $Date: 2008-09-25 10:45:22 +0200 (jeu 25 sep 2008) $ + * By : $Author: thimel $ */ public class GeneratorUtil { /** - * return parent package of given package (return given package if it is a root package) - * eg : org.codelutin.generator.models -> org.codelutin.generator - * eg : org -> org - * warning : org.codelutin.generator. -> org.codelutin.generator - */ + * return parent package of given package (return given package if it is a root package) + * eg : org.codelutin.generator.models -> org.codelutin.generator + * eg : org -> org + * warning : org.codelutin.generator. -> org.codelutin.generator + * + * @param packageName package + * @return parent package of given package + */ public static String getParentPackageName(String packageName) { String parentPackageName = packageName; int index = packageName.lastIndexOf('.'); if (index != -1) { - parentPackageName = packageName.substring(0,index); + parentPackageName = packageName.substring(0, index); } return parentPackageName; } /** - * return class name fr given fully qualified name (return given name if it is not fully qualified) - * eg : org.codelutin.generator.models.ObjectClass -> ObjectClass - * eg : ObjectClass-> ObjectClass - */ + * return class name fr given fully qualified name (return given name if it is not fully qualified) + * eg : org.codelutin.generator.models.ObjectClass -> ObjectClass + * eg : ObjectClass-> ObjectClass + */ public static String getClassNameFromQualifiedName(String qualifiedName) { String className = qualifiedName; int index = qualifiedName.lastIndexOf('.'); if (index != -1) { - className = qualifiedName.substring(index+1); + className = qualifiedName.substring(index + 1); } return className; } @@ -87,17 +83,16 @@ return qualifiedName.replace('.', File.separatorChar); } - /** - * return all classifiers belonging to the given package recursively. The Collection may be empty. - * @see ObjectModelCassifier - * - * @return a Collection containing all classifiers belonging to the given package recursively. - */ - public static Collection<ObjectModelClassifier> getClassifiers(ObjectModel model, String packageName) { + * return all classifiers belonging to the given package recursively. The Collection may be empty. + * @see ObjectModelCassifier + * + * @return a Collection containing all classifiers belonging to the given package recursively. + */ + public static Collection<ObjectModelClassifier> getClassifiers( + ObjectModel model, String packageName) { List<ObjectModelClassifier> classifiers = new ArrayList<ObjectModelClassifier>(); - for (Iterator i = model.getClassifiers().iterator(); i.hasNext();) { - ObjectModelClassifier classifier = (ObjectModelClassifier) i.next(); + for (ObjectModelClassifier classifier : model.getClassifiers()) { if (classifier.getPackageName().startsWith(packageName)) { classifiers.add(classifier); } @@ -106,7 +101,7 @@ } /** - * @see {@link #getAttributeType(ObjectModelParameter, boolean)} + * @see #getAttributeType(ObjectModelParameter, boolean) */ public static String getAttributeType(ObjectModelParameter attribute) { return getAttributeType(attribute, false); @@ -119,11 +114,12 @@ * @param attribute * @return */ - public static String getAttributeType(ObjectModelParameter attribute, boolean useGenerics) { + public static String getAttributeType(ObjectModelParameter attribute, + boolean useGenerics) { String result; if (attribute instanceof ObjectModelAttribute - && isNMultiplicity((ObjectModelAttribute)attribute)) { - if (((ObjectModelAttribute)attribute).isOrdered()) { + && isNMultiplicity((ObjectModelAttribute) attribute)) { + if (((ObjectModelAttribute) attribute).isOrdered()) { result = "java.util.List"; } else { result = "java.util.Collection"; @@ -139,16 +135,17 @@ /** * Indicates if the specified attribute has a primitive type (byte, boolean, ...) - * @return true if the atribute has a primitive type + * @return true if the attribute has a primitive type */ - public static boolean isPrimitiveAttributeType(ObjectModelAttribute attribute) { - if (isNMultiplicity(attribute)) - return false; - String type = attribute.getType(); - return ("byte".equals(type) || "short".equals(type) || - "int".equals(type) || "long".equals(type) || - "float".equals(type) || "double".equals(type) || - "char".equals(type) || "boolean".equals(type)); + public static boolean isPrimitiveAttributeType( + ObjectModelAttribute attribute) { + if (isNMultiplicity(attribute)) + return false; + String type = attribute.getType(); + return ("byte".equals(type) || "short".equals(type) + || "int".equals(type) || "long".equals(type) + || "float".equals(type) || "double".equals(type) + || "char".equals(type) || "boolean".equals(type)); } /** @@ -156,59 +153,89 @@ * @return a String with the corresponding attribute init value */ public static String getInitValue(ObjectModelAttribute attribute) { - if (isNMultiplicity(attribute)) return "new java.util.ArrayList()"; + if (isNMultiplicity(attribute)) + return "new java.util.ArrayList()"; return getInitValue(attribute.getType()); } - - public static String getInitValue(String type){ - if ("byte".equals(type)) return "0"; - if ("short".equals(type)) return "0"; - if ("int".equals(type)) return "0"; - if ("long".equals(type)) return "0"; - if ("float".equals(type)) return "0"; - if ("double".equals(type)) return "0"; - if ("char".equals(type)) return "\u0000"; - if ("boolean".equals(type)) return "false"; - if ("java.lang.String".equals(type)) return null; - if ("java.lang.Date".equals(type)) return null; + + public static String getInitValue(String type) { + if ("byte".equals(type)) + return "0"; + if ("short".equals(type)) + return "0"; + if ("int".equals(type)) + return "0"; + if ("long".equals(type)) + return "0"; + if ("float".equals(type)) + return "0"; + if ("double".equals(type)) + return "0"; + if ("char".equals(type)) + return "\u0000"; + if ("boolean".equals(type)) + return "false"; + if ("java.lang.String".equals(type)) + return null; + if ("java.lang.Date".equals(type)) + return null; return null; } - public static String getCastValue(String type, String o){ - if ("byte".equals(type)) return "((Byte)"+o+").byteValue()"; - if ("short".equals(type)) return "((Short)"+o+").shortValue()"; - if ("int".equals(type)) return "((Integer)"+o+").intValue()"; - if ("long".equals(type)) return "((Long)"+o+").longValue()"; - if ("float".equals(type)) return "((Float)"+o+").floatValue()"; - if ("double".equals(type)) return "((Double)"+o+").doubleValue()"; - if ("char".equals(type)) return "((Character)"+o+").charValue()"; - if ("boolean".equals(type)) return "((Boolean)"+o+").booleanValue()"; - if ("void".equals(type)) return ""; + public static String getCastValue(String type, String o) { + if ("byte".equals(type)) + return "((Byte)" + o + ").byteValue()"; + if ("short".equals(type)) + return "((Short)" + o + ").shortValue()"; + if ("int".equals(type)) + return "((Integer)" + o + ").intValue()"; + if ("long".equals(type)) + return "((Long)" + o + ").longValue()"; + if ("float".equals(type)) + return "((Float)" + o + ").floatValue()"; + if ("double".equals(type)) + return "((Double)" + o + ").doubleValue()"; + if ("char".equals(type)) + return "((Character)" + o + ").charValue()"; + if ("boolean".equals(type)) + return "((Boolean)" + o + ").booleanValue()"; + if ("void".equals(type)) + return ""; return "(" + type + ")" + o; } - public static String getHashCodeExpression(String type, String o){ + public static String getHashCodeExpression(String type, String o) { String result = o; - if ("byte".equals(type)) result = "new Byte("+o+")"; - if ("short".equals(type)) result = "new Short("+o+")"; - if ("int".equals(type)) result = "new Integer("+o+")"; - if ("long".equals(type)) result = "new Long("+o+")"; - if ("float".equals(type)) result = "new Float("+o+")"; - if ("double".equals(type)) result = "new Double("+o+")"; - if ("char".equals(type)) result = "new Character("+o+")"; - if ("boolean".equals(type)) result = "new Boolean("+o+")"; - return result +".hashCode()"; + if ("byte".equals(type)) + result = "new Byte(" + o + ")"; + if ("short".equals(type)) + result = "new Short(" + o + ")"; + if ("int".equals(type)) + result = "new Integer(" + o + ")"; + if ("long".equals(type)) + result = "new Long(" + o + ")"; + if ("float".equals(type)) + result = "new Float(" + o + ")"; + if ("double".equals(type)) + result = "new Double(" + o + ")"; + if ("char".equals(type)) + result = "new Character(" + o + ")"; + if ("boolean".equals(type)) + result = "new Boolean(" + o + ")"; + return result + ".hashCode()"; } /** * Retourne la chaine de caractere dont on a besoin pour la declaration * des parametres d'une methode. */ - public static String getMethodParameterDeclaration(Collection params){ + public static String getMethodParameterDeclaration( + Collection<ObjectModelParameter> params) { StringBuffer result = new StringBuffer(); - for (Iterator j = params.iterator(); j.hasNext();){ - ObjectModelParameter parameter = (ObjectModelParameter) j.next(); - result.append(getAttributeType(parameter)+" "+parameter.getName()); + for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) { + ObjectModelParameter parameter = j.next(); + result.append(getAttributeType(parameter) + " " + + parameter.getName()); if (j.hasNext()) { result.append(", "); } @@ -220,10 +247,11 @@ * Retourne la chaine de caractere qui represente chaque nom de parametre * separer par des ','. */ - public static String getMethodParameterListName(Collection params){ + public static String getMethodParameterListName( + Collection<ObjectModelParameter> params) { StringBuffer result = new StringBuffer(); - for (Iterator j = params.iterator(); j.hasNext();){ - ObjectModelParameter parameter = (ObjectModelParameter) j.next(); + for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) { + ObjectModelParameter parameter = j.next(); result.append(parameter.getName()); if (j.hasNext()) { result.append(", "); @@ -236,24 +264,24 @@ *@return vrai si la cardinalite de l'attribut est superieur a 1, c-a-d * si MaxMultiplicity == -1 ou > 1 */ - public static boolean isNMultiplicity(ObjectModelAttribute attribute){ + public static boolean isNMultiplicity(ObjectModelAttribute attribute) { return isNMultiplicity(attribute.getMaxMultiplicity()); } - - public static boolean isNMultiplicity(int multiplicity){ - return (multiplicity == -1) || (multiplicity>1); + + public static boolean isNMultiplicity(int multiplicity) { + return (multiplicity == -1) || (multiplicity > 1); } - + /** * @return true is the multiplicity of the given attribute is exactly 1 */ public static boolean isOneMultiplicity(ObjectModelAttribute attribute) { - if (attribute == null) - return false; - return ((attribute.getMinMultiplicity() == 1) && (attribute.getMaxMultiplicity() == 1)); + if (attribute == null) + return false; + return ((attribute.getMinMultiplicity() == 1) && (attribute + .getMaxMultiplicity() == 1)); } - /** * */ @@ -267,7 +295,7 @@ * @param word word to Capitalize * @return Capitalized word */ - public static String capitalize(String word){ + public static String capitalize(String word) { return StringUtils.capitalize(word); } @@ -282,57 +310,77 @@ * @return true if the given attribute is a composition (composant of the reverse attribute) */ public static boolean isComposition(ObjectModelAttribute attribute) { - if (attribute == null) - return false; - if (attribute.getReverseAttribute() == null) - return false; - return attribute.getReverseAttribute().isComposite(); + + boolean composition = false; + if (attribute != null && attribute.getReverseAttribute() != null) { + composition = attribute.getReverseAttribute().isComposite(); + } + return composition; } - + public static String getParsingExpression(String type, + String attributeStringName) { + if ("byte".equals(type)) + return "Byte.parseByte(" + attributeStringName + ")"; + if ("short".equals(type)) + return "Short.parseShort(" + attributeStringName + ")"; + if ("int".equals(type)) + return "Integer.parseInt(" + attributeStringName + ")"; + if ("long".equals(type)) + return "Long.parseLong(" + attributeStringName + ")"; + if ("float".equals(type)) + return "Float.parseFloat(" + attributeStringName + ")"; + if ("double".equals(type)) + return "Double.parseDouble(" + attributeStringName + ")"; + if ("char".equals(type)) + return attributeStringName + ".charAt(0)"; + if ("boolean".equals(type)) + return "Boolean.parseBoolean(" + attributeStringName + ")"; + if ("java.lang.String".equals(type)) + return attributeStringName; + if ("java.util.Date".equals(type)) + return "dateParser.parse(" + attributeStringName + ")"; + return null; + } + public static String getFormatingExpression(String type, + String attributeStringName) { + if ("byte".equals(type)) + return "Byte.toString(" + attributeStringName + ")"; + if ("short".equals(type)) + return "Short.toString(" + attributeStringName + ")"; + if ("int".equals(type)) + return "Integer.toString(" + attributeStringName + ")"; + if ("long".equals(type)) + return "Long.toString(" + attributeStringName + ")"; + if ("float".equals(type)) + return "Float.toString(" + attributeStringName + ")"; + if ("double".equals(type)) + return "Double.toString(" + attributeStringName + ")"; + if ("char".equals(type)) + return "Character.toString(" + attributeStringName + ")"; + if ("boolean".equals(type)) + return "Boolean.parseBoolean(" + attributeStringName + ")"; + if ("java.lang.String".equals(type)) + return attributeStringName; + if ("java.util.Date".equals(type)) + return "dateParser.format(" + attributeStringName + ")"; + return null; + } - public static String getParsingExpression(String type, String attributeStringName){ - if ("byte".equals(type)) return "Byte.parseByte("+attributeStringName+")"; - if ("short".equals(type)) return "Short.parseShort("+attributeStringName+")"; - if ("int".equals(type)) return "Integer.parseInt("+attributeStringName+")"; - if ("long".equals(type)) return "Long.parseLong("+attributeStringName+")"; - if ("float".equals(type)) return "Float.parseFloat("+attributeStringName+")"; - if ("double".equals(type)) return "Double.parseDouble("+attributeStringName+")"; - if ("char".equals(type)) return attributeStringName+".charAt(0)"; - if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")"; - if ("java.lang.String".equals(type)) return attributeStringName; - if ("java.util.Date".equals(type)) return "dateParser.parse("+attributeStringName+")"; - return null; - } - - public static String getFormatingExpression(String type, String attributeStringName){ - if ("byte".equals(type)) return "Byte.toString("+attributeStringName+")"; - if ("short".equals(type)) return "Short.toString("+attributeStringName+")"; - if ("int".equals(type)) return "Integer.toString("+attributeStringName+")"; - if ("long".equals(type)) return "Long.toString("+attributeStringName+")"; - if ("float".equals(type)) return "Float.toString("+attributeStringName+")"; - if ("double".equals(type)) return "Double.toString("+attributeStringName+")"; - if ("char".equals(type)) return "Character.toString("+attributeStringName+")"; - if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")"; - if ("java.lang.String".equals(type)) return attributeStringName; - if ("java.util.Date".equals(type)) return "dateParser.format("+attributeStringName+")"; - return null; - } - - - /** - * Retourne la chaine de caractere dont on a besoin pour la declaration - * des parametres d'une methode. - */ - public static String getOperationParametersListDeclaration(ObjectModelOperation operation){ + * Retourne la chaine de caractere dont on a besoin pour la declaration + * des parametres d'une methode. + */ + public static String getOperationParametersListDeclaration( + ObjectModelOperation operation) { StringBuffer result = new StringBuffer(); - - Collection params = operation.getParameters(); - for (Iterator j = params.iterator(); j.hasNext();){ - ObjectModelParameter parameter = (ObjectModelParameter) j.next(); - result.append(getAttributeType(parameter)+" "+parameter.getName()); + + Collection<ObjectModelParameter> params = operation.getParameters(); + for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) { + ObjectModelParameter parameter = j.next(); + result.append(getAttributeType(parameter) + " " + + parameter.getName()); if (j.hasNext()) { result.append(", "); } @@ -344,11 +392,12 @@ * Retourne la chaine de caractere qui represente chaque nom de parametre * separer par des ','. */ - public static String getOperationParametersListName(ObjectModelOperation operation) { - Collection params = operation.getParameters(); + public static String getOperationParametersListName( + ObjectModelOperation operation) { + Collection<ObjectModelParameter> params = operation.getParameters(); StringBuffer result = new StringBuffer(); - for (Iterator j = params.iterator(); j.hasNext();){ - ObjectModelParameter parameter = (ObjectModelParameter) j.next(); + for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) { + ObjectModelParameter parameter = j.next(); result.append(parameter.getName()); if (j.hasNext()) { result.append(", "); @@ -360,13 +409,14 @@ /** * Renvoie sous forme de String la liste des déclarations des attributes d'une classe donnée */ - public static String getClassAttributesListDeclaration(ObjectModelClass clazz) { + public static String getClassAttributesListDeclaration( + ObjectModelClass clazz) { StringBuffer result = new StringBuffer(); - - Collection params = clazz.getAttributes(); - for (Iterator j = params.iterator(); j.hasNext();){ - ObjectModelAttribute attr = (ObjectModelAttribute) j.next(); - result.append(getAttributeType(attr, true)+" "+attr.getName()); + + Collection<ObjectModelAttribute> params = clazz.getAttributes(); + for (Iterator<ObjectModelAttribute> j = params.iterator(); j.hasNext();) { + ObjectModelAttribute attr = j.next(); + result.append(getAttributeType(attr, true) + " " + attr.getName()); if (j.hasNext()) { result.append(", "); } @@ -381,9 +431,12 @@ * @return true, si l'attribut est premier (lexico ou pas de reverse attribute), false dans les autres cas */ public static boolean isFirstAttribute(ObjectModelAttribute attr) { - if (attr.getReverseAttribute() == null) - return true; - return (attr.getName().compareTo(attr.getReverseAttribute().getName()) < 0); + boolean firstAttribute = true; + if (attr.getReverseAttribute() != null) { + firstAttribute = (attr.getName().compareTo( + attr.getReverseAttribute().getName()) < 0); + } + return firstAttribute; } } // Util Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/MonitorWriter.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/MonitorWriter.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/MonitorWriter.java 2009-02-19 09:36:12 UTC (rev 451) @@ -15,19 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* MonitorWriter.java -* -* Created: Jun 8, 2004 -* -* @author Benjamin Poussin <poussin@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - package org.codelutin.generator; import java.io.FilterWriter; @@ -35,10 +22,19 @@ import java.io.StringWriter; /** -* Permet de savoir si on a ecrit dans le flux ou non. L'ecriture d'une chaine -* vide a le meme comportement que l'ecriture d'une vrai chaine. -* De cette façon meme les fichiers peuvent être créer. -*/ + * Permet de savoir si on a ecrit dans le flux ou non. L'ecriture d'une chaine + * vide a le meme comportement que l'ecriture d'une vrai chaine. + * De cette façon meme les fichiers peuvent être créer. + * + * Created: Jun 8, 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public class MonitorWriter extends FilterWriter { // MonitorWriter boolean modified = false; @@ -49,7 +45,7 @@ this.out = out; } - public StringBuffer getBuffer(){ + public StringBuffer getBuffer() { return out.getBuffer(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,18 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/******************************************************************************* - * ObjectModelGenerator.java - * - * Created: 14 mars 2004 - * - * @author Benjamin Poussin <poussin@codelutin.com> Copyright Code Lutin - * - * @version $Revision$ - * - * Mise a jour: $Date$ par : $Author$ - */ - package org.codelutin.generator; import org.apache.commons.digester.Digester; @@ -85,20 +73,24 @@ * vous souhaitez utiliser le processeur * org.codelutin.processor.filters.GeneratorTemplatesFilter pour vous * s'implifier l'écriture des templates. + * + * Created: 14 mars 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com> Copyright Code Lutin + * + * @version $Revision$ + * + * Mise a jour: $Date$ par : $Author$ */ public class ObjectModelGenerator extends ChildGenerator { - /** - * Logger for this class - */ - private static final Log log = LogFactory - .getLog(ObjectModelGenerator.class); + /** Logger for this class. */ + private static Log log = LogFactory.getLog(ObjectModelGenerator.class); protected ObjectModel model = null; /** - * - * l'expression réguliere match les chaines de type + * L'expression réguliere match les chaines de type * <package.ClassName>.<class|attribute|operation>.[name].<stereotype|tagvalue>.[tag] * fr.isisfish.entities.Population.class.stereotype=entity * fr.isisfish.entities.Population.class.tagvalue.persistenceType=flatfile @@ -107,7 +99,7 @@ * fr.isisfish.entities.Population.operation.getRegion.stereotype=... * fr.isisfish.entities.Population.operation.getRegion.tagvalue.pk=... */ - Pattern propertiesPattern = Pattern + protected Pattern propertiesPattern = Pattern .compile("((?:[_a-zA-Z0-9]+\\.)+(?:_?[A-Z][_a-zA-Z0-9]*\\.)+)(?:(class|attribute|operation)\\.)(?:([_a-z0-9][_a-zA-Z0-9]*)\\.)?(?:(stereotype|tagvalue)\\.?)([_a-z0-9][_a-zA-Z0-9]*)?"); public ObjectModelGenerator() { @@ -121,7 +113,7 @@ public ObjectModel getModel() { return model; } - + /** * @param files les noms des fichiers existant contenant du XML représentant * des ObjectModel. Il est automatiquement recherche un fichier de @@ -133,21 +125,19 @@ public void generate(File[] files, File destDir) { setLastModifiedSource(files); ObjectModel objectModel = new ObjectModelImpl(); - + // Digester parser configuration Digester digester = new Digester(); - digester.addRuleSet(new DigesterObjectModelRuleSet()); + digester.addRuleSet(new DigesterObjectModelRuleSet()); for (File file : files) { try { digester.push(objectModel); objectModel = (ObjectModel) digester.parse(file); } catch (IOException e) { - log.warn("Unable to parse ObjectModel input file : " - + file, e); + log.warn("Unable to parse ObjectModel input file : " + file, e); } catch (SAXException e) { - log.warn("Unable to parse ObjectModel input file : " - + file, e); + log.warn("Unable to parse ObjectModel input file : " + file, e); } // recherche est charge le fichier propriete associe au modele @@ -174,20 +164,23 @@ } // on ajoute les proprietes du fichier associe au model - for (Enumeration e = prop.keys(); e.hasMoreElements();) { + for (Enumeration<Object> e = prop.keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); String value = prop.getProperty(key); if (key.startsWith("model")) { if (!key.startsWith("model.tagvalue.")) { - log.warn("only tagvalue is allowed on model in properties"); + log + .warn("only tagvalue is allowed on model in properties"); } else { - String tag = key.substring("model.tagvalue.".length()); + String tag = key.substring("model.tagvalue." + .length()); ObjectModelImplTagValue tagvalue = new ObjectModelImplTagValue(); tagvalue.setName(tag); tagvalue.setValue(value); - ((ObjectModelImpl) objectModel).addTagValue(tagvalue); + ((ObjectModelImpl) objectModel) + .addTagValue(tagvalue); } } else { @@ -210,10 +203,10 @@ String tag = matcher.group(5); if (log.isDebugEnabled()) { - log.debug("Propriete: '" + key + "' => " + "fqn:" - + fqn + " target:" + target - + " targetName:" + targetName + " type:" - + type + " tag:" + tag); + log.debug("Propriete: '" + key + "' => " + + "fqn:" + fqn + " target:" + target + + " targetName:" + targetName + + " type:" + type + " tag:" + tag); } ObjectModelClassifier omc = objectModel @@ -229,8 +222,7 @@ elems.add(classmodel .getAttribute(targetName)); } else if ("operation".equals(target)) { - elems.addAll(omc - .getOperations(targetName)); + elems.addAll(omc.getOperations(targetName)); } for (Object elem1 : elems) { ObjectModelElementImpl elem = (ObjectModelElementImpl) elem1; @@ -248,10 +240,14 @@ tagvalue.setName(tag); tagvalue.setValue(value); if (log.isDebugEnabled()) { - log.debug("tagValue:"+tagvalue+", tag:" + tag + ", value:" + value+", element:"+elem); + log.debug("tagValue:" + tagvalue + + ", tag:" + tag + + ", value:" + value + + ", element:" + elem); } if (elem == null) { - log.warn("can not attach tagValue " + key); + log.warn("can not attach tagValue " + + key); } else { elem.addTagValue(tagvalue); } @@ -260,7 +256,10 @@ } else { // TODO il faudra avoir des methodes d'acces en // Set sur l'interface pour eviter ce message - log.warn("Can't add properties to model, it's not an ObjectModelClassifierImpl"); + if (log.isWarnEnabled()) { + log + .warn("Can't add properties to model, it's not an ObjectModelClassifierImpl"); + } } } } @@ -289,14 +288,14 @@ * écrire alors le fichier sera généré. * @param model * @param destDir - * @throws java.io.IOException + * @throws IOException */ public void generate(ObjectModel model, File destDir) throws IOException { - long newTime = System.currentTimeMillis(); + + // generateFromModel { + this.model = model; - this.model = model; - String filename = getFilenameForModel(model); File outputFile = getDestinationFile(destDir, filename); if (!getOverwrite() && isNewerThanSource(outputFile)) { @@ -305,7 +304,8 @@ } } else { if (!outputFile.exists() && log.isDebugEnabled()) { - log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">"); + log.debug("not up-to-date " + outputFile.lastModified() + + " <" + outputFile + ">"); } try { StringWriter out = new StringWriter(); @@ -313,14 +313,18 @@ generateFromModel(monitorOut, model); write(outputFile, monitorOut); } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " + outputFile); - throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee); + log.warn("Erreur lors de la génération du fichier " + + outputFile); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + + outputFile, eee); } } } + // generateFromClassifier for (ObjectModelClassifier clazz : model.getClassifiers()) { - + String filename = getFilenameForClassifier(clazz); File outputFile = getDestinationFile(destDir, filename); if (!getOverwrite() && isNewerThanSource(outputFile)) { @@ -330,7 +334,8 @@ continue; } if (!outputFile.exists() && log.isDebugEnabled()) { - log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">"); + log.debug("not up-to-date " + outputFile.lastModified() + " <" + + outputFile + ">"); } try { StringWriter out = new StringWriter(); @@ -338,11 +343,15 @@ generateFromClassifier(monitorOut, clazz); write(outputFile, monitorOut); } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " + outputFile); - throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee); + log.warn("Erreur lors de la génération du fichier " + + outputFile); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + outputFile, + eee); } } + // generateFromInterface for (ObjectModelInterface interfacez : model.getInterfaces()) { String filename = getFilenameForInterface(interfacez); @@ -354,7 +363,8 @@ continue; } if (!outputFile.exists() && log.isDebugEnabled()) { - log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">"); + log.debug("not up-to-date " + outputFile.lastModified() + " <" + + outputFile + ">"); } try { StringWriter out = new StringWriter(); @@ -362,13 +372,17 @@ generateFromInterface(monitorOut, interfacez); write(outputFile, monitorOut); } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " + outputFile); - throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee); + log.warn("Erreur lors de la génération du fichier " + + outputFile); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + outputFile, + eee); } } + // generateFromClass for (ObjectModelClass clazz : model.getClasses()) { - + String filename = getFilenameForClass(clazz); File outputFile = getDestinationFile(destDir, filename); if (!getOverwrite() && isNewerThanSource(outputFile)) { @@ -378,7 +392,8 @@ continue; } if (!outputFile.exists() && log.isDebugEnabled()) { - log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">"); + log.debug("not up-to-date " + outputFile.lastModified() + " <" + + outputFile + ">"); } try { StringWriter out = new StringWriter(); @@ -386,8 +401,11 @@ generateFromClass(monitorOut, clazz); write(outputFile, monitorOut); } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " + outputFile); - throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee); + log.warn("Erreur lors de la génération du fichier " + + outputFile); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + outputFile, + eee); } } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/PackageValidator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/PackageValidator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/PackageValidator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,15 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * PackageValidator.java - * - * Created: 21 avr. 2005 - * - * @author Arnaud Thimel <thimel@codelutin.com> - * @version $Revision$ - */ - package org.codelutin.generator; /** @@ -31,57 +22,64 @@ * stylesheet and Xalan-Java to extend the stylesheet functionnalities. * Allows to include external classes and interfaces to the generated * ObjectModel. + * + * Created: 21 avr. 2005 + * + * @author Arnaud Thimel <thimel@codelutin.com> + * @version $Revision$ */ public class PackageValidator { - /** - * The <code>toContinue</code> method indicates if the package - * <code>localPackageNameDot</code> has to be iterated by the stylesheet. - * @param fullPackagePath the full package path - * @param localPackageNameDot the current package to evaluate - * @param extraPackages the list of extra packages - * @return true if there is to iterate on <code>localPackageNameDot</code> - */ - public static boolean toContinue(String fullPackagePath, - String localPackageNameDot, String extraPackages) { - if (fullPackagePath.startsWith(localPackageNameDot)) { - return true; - } - String[] packages = extraPackages.split(","); - for (int i = 0; i < packages.length; i++) { - packages[i] = packages[i].trim(); - if (packages[i].startsWith(localPackageNameDot)) { - if (localPackageNameDot.length() < (packages[i].lastIndexOf(".") + 1)) { - return true; + /** + * The <code>toContinue</code> method indicates if the package + * <code>localPackageNameDot</code> has to be iterated by the stylesheet. + * @param fullPackagePath the full package path + * @param localPackageNameDot the current package to evaluate + * @param extraPackages the list of extra packages + * @return true if there is to iterate on <code>localPackageNameDot</code> + */ + public static boolean toContinue(String fullPackagePath, + String localPackageNameDot, String extraPackages) { + if (fullPackagePath.startsWith(localPackageNameDot)) { + return true; + } + String[] packages = extraPackages.split(","); + for (int i = 0; i < packages.length; i++) { + packages[i] = packages[i].trim(); + if (packages[i].startsWith(localPackageNameDot)) { + if (localPackageNameDot.length() < (packages[i] + .lastIndexOf(".") + 1)) { + return true; + } + return false; } - return false; - } - } - return false; - } + } + return false; + } - /** - * <code>isValid</code> indicates if the current package - * (<code>localPackageNameDot</code>) is valid according to the extra - * packages list (<code>extraPackages</code>). - * @param localPackageNameDot the current package to evaluate - * @param extraPackages the list of extra packages - * @return true is the current package is valid - */ - public static boolean isValid(String fullPackagePath, - String localPackageName, String extraPackages) { - if (localPackageName.startsWith(fullPackagePath)) - return true; - if (localPackageName.length() == 0) - return false; - String[] packages = extraPackages.split(","); - for (int i = 0; i < packages.length; i++) { - packages[i] = packages[i].trim(); - if ((localPackageName).matches(packages[i]) - || packages[i].startsWith(localPackageName)) { + /** + * <code>isValid</code> indicates if the current package + * (<code>localPackageNameDot</code>) is valid according to the extra + * packages list (<code>extraPackages</code>). + * @param fullPackagePath + * @param localPackageName the current package to evaluate + * @param extraPackages the list of extra packages + * @return true is the current package is valid + */ + public static boolean isValid(String fullPackagePath, + String localPackageName, String extraPackages) { + if (localPackageName.startsWith(fullPackagePath)) return true; - } - } - return false; - } + if (localPackageName.length() == 0) + return false; + String[] packages = extraPackages.split(","); + for (int i = 0; i < packages.length; i++) { + packages[i] = packages[i].trim(); + if ((localPackageName).matches(packages[i]) + || packages[i].startsWith(localPackageName)) { + return true; + } + } + return false; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/StateModelGenerator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/StateModelGenerator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/StateModelGenerator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -37,7 +37,7 @@ import org.xml.sax.SAXException; /** - * StateModelGenerator + * StateModelGenerator. * * Pour utiliser ce type de générateur, il faut implanter au moins une des * méthodes generateFrom... et le getFilenameFor... associé si l'on souhaite un @@ -56,225 +56,219 @@ */ public class StateModelGenerator extends ChildGenerator { - /** Logger for this class */ - private static final Log log = LogFactory.getLog(StateModelGenerator.class); + /** Logger for this class */ + private static Log log = LogFactory.getLog(StateModelGenerator.class); - /** Model */ - protected StateModel _model; + /** Model */ + protected StateModel model; - /** - * Empty constructor - */ - public StateModelGenerator() { - } + /** + * Empty constructor + */ + public StateModelGenerator() { + } - /** - * Constructor with parent generator - * - * @param parent - * parent generator - */ - public StateModelGenerator(Generator parent) { - super(parent); - } + /** + * Constructor with parent generator. + * + * @param parent parent generator + */ + public StateModelGenerator(Generator parent) { + super(parent); + } - - /** - * @return the _model - */ - public StateModel getModel() { - return _model; - } + /** + * @return the model + */ + public StateModel getModel() { + return model; + } - /* - * (non-Javadoc) - * - * @see org.codelutin.generator.Generator#generate(java.io.File[], - * java.io.File) - */ - @Override - public void generate(File[] files, File destDir) { - - Digester digester = new Digester(); - digester.addRuleSet(new DigesterStateModelRuleSet()); + /* + * @see org.codelutin.generator.Generator#generate(java.io.File[], java.io.File) + */ + @Override + public void generate(File[] files, File destDir) { - StateModelImpl stateModel = new StateModelImpl(); + Digester digester = new Digester(); + digester.addRuleSet(new DigesterStateModelRuleSet()); - // process each file - for (File file : files) { + StateModelImpl stateModel = new StateModelImpl(); - // fin a deplacer - try { - digester.push(stateModel); - digester.parse(file); + // process each file + for (File file : files) { - // try to load property file - loadPropertyFile(file, stateModel); - } catch (IOException e) { - log.warn("Can't read model file", e); - } catch (SAXException e) { - log.warn("Can't read model file", e); - } - } + // fin a deplacer + try { + digester.push(stateModel); + digester.parse(file); - // generate code - try { - generate(stateModel, destDir); - } catch (IOException e) { - log.warn("Can't generate code for files", e); - } - } + // try to load property file + loadPropertyFile(file, stateModel); + } catch (IOException e) { + log.warn("Can't read model file", e); + } catch (SAXException e) { + log.warn("Can't read model file", e); + } + } - /** - * Try to load property file, associated to current statemodel file - * - * @param stateModel - */ - protected void loadPropertyFile(File stateModelFile, StateModelImpl stateModel) { - // recherche et charge le fichier propriete associe au modele - File dir = stateModelFile.getParentFile(); - String ext = FileUtil.extension(stateModelFile); - String name = FileUtil.basename(stateModelFile, "." + ext); - File propFile = new File(dir, name + ".properties"); - RecursiveProperties prop = new RecursiveProperties(); - - if (!propFile.exists()) { - if (log.isInfoEnabled()) { - log.info("No property file associated to model : " + propFile); - } - } else { - if (log.isInfoEnabled()) { - log.info("Reading model property file " + propFile); - } - try { - prop.load(new FileInputStream(propFile)); - } catch (IOException e) { - log.warn("Cannot read property file " + propFile, e); - } + // generate code + try { + generate(stateModel, destDir); + } catch (IOException e) { + log.warn("Can't generate code for files", e); + } + } - // on ajoute les proprietes du fichier associe au model - for (Enumeration e = prop.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String value = prop.getProperty(key); + /** + * Try to load property file, associated to current statemodel file + * + * @param stateModel + */ + protected void loadPropertyFile(File stateModelFile, + StateModelImpl stateModel) { + // recherche et charge le fichier propriete associe au modele + File dir = stateModelFile.getParentFile(); + String ext = FileUtil.extension(stateModelFile); + String name = FileUtil.basename(stateModelFile, "." + ext); + File propFile = new File(dir, name + ".properties"); + RecursiveProperties prop = new RecursiveProperties(); - if (!key.startsWith("model.tagvalue.")) { - log.warn("only tagvalue is allowed on model in properties"); - } else { - String tag = key.substring("model.tagvalue.".length()); - stateModel.addTagValue(tag, value); - } - } - } - } + if (!propFile.exists()) { + if (log.isInfoEnabled()) { + log.info("No property file associated to model : " + propFile); + } + } else { + if (log.isInfoEnabled()) { + log.info("Reading model property file " + propFile); + } + try { + prop.load(new FileInputStream(propFile)); + } catch (IOException e) { + log.warn("Cannot read property file " + propFile, e); + } - /** - * Par défaut, appel {@link #generateFromModel(MonitorWriter, org.codelutin.generator.models.state.StateModel)} pour le - * model et {@link #generateFromState(Writer,StateModelState)} pour tous les - * etats du modele. - * - * @param stateModel - * Le modele d'état - * @param destDir - * le dossier de destination - */ - public void generate(StateModel stateModel, File destDir) - throws IOException { + // on ajoute les proprietes du fichier associe au model + for (Enumeration<Object> e = prop.keys(); e.hasMoreElements();) { + String key = (String) e.nextElement(); + String value = prop.getProperty(key); - _model = stateModel; + if (!key.startsWith("model.tagvalue.")) { + log.warn("only tagvalue is allowed on model in properties"); + } else { + String tag = key.substring("model.tagvalue.".length()); + stateModel.addTagValue(tag, value); + } + } + } + } - /*********************************************************************** - * generateFromModel * - **********************************************************************/ - String filename = getFilenameFromModel(stateModel); - File outputFile = getDestinationFile(destDir, filename); - if (getOverwrite() || !isNewerThanSource(outputFile)) { - try { - StringWriter out = new StringWriter(); - MonitorWriter monitorOut = new MonitorWriter(out); - generateFromModel(monitorOut, stateModel); - write(outputFile, monitorOut); - } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " - + outputFile); - throw new RuntimeException( - "Erreur lors de la génération du fichier " + outputFile, - eee); - } - } + /** + * Par défaut, appel {@link #generateFromModel(MonitorWriter, org.codelutin.generator.models.state.StateModel)} pour le + * model et {@link #generateFromState(Writer,StateModelState)} pour tous les + * etats du modele. + * + * @param stateModel Le modele d'état + * @param destDir le dossier de destination + */ + public void generate(StateModel stateModel, File destDir) + throws IOException { - /*********************************************************************** - * generateFromState * - **********************************************************************/ - // pour tous les diagrammes du modele - for (StateModelStateChart chart : stateModel.getStateCharts()) { + model = stateModel; - // et tous les états de ces diagrammes - for (Object oState : chart.getStates().toArray()) { - StateModelState state = (StateModelState) oState; - String filenameState = getFilenameFromState(state, chart - .getName()); - File outputFiletate = getDestinationFile(destDir, filenameState); - if (getOverwrite() || !isNewerThanSource(outputFiletate)) { - try { - StringWriter out = new StringWriter(); - MonitorWriter monitorOut = new MonitorWriter(out); - generateFromState(monitorOut, state); - write(outputFiletate, monitorOut); - } catch (Exception eee) { - log.warn("Erreur lors de la génération du fichier " - + outputFiletate); - throw new RuntimeException( - "Erreur lors de la génération du fichier " - + outputFiletate, eee); - } - } - } - } - } + /*********************************************************************** + * generateFromModel * + **********************************************************************/ + String filename = getFilenameFromModel(stateModel); + File outputFile = getDestinationFile(destDir, filename); + if (getOverwrite() || !isNewerThanSource(outputFile)) { + try { + StringWriter out = new StringWriter(); + MonitorWriter monitorOut = new MonitorWriter(out); + generateFromModel(monitorOut, stateModel); + write(outputFile, monitorOut); + } catch (Exception eee) { + log.warn("Erreur lors de la génération du fichier " + + outputFile); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + outputFile, + eee); + } + } - /** - * Generate model code - * - * @param monitorOut - * @param stateModel - */ - protected void generateFromModel(MonitorWriter monitorOut, - StateModel stateModel) { + /*********************************************************************** + * generateFromState * + **********************************************************************/ + // pour tous les diagrammes du modele + for (StateModelStateChart chart : stateModel.getStateCharts()) { - } + // et tous les états de ces diagrammes + for (Object oState : chart.getStates().toArray()) { + StateModelState state = (StateModelState) oState; + String filenameState = getFilenameFromState(state, chart + .getName()); + File outputFiletate = getDestinationFile(destDir, filenameState); + if (getOverwrite() || !isNewerThanSource(outputFiletate)) { + try { + StringWriter out = new StringWriter(); + MonitorWriter monitorOut = new MonitorWriter(out); + generateFromState(monitorOut, state); + write(outputFiletate, monitorOut); + } catch (Exception eee) { + log.warn("Erreur lors de la génération du fichier " + + outputFiletate); + throw new RuntimeException( + "Erreur lors de la génération du fichier " + + outputFiletate, eee); + } + } + } + } + } - /** - * Return filename from model - * - * @param stateModel - * @return - */ - protected String getFilenameFromModel(StateModel stateModel) { - return stateModel.getName(); - } + /** + * Generate model code + * + * @param monitorOut + * @param stateModel + */ + protected void generateFromModel(MonitorWriter monitorOut, + StateModel stateModel) { - /** - * Return filename from state - * - * @param state - * the state - * @return the filename - */ - public String getFilenameFromState(StateModelState state, String packageName) { - return (packageName + '.' + state.getName()).replace('.', - File.separatorChar); - } + } - /** - * Generate a state code - * - * @param monitorOut - * the output writer - * @param state - * the state - */ - public void generateFromState(Writer monitorOut, StateModelState state) - throws IOException { + /** + * Return filename from model + * + * @param stateModel + * @return + */ + protected String getFilenameFromModel(StateModel stateModel) { + return stateModel.getName(); + } - } + /** + * Return filename from state + * + * @param state + * the state + * @return the filename + */ + public String getFilenameFromState(StateModelState state, String packageName) { + return (packageName + '.' + state.getName()).replace('.', + File.separatorChar); + } + + /** + * Generate a state code + * + * @param monitorOut + * the output writer + * @param state + * the state + */ + public void generateFromState(Writer monitorOut, StateModelState state) + throws IOException { + + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,6 +1,6 @@ /* * *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -16,12 +16,7 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ -/* -* Created on 7 janv. 2004 -* -* To change the template for this generated file go to -* Window - Preferences - Java - Code Generation - Code and Comments -*/ + package org.codelutin.generator; import java.io.File; @@ -43,73 +38,65 @@ import org.xml.sax.SAXException; /** -* UIModelGenerator.java -* @author cedric -* -* To change the template for this generated type comment go to -* Window - Preferences - Java - Code Generation - Code and Comments -*/ - + * UIModelGenerator.java + * + * @author cecrid + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ public class UIModelGenerator extends ChildGenerator { - protected UIModel model = null; - public UIModelGenerator(){ + public UIModelGenerator() { super(); } - public UIModelGenerator(Generator parent){ + public UIModelGenerator(Generator parent) { super(parent); } - public UIModel getModel(){ + public UIModel getModel() { return model; } public void generate(File[] tabUIFilesName, File destDir) { setLastModifiedSource(tabUIFilesName); - for(int i = 0; i<tabUIFilesName.length; i++){ + for (int i = 0; i < tabUIFilesName.length; i++) { try { String fileName = tabUIFilesName[i].getName(); UIModel ui = null; - if (fileName.endsWith(".javaxml")){ + if (fileName.endsWith(".javaxml")) { JavaXMLParser parser = new JavaXMLParser(); ui = parser.parse(tabUIFilesName[i]); - }else{ - /* - * previous parser lutinxml.XMLObjectParser - */ - /*XMLObjectParser parser = new XMLObjectParser(tabUIFilesName[i]); - parser.setPrefix("par"); - ui = (UIModel) parser.parseRoot(new UIModelImpl());*/ - - /* - * New parser : commons-digester - */ - Digester digester = new Digester(); - ui = new UIModelImpl(); - digester.push(ui); - digester.parse(tabUIFilesName[i]); + } else { + + // New parser : commons-digester + Digester digester = new Digester(); + ui = new UIModelImpl(); + digester.push(ui); + digester.parse(tabUIFilesName[i]); } - if (ui!=null){ + if (ui != null) { generate(ui, destDir); } - }catch (ResourceNotFoundException eee) { + } catch (ResourceNotFoundException eee) { System.out.println("Unable to parse topiaUI input file : " + i); eee.printStackTrace(); - }catch (IOException eee) { + } catch (IOException eee) { System.out.println("Unable to generate for file"); eee.printStackTrace(); - }catch (DocumentException eee) { + } catch (DocumentException eee) { System.out.println("Error during the processing of a DOM4J"); eee.printStackTrace(); } catch (SAXException e) { - System.out.println("Error during the parsing with digester"); - e.printStackTrace(); - } + System.out.println("Error during the parsing with digester"); + e.printStackTrace(); + } } } @@ -119,29 +106,29 @@ String filename = getFilenameForUIModel(ui); File outputFile = getDestinationFile(destDir, filename); - if(getOverwrite() || !isNewerThanSource(outputFile)){ + if (getOverwrite() || !isNewerThanSource(outputFile)) { StringWriter out = new StringWriter(); MonitorWriter monitorOut = new MonitorWriter(out); generateFromUIModel(monitorOut, model); write(outputFile, monitorOut); - }else{ - Logger.getLogger(getClass().getName() + ".generate").log(Level.FINE, "file "+ outputFile + "is up-to-date"); + } else { + Logger.getLogger(getClass().getName() + ".generate").log( + Level.FINE, "file " + outputFile + "is up-to-date"); } } - for(Iterator o = ui.getObjects().iterator(); o.hasNext();){ + for (UIModelObject uimodelobject : ui.getObjects()) { - UIModelObject object = (UIModelObject)o.next(); - - String filename = getFilenameForUIModelObject(object); + String filename = getFilenameForUIModelObject(uimodelobject); File outputFile = getDestinationFile(destDir, filename); - if(getOverwrite() || !isNewerThanSource(outputFile)){ + if (getOverwrite() || !isNewerThanSource(outputFile)) { StringWriter out = new StringWriter(); MonitorWriter monitorOut = new MonitorWriter(out); - generateFromUIModelObject(monitorOut, object); + generateFromUIModelObject(monitorOut, uimodelobject); write(outputFile, monitorOut); - }else{ - Logger.getLogger(getClass().getName() + ".generate").log(Level.FINE, "file "+ outputFile + "is up-to-date"); + } else { + Logger.getLogger(getClass().getName() + ".generate").log( + Level.FINE, "file " + outputFile + "is up-to-date"); } } } @@ -160,31 +147,28 @@ } public void generateFromUIModel(Writer output, UIModel model) - throws IOException { + throws IOException { } public void generateFromUIModelObject(Writer output, UIModelObject object) - throws IOException { + throws IOException { } - - - - public String capitalizeName(UIModelObject o){ + public String capitalizeName(UIModelObject o) { String name = o.getName(); - if(name == null){ - throw new GeneratorException("L'objet "+ o.getType() +" doit avoir un nom valide" ); - }else{ - return GeneratorUtil.capitalize(name); + if (name == null) { + throw new GeneratorException("L'objet " + o.getType() + + " doit avoir un nom valide"); } + return GeneratorUtil.capitalize(name); } - public String capitalizeName(UIModelProperty p){ + public String capitalizeName(UIModelProperty p) { String name = p.getName(); - if(name == null){ - throw new GeneratorException("La propriete "+ p +" doit avoir un nom valide"); - }else{ - return GeneratorUtil.capitalize(name); + if (name == null) { + throw new GeneratorException("La propriete " + p + + " doit avoir un nom valide"); } + return GeneratorUtil.capitalize(name); } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/Model.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/Model.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/Model.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -19,28 +19,37 @@ import java.util.Map; +/** + * Model. + * + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ public interface Model { /** - * Returns the name of this model. - * - * @return the name of this model. - */ + * Returns the name of this model. + * + * @return the name of this model. + */ public abstract String getName(); /** - * Returns the tagValues associated with this element. - * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) - * - * @return a Map containing all tagValues associated with this element - */ + * Returns the tagValues associated with this element. + * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) + * + * @return a Map containing all tagValues associated with this element + */ public abstract Map<String, String> getTagValues(); /** - * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. - * - * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. - */ + * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. + * + * @param tagValue tag value key + * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. + */ public abstract String getTagValue(String tagValue); } //Model Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModel.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModel.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModel.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,18 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModel.java -* -* Created: 14 janv. 2004 -* -* @author Cedric Pineau <pineau@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Last update : $Date$ -* by : $Author$ -*/ package org.codelutin.generator.models.object; import java.util.Collection; @@ -35,44 +23,55 @@ import org.codelutin.generator.models.Model; /** -* Abstraction for the root node of object model trees. -* This an entry point for browsing a model tree. This object offers as well several facilities for a direct access to some of the object model elements. -*/ + * Abstraction for the root node of object model trees. + * This an entry point for browsing a model tree. This object offers + * as well several facilities for a direct access to some of the object model elements. + * + * Created: 14 janv. 2004 + * + * @author Cedric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ + */ public interface ObjectModel extends Model { - /** - * Returns all classifiers defined in this model. - * @see ObjectModelClassifier - * - * @return a Collection containing all ObjectModelClassifier for this model. - */ + /** + * Returns all classifiers defined in this model. + * @see ObjectModelClassifier + * + * @return a Collection containing all ObjectModelClassifier for this model. + */ public abstract Collection<ObjectModelClassifier> getClassifiers(); - - /** - * Returns the classifier corresponding to the given qualified name, or null if the model contains no classifier for this qualified name. - * @param qualifiedClassifierName - the qualified name of the classifier to retrieve. - * - * @return the ObjectModelClassifier of the found classifier, or null if the model contains no classifier for this qualified name. - */ - public abstract ObjectModelClassifier getClassifier(String qualifiedClassifierName); - /** - * Returns all classes defined in this model. - * @see ObjectModelClass - * - * @return a Collection containing all ObjectModelClass for this model. - */ - public abstract Collection<ObjectModelClass> getClasses(); - - /** - * Returns the class corresponding to the given qualified name, or null if the model contains no class for this qualified name. - * @param qualifiedClassName - the qualified name of the class to retrieve. - * - * @return the ObjectModelClass of the found class, or null if the model contains no class for this qualified name. - */ - public abstract ObjectModelClass getClass(String qualifiedClassName); - /** + * Returns the classifier corresponding to the given qualified name, or null if the model contains no classifier for this qualified name. + * @param qualifiedClassifierName - the qualified name of the classifier to retrieve. + * + * @return the ObjectModelClassifier of the found classifier, or null if the model contains no classifier for this qualified name. + */ + public abstract ObjectModelClassifier getClassifier( + String qualifiedClassifierName); + + /** + * Returns all classes defined in this model. + * @see ObjectModelClass + * + * @return a Collection containing all ObjectModelClass for this model. + */ + public abstract Collection<ObjectModelClass> getClasses(); + + /** + * Returns the class corresponding to the given qualified name, or null if the model contains no class for this qualified name. + * @param qualifiedClassName - the qualified name of the class to retrieve. + * + * @return the ObjectModelClass of the found class, or null if the model contains no class for this qualified name. + */ + public abstract ObjectModelClass getClass(String qualifiedClassName); + + /** * Indicates whether the model contains the class associated to the given className * @param qualifiedClassName - the qualified name of the class to retrieve. * @@ -80,27 +79,28 @@ */ public abstract boolean hasClass(String qualifiedClassName); - /** - * Returns all interfaces defined in this model. - * @see ObjectModelInterface - * - * @return a Collection containing all ObjectModelInterface for this model. - */ + /** + * Returns all interfaces defined in this model. + * @see ObjectModelInterface + * + * @return a Collection containing all ObjectModelInterface for this model. + */ public abstract Collection<ObjectModelInterface> getInterfaces(); - /** - * Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name. - * @param qualifiedInterfaceName - the qualified name of the interface to retrieve. - * - * @return the ObjectModelInterface of the found interface, or null if the model contains no interface for this qualified name. - */ - public abstract ObjectModelInterface getInterface(String qualifiedInterfaceName); - - /** - * Returns all comments not lied to a particular model element - * - * @return a List containing all comments for this model as Strings. - */ + /** + * Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name. + * @param qualifiedInterfaceName - the qualified name of the interface to retrieve. + * + * @return the ObjectModelInterface of the found interface, or null if the model contains no interface for this qualified name. + */ + public abstract ObjectModelInterface getInterface( + String qualifiedInterfaceName); + + /** + * Returns all comments not lied to a particular model element + * + * @return a List containing all comments for this model as Strings. + */ public abstract List<String> getComments(); } //ObjectModel Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAssociationClass.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAssociationClass.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAssociationClass.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,32 +15,29 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModel.java -* -* @author Cédric Pineau <pineau@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Last update : $Date$ -* by : $Author$ -*/ package org.codelutin.generator.models.object; import java.util.List; /** - * @author pineau + * ObjectModelAssociationClass. + * + * @author Cédric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ */ public interface ObjectModelAssociationClass extends ObjectModelClass { - /** - * Returns all participants (that is association ends) attributes for this association class. - * @see ObjectModelAttribute - * - * @return a List containing all participants attributes for this association class. - */ - public abstract List<ObjectModelAttribute> getParticipantsAttributes(); + /** + * Returns all participants (that is association ends) attributes for this association class. + * @see ObjectModelAttribute + * + * @return a List containing all participants attributes for this association class. + */ + public abstract List<ObjectModelAttribute> getParticipantsAttributes(); /** * Returns all participants (that is association ends) classifiers for this association class. @@ -48,6 +45,6 @@ * * @return a List containing all participants classifiers for this association class. */ - public abstract List<ObjectModelClassifier> getParticipantsClassifiers(); + public abstract List<ObjectModelClassifier> getParticipantsClassifiers(); } //ObjectModelAssociationClass Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAttribute.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAttribute.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelAttribute.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,24 +15,21 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelAttribute.java -* +package org.codelutin.generator.models.object; + +/** +* Abstraction for the attribute node of object model trees. +* This object presents all information concerning the given attribute. +* * Created: 14 janv. 2004 * -* @author C�dric Pineau <pineau@codelutin.com> +* @author Cédric Pineau <pineau@codelutin.com> * Copyright Code Lutin * @version $Revision$ * * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object; - -/** -* Abstraction for the attribute node of object model trees. -* This object presents all information concerning the given attribute. -*/ public interface ObjectModelAttribute extends ObjectModelParameter { /** @@ -96,20 +93,20 @@ /** * Returns the attribute used to reference this class at the other end of the association or null if this is not an association, or if it is not bi-directionnal. - * @ see #getClassifier() + * @see #getClassifier() * * @return the ObjectModelAttribute used to reference this class at the other end of the association or null if this is not an association, or if it is not bi-directionnal. */ public abstract ObjectModelAttribute getReverseAttribute(); public String getReverseAttributeName(); - + /** * max multiplicity of the reverse attribute * @return max multiplicity of the reverse attribute */ public abstract int getReverseMaxMultiplicity(); - + /** * Returns the association class associated with this association, or null if there is none. * @@ -129,31 +126,31 @@ * * @return a boolean indicating whether this attribute is static or not. */ - public abstract boolean isStatic(); + public abstract boolean isStatic(); - /** - * Returns whether this attribute is final or not. - * - * @return a boolean indicating whether this attribute is final or not. - */ - public abstract boolean isFinal(); + /** + * Returns whether this attribute is final or not. + * + * @return a boolean indicating whether this attribute is final or not. + */ + public abstract boolean isFinal(); - /** - * true if this attribute is navigable - * @return true if this attribute is navigable - */ - public abstract boolean isNavigable(); - - /** - * true if this attribute is isOrdered - * @return true if this attribute is isOrdered - */ - public abstract boolean isOrdered(); + /** + * true if this attribute is navigable + * @return true if this attribute is navigable + */ + public abstract boolean isNavigable(); - /** - * true if this attribute is isIndexed - * @return true if this attribute is isIndexed - */ - public abstract boolean isIndexed(); + /** + * true if this attribute is isOrdered + * @return true if this attribute is isOrdered + */ + public abstract boolean isOrdered(); + /** + * true if this attribute is isIndexed + * @return true if this attribute is isIndexed + */ + public abstract boolean isIndexed(); + } //ObjectModelAttribute Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClass.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClass.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClass.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,9 +15,14 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelClass.java -* +package org.codelutin.generator.models.object; + +import java.util.Collection; + +/** +* Abstraction for the class node of object model trees. +* This object presents all information concerning the given class. +* * Created: 14 janv. 2004 * * @author Cédric Pineau <pineau@codelutin.com> @@ -27,14 +32,6 @@ * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object; - -import java.util.Collection; - -/** -* Abstraction for the class node of object model trees. -* This object presents all information concerning the given class. -*/ public interface ObjectModelClass extends ObjectModelClassifier { /** @@ -66,7 +63,8 @@ * * @return a Collection containing all known direct specialized ObjectModelClass for this class for the specified discriminator. */ - public abstract Collection<ObjectModelClass> getSpecialisations(String discriminator); + public abstract Collection<ObjectModelClass> getSpecialisations( + String discriminator); /** * Returns all attributes defined on this class. @@ -98,7 +96,8 @@ * are add to list. * @return a Collection of ObjectModelOperation */ - public abstract Collection<ObjectModelOperation> getAllSuperclassOperations(boolean distinct); + public abstract Collection<ObjectModelOperation> getAllSuperclassOperations( + boolean distinct); /** * Returns all attributes defined on all super class extended by this Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClassifier.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClassifier.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelClassifier.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,22 +15,19 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModel.java -* -* @author Cédric Pineau <pineau@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Last update : $Date$ -* by : $Author$ -*/ package org.codelutin.generator.models.object; import java.util.Collection; /** - * @author cedric + * ObjectModelClassifier. + * + * @author Cédric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ */ public interface ObjectModelClassifier extends ObjectModelElement { @@ -65,15 +62,15 @@ * * @see ObjectModelOperation */ - public abstract Collection<ObjectModelOperation> getOperations(String name); + public abstract Collection<ObjectModelOperation> getOperations(String name); - /** - * Returns all operations defined on this classifier. - * @see ObjectModelOperation - * - * @return a Collection containing all ObjectModelOperation for this classifier. - */ - public abstract Collection<ObjectModelOperation> getOperations(); + /** + * Returns all operations defined on this classifier. + * @see ObjectModelOperation + * + * @return a Collection containing all ObjectModelOperation for this classifier. + */ + public abstract Collection<ObjectModelOperation> getOperations(); /** * Returns all operations defined on all interfaces implemented by this @@ -82,7 +79,8 @@ * are add to list. * @return a Collection of ObjectModelOperation */ - public abstract Collection<ObjectModelOperation> getAllInterfaceOperations(boolean distinct); + public abstract Collection<ObjectModelOperation> getAllInterfaceOperations( + boolean distinct); /** * Returns all operations defined on all implemented by this @@ -93,7 +91,8 @@ * are add to list. * @return a Collection of ObjectModelOperation */ - public abstract Collection<ObjectModelOperation> getAllOtherOperations(boolean distinct); + public abstract Collection<ObjectModelOperation> getAllOtherOperations( + boolean distinct); /** * Returns whether this classifier is a class or not @@ -101,14 +100,14 @@ * * @return a boolean indicating whether this classifier is a class or not. */ - public abstract boolean isClass(); - - /** - * Returns whether this classifier is an interface or not - * @see ObjectModelInterface - * - * @return a boolean indicating whether this classifier is an interface or not. - */ - public abstract boolean isInterface(); + public abstract boolean isClass(); + /** + * Returns whether this classifier is an interface or not + * @see ObjectModelInterface + * + * @return a boolean indicating whether this classifier is an interface or not. + */ + public abstract boolean isInterface(); + } //ObjectModelClassifier Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,16 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModel.java -* -* @author Cédric Pineau <pineau@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Last update : $Date$ -* by : $Author$ -*/ package org.codelutin.generator.models.object; import java.util.Collection; @@ -32,86 +22,93 @@ import java.util.Map; /** - * @author cedric + * ObjectModelElement. + * + * @author Cédric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ */ public interface ObjectModelElement { - /** - * Returns the name of this element. - * - * @return the name of this element. - */ - public abstract String getName(); + /** + * Returns the name of this element. + * + * @return the name of this element. + */ + public abstract String getName(); - /** - * Returns the element in which this element is defined, or null if there's none. - * - * @return the ObjectModelElement in which this element is defined, or null if there's none. - */ - public abstract ObjectModelElement getDeclaringElement(); + /** + * Returns the element in which this element is defined, or null if there's none. + * + * @return the ObjectModelElement in which this element is defined, or null if there's none. + */ + public abstract ObjectModelElement getDeclaringElement(); - /** - * Returns the whole documentation associated with this element (description + source documentation). - * - * @return the whole documentation associated with this element. - */ - public abstract String getDocumentation(); + /** + * Returns the whole documentation associated with this element (description + source documentation). + * + * @return the whole documentation associated with this element. + */ + public abstract String getDocumentation(); - /** - * Returns the description associated with this element. - * - * @return the description associated with this element. - */ - public abstract String getDescription(); + /** + * Returns the description associated with this element. + * + * @return the description associated with this element. + */ + public abstract String getDescription(); - /** - * Returns the source documentation part associated with this element. - * - * @return the source documentation part associated with this element. - */ - public abstract String getSourceDocumentation(); + /** + * Returns the source documentation part associated with this element. + * + * @return the source documentation part associated with this element. + */ + public abstract String getSourceDocumentation(); - /** - * Returns the stereotypes names associated with this element. - * - * @return a Collection containing all stereotypes names associated with this element as String. - */ - public abstract Collection<String> getStereotypes(); + /** + * Returns the stereotypes names associated with this element. + * + * @return a Collection containing all stereotypes names associated with this element as String. + */ + public abstract Collection<String> getStereotypes(); - /** - * Returns whether this element has a stereotype corresponding to the given name, or not. - * - * @return a boolean indicating whether this element has a stereotype corresponding to the given name, or not. - */ - public abstract boolean hasStereotype(String stereotypeName); + /** + * Returns whether this element has a stereotype corresponding to the given name, or not. + * + * @return a boolean indicating whether this element has a stereotype corresponding to the given name, or not. + */ + public abstract boolean hasStereotype(String stereotypeName); - /** - * Returns the tagValues associated with this element. - * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) - * - * @return a Map containing all tagValues associated with this element - */ - public abstract Map<String, String> getTagValues(); + /** + * Returns the tagValues associated with this element. + * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) + * + * @return a Map containing all tagValues associated with this element + */ + public abstract Map<String, String> getTagValues(); - /** - * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. - * - * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. - */ - public abstract String getTagValue(String tagValue); + /** + * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. + * + * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. + */ + public abstract String getTagValue(String tagValue); - /** - * Returns whether this element has a tagValue corresponding to the given name, or not. - * - * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not. - */ - public abstract boolean hasTagValue(String tagValue); + /** + * Returns whether this element has a tagValue corresponding to the given name, or not. + * + * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not. + */ + public abstract boolean hasTagValue(String tagValue); - /** - * Returns all comments lied to this particular model element - * - * @return a List containing all comments for this element as Strings. - */ + /** + * Returns all comments lied to this particular model element + * + * @return a List containing all comments for this element as Strings. + */ public abstract List<String> getComments(); } //ObjectModelElement Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelInterface.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelInterface.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelInterface.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,9 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelInterface.java -* +package org.codelutin.generator.models.object; + +/** +* Abstraction for the interface node of object model trees. +* This object presents all information concerning the given interface. +* * Created: 14 janv. 2004 * * @author Cédric Pineau <pineau@codelutin.com> @@ -27,12 +30,6 @@ * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object; - -/** -* Abstraction for the interface node of object model trees. -* This object presents all information concerning the given interface. -*/ public interface ObjectModelInterface extends ObjectModelClassifier { - + } //ObjectModelInterface Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelOperation.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelOperation.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelOperation.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,9 +15,15 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelOperation.java -* +package org.codelutin.generator.models.object; + +import java.util.Collection; +import java.util.Set; + +/** +* Abstraction for the operation node of object model trees. +* This object presents all information concerning the given operation. +* * Created: 14 janv. 2004 * * @author Cédric Pineau <pineau@codelutin.com> @@ -27,15 +33,6 @@ * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object; - -import java.util.Collection; -import java.util.Set; - -/** -* Abstraction for the operation node of object model trees. -* This object presents all information concerning the given operation. -*/ public interface ObjectModelOperation extends ObjectModelElement { /** @@ -79,6 +76,6 @@ * * @return a Set containing the exceptions strings */ - public abstract Set<String> getExceptions(); + public abstract Set<String> getExceptions(); } //ObjectModelOperation Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelParameter.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelParameter.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelParameter.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,9 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelParameter.java -* +package org.codelutin.generator.models.object; + +/** +* Abstraction for the parameter node of object model trees. +* This object presents all information concerning the given parameter. +* * Created: 14 janv. 2004 * * @author Cédric Pineau <pineau@codelutin.com> @@ -27,19 +30,13 @@ * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object; - -/** -* Abstraction for the parameter node of object model trees. -* This object presents all information concerning the given parameter. -*/ public interface ObjectModelParameter extends ObjectModelElement { - /** - * Returns the type of this parameter. - * - * @return the type of this parameter. - */ - public abstract String getType(); + /** + * Returns the type of this parameter. + * + * @return the type of this parameter. + */ + public abstract String getType(); } //ObjectModelParameter Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/AttributeNamesValidator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/AttributeNamesValidator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/AttributeNamesValidator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,15 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* AttributeNamesValidator.java + + +package org.codelutin.generator.models.object.validator; + +import org.codelutin.generator.models.object.ObjectModel; +import org.codelutin.generator.models.object.ObjectModelAttribute; + +/** +* AttributeNamesValidator. * * Created: 7 mars 2006 * @@ -26,13 +33,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - - -package org.codelutin.generator.models.object.validator; - -import org.codelutin.generator.models.object.ObjectModel; -import org.codelutin.generator.models.object.ObjectModelAttribute; - public class AttributeNamesValidator extends NameBasedValidator { public AttributeNamesValidator(ObjectModel model) { Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ClassNamesValidator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ClassNamesValidator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ClassNamesValidator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,13 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ClassNamesValidator.java +package org.codelutin.generator.models.object.validator; + +import org.codelutin.generator.models.object.ObjectModel; +import org.codelutin.generator.models.object.ObjectModelClass; + +/** +* ClassNamesValidator. * * Created: 9 mars 2006 * @@ -26,13 +31,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - - -package org.codelutin.generator.models.object.validator; - -import org.codelutin.generator.models.object.ObjectModel; -import org.codelutin.generator.models.object.ObjectModelClass; - public class ClassNamesValidator extends NameBasedValidator { public ClassNamesValidator(ObjectModel model) { Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/NameBasedValidator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/NameBasedValidator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/NameBasedValidator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,17 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* NameBasedValidator.java + + +package org.codelutin.generator.models.object.validator; + +import java.util.HashMap; +import java.util.Map; + +import org.codelutin.generator.models.object.ObjectModel; + +/** +* NameBasedValidator. * * Created: 9 mars 2006 * @@ -26,15 +35,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - - -package org.codelutin.generator.models.object.validator; - -import java.util.HashMap; -import java.util.Map; - -import org.codelutin.generator.models.object.ObjectModel; - public abstract class NameBasedValidator extends ObjectModelValidator { private boolean caseSensitive; Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ObjectModelValidator.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ObjectModelValidator.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/validator/ObjectModelValidator.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,19 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelValidator.java -* -* Created: 7 mars 2006 -* -* @author Arnaud Thimel <thimel@codelutin.com> -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - - package org.codelutin.generator.models.object.validator; import java.util.ArrayList; @@ -53,6 +40,13 @@ * Puis l'objet faisant appel au validateur peut récupérer la liste des erreurs * par la méthode "getErrors". * </p> + * Created: 7 mars 2006 + * + * @author Arnaud Thimel <thimel@codelutin.com> + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ */ public class ObjectModelValidator { @@ -71,7 +65,7 @@ * liste renvoyeé sera vide. */ public List<String> getErrors() { - return errors; + return errors; } /** @@ -83,9 +77,9 @@ errors = new ArrayList<String>(); } boolean isValid = validateModel(this.model); - for (Iterator classifiers = model.getClassifiers().iterator(); + for (Iterator<ObjectModelClassifier> classifiers = model.getClassifiers().iterator(); classifiers.hasNext(); ){ - ObjectModelClassifier classifier = (ObjectModelClassifier)classifiers.next(); + ObjectModelClassifier classifier = classifiers.next(); isValid &= validateClassifier(classifier); if (classifier instanceof ObjectModelInterface) { isValid &= validateInterface((ObjectModelInterface)classifier); @@ -93,14 +87,14 @@ if (classifier instanceof ObjectModelClass) { ObjectModelClass clazz = (ObjectModelClass)classifier; isValid &= validateClass(clazz); - for (Iterator attributes = clazz.getAttributes().iterator(); + for (Iterator<ObjectModelAttribute> attributes = clazz.getAttributes().iterator(); attributes.hasNext(); ) { - isValid &= validateAttribute((ObjectModelAttribute)attributes.next()); + isValid &= validateAttribute(attributes.next()); } } - for (Iterator operations = classifier.getOperations().iterator(); + for (Iterator<ObjectModelOperation> operations = classifier.getOperations().iterator(); operations.hasNext(); ) { - isValid &= validateOperation((ObjectModelOperation)operations.next()); + isValid &= validateOperation(operations.next()); } } return isValid; @@ -133,11 +127,11 @@ protected void addError(ObjectModelElement onElement, String reason) { String elementString = onElement.toString(); if (onElement instanceof ObjectModelAttribute) { - elementString = - ((ObjectModelClassifier)onElement.getDeclaringElement()) - .getQualifiedName() + "#" + onElement.getName(); + elementString = ((ObjectModelClassifier) onElement + .getDeclaringElement()).getQualifiedName() + + "#" + onElement.getName(); } else if (onElement instanceof ObjectModelClassifier) { - ObjectModelClassifier classifier = (ObjectModelClassifier)onElement; + ObjectModelClassifier classifier = (ObjectModelClassifier) onElement; elementString = classifier.getQualifiedName(); } this.errors.add("[" + elementString + "] " + reason); Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/DigesterObjectModelRuleSet.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/DigesterObjectModelRuleSet.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/DigesterObjectModelRuleSet.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -47,82 +47,88 @@ */ public class DigesterObjectModelRuleSet extends RuleSetBase { - protected String prefix = null; + protected String prefix = null; - public DigesterObjectModelRuleSet() { - this(""); - } + public DigesterObjectModelRuleSet() { + this(""); + } - public DigesterObjectModelRuleSet(String prefix) { - super(); - this.prefix = prefix; - this.namespaceURI = "http://www.codelutin.org/lutingenerator/objectModel"; - } - - /* (non-Javadoc) - * @see org.apache.commons.digester.RuleSetBase#addRuleInstances(org.apache.commons.digester.Digester) - */ - @Override - public void addRuleInstances(Digester d) { + public DigesterObjectModelRuleSet(String prefix) { + super(); + this.prefix = prefix; + this.namespaceURI = "http://www.codelutin.org/lutingenerator/objectModel"; + } - //d.addFactoryCreate("objectModel", DigesterObjectModelFactory.class); - // root element must be present on stask - d.addSetProperties("objectModel"); - - d.addObjectCreate("objectModel/class", ObjectModelClassImpl.class); - d.addSetProperties("objectModel/class"); - d.addSetNext("objectModel/class", "addClass"); - - d.addObjectCreate("objectModel/interface", ObjectModelInterfaceImpl.class); - d.addSetProperties("objectModel/interface"); - d.addSetNext("objectModel/interface", "addInterface"); - - d.addObjectCreate("objectModel/associationClass", ObjectModelAssociationClassImpl.class); - d.addSetProperties("objectModel/associationClass"); - d.addSetNext("objectModel/associationClass", "addAssociationClass"); - - d.addObjectCreate("*/participant", ObjectModeImplAssociationClassParticipant.class); - d.addSetProperties("*/participant"); - d.addSetNext("*/participant", "addParticipant"); - - d.addObjectCreate("*/stereotype", ObjectModelImplRef.class); - d.addSetProperties("*/stereotype"); - d.addSetNext("*/stereotype", "addStereotype"); - - d.addObjectCreate("*/attribute", ObjectModelAttributeImpl.class); - d.addSetProperties("*/attribute"); - d.addSetNext("*/attribute", "addAttribute"); - - d.addObjectCreate("*/interface", ObjectModelImplRef.class); - d.addSetProperties("*/interface"); - d.addSetNext("*/interface", "addInterface"); - - d.addObjectCreate("*/superclass", ObjectModelImplSuperClassRef.class); - d.addSetProperties("*/superclass"); - d.addSetNext("*/superclass", "addSuperclass"); - - d.addObjectCreate("*/operation", ObjectModelOperationImpl.class); - d.addSetProperties("*/operation"); - d.addSetNext("*/operation", "addOperation"); - - d.addObjectCreate("*/operation/returnParameter", ObjectModelParameterImpl.class); - d.addSetProperties("*/operation/returnParameter"); - d.addSetNext("*/operation/returnParameter", "setReturnParameter"); - - d.addObjectCreate("*/operation/parameter", ObjectModelParameterImpl.class); - d.addSetProperties("*/operation/parameter"); - d.addSetNext("*/operation/parameter", "addParameter"); - - d.addObjectCreate("*/operation/exceptionParameter", ObjectModelParameterImpl.class); - d.addSetProperties("*/operation/exceptionParameter"); - d.addSetNext("*/operation/exceptionParameter", "addExceptionParameter"); - - d.addObjectCreate("*/tagValue", ObjectModelImplTagValue.class); - d.addSetProperties("*/tagValue"); - d.addSetNext("*/tagValue", "addTagValue"); - - d.addObjectCreate("*/comment", String.class); - d.addSetProperties("*/comment"); - d.addSetNext("*/comment", "addComment"); - } + /* (non-Javadoc) + * @see org.apache.commons.digester.RuleSetBase#addRuleInstances(org.apache.commons.digester.Digester) + */ + @Override + public void addRuleInstances(Digester d) { + + //d.addFactoryCreate("objectModel", DigesterObjectModelFactory.class); + // root element must be present on stask + d.addSetProperties("objectModel"); + + d.addObjectCreate("objectModel/class", ObjectModelClassImpl.class); + d.addSetProperties("objectModel/class"); + d.addSetNext("objectModel/class", "addClass"); + + d.addObjectCreate("objectModel/interface", + ObjectModelInterfaceImpl.class); + d.addSetProperties("objectModel/interface"); + d.addSetNext("objectModel/interface", "addInterface"); + + d.addObjectCreate("objectModel/associationClass", + ObjectModelAssociationClassImpl.class); + d.addSetProperties("objectModel/associationClass"); + d.addSetNext("objectModel/associationClass", "addAssociationClass"); + + d.addObjectCreate("*/participant", + ObjectModeImplAssociationClassParticipant.class); + d.addSetProperties("*/participant"); + d.addSetNext("*/participant", "addParticipant"); + + d.addObjectCreate("*/stereotype", ObjectModelImplRef.class); + d.addSetProperties("*/stereotype"); + d.addSetNext("*/stereotype", "addStereotype"); + + d.addObjectCreate("*/attribute", ObjectModelAttributeImpl.class); + d.addSetProperties("*/attribute"); + d.addSetNext("*/attribute", "addAttribute"); + + d.addObjectCreate("*/interface", ObjectModelImplRef.class); + d.addSetProperties("*/interface"); + d.addSetNext("*/interface", "addInterface"); + + d.addObjectCreate("*/superclass", ObjectModelImplSuperClassRef.class); + d.addSetProperties("*/superclass"); + d.addSetNext("*/superclass", "addSuperclass"); + + d.addObjectCreate("*/operation", ObjectModelOperationImpl.class); + d.addSetProperties("*/operation"); + d.addSetNext("*/operation", "addOperation"); + + d.addObjectCreate("*/operation/returnParameter", + ObjectModelParameterImpl.class); + d.addSetProperties("*/operation/returnParameter"); + d.addSetNext("*/operation/returnParameter", "setReturnParameter"); + + d.addObjectCreate("*/operation/parameter", + ObjectModelParameterImpl.class); + d.addSetProperties("*/operation/parameter"); + d.addSetNext("*/operation/parameter", "addParameter"); + + d.addObjectCreate("*/operation/exceptionParameter", + ObjectModelParameterImpl.class); + d.addSetProperties("*/operation/exceptionParameter"); + d.addSetNext("*/operation/exceptionParameter", "addExceptionParameter"); + + d.addObjectCreate("*/tagValue", ObjectModelImplTagValue.class); + d.addSetProperties("*/tagValue"); + d.addSetNext("*/tagValue", "addTagValue"); + + d.addObjectCreate("*/comment", String.class); + d.addSetProperties("*/comment"); + d.addSetNext("*/comment", "addComment"); + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -31,38 +31,45 @@ * Last update : $Date$ * By : $Author$ */ -public class ObjectModeImplAssociationClassParticipant extends ObjectModelImplRef { +public class ObjectModeImplAssociationClassParticipant extends + ObjectModelImplRef { - protected ObjectModelAssociationClassImpl associationClass = null; + protected ObjectModelAssociationClassImpl associationClass = null; - protected String attributeName = null; + protected String attributeName = null; - public ObjectModeImplAssociationClassParticipant() { - super(); - } - - /** - * @param associationClass the associationClass to set - */ - public void setAssociationClass(ObjectModelAssociationClassImpl associationClass) { - this.associationClass = associationClass; - } + public ObjectModeImplAssociationClassParticipant() { + super(); + } - public void setAttribute(String attributeName) { - this.attributeName = attributeName; - } + /** + * @param associationClass the associationClass to set + */ + public void setAssociationClass( + ObjectModelAssociationClassImpl associationClass) { + this.associationClass = associationClass; + } - public String getAttributeName() { - if ((attributeName == null) || ("".equals(attributeName))) { - for (Iterator i = associationClass.getParticipantsRefs().iterator(); i.hasNext();) { - ObjectModeImplAssociationClassParticipant participant = (ObjectModeImplAssociationClassParticipant)i.next(); - if (participant != this) { - attributeName = GeneratorUtil.toLowerCaseFirstLetter(GeneratorUtil.getClassNameFromQualifiedName(participant.getName())); - break; - } - } - } - return attributeName; - } + public void setAttribute(String attributeName) { + this.attributeName = attributeName; + } + public String getAttributeName() { + if ((attributeName == null) || ("".equals(attributeName))) { + for (Iterator i = associationClass.getParticipantsRefs().iterator(); i + .hasNext();) { + ObjectModeImplAssociationClassParticipant participant = (ObjectModeImplAssociationClassParticipant) i + .next(); + if (participant != this) { + attributeName = GeneratorUtil + .toLowerCaseFirstLetter(GeneratorUtil + .getClassNameFromQualifiedName(participant + .getName())); + break; + } + } + } + return attributeName; + } + } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAssociationClassImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAssociationClassImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAssociationClassImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,6 +1,6 @@ /* * *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -16,12 +16,7 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ -/* - * Created on May 11, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ + package org.codelutin.generator.models.object.xml; import java.util.ArrayList; @@ -46,12 +41,12 @@ * Last update : $Date$ * By : $Author$ */ -public class ObjectModelAssociationClassImpl - extends ObjectModelClassImpl - implements ObjectModelAssociationClass { +public class ObjectModelAssociationClassImpl extends ObjectModelClassImpl + implements ObjectModelAssociationClass { - private static final Log log = LogFactory.getLog(ObjectModelAssociationClassImpl.class); - + private static final Log log = LogFactory + .getLog(ObjectModelAssociationClassImpl.class); + protected List<ObjectModelAttribute> participantsAttributes = null; protected List<ObjectModelClassifier> participantsClassifiers = null; protected List<ObjectModeImplAssociationClassParticipant> participantsRefs = new ArrayList<ObjectModeImplAssociationClassParticipant>(); @@ -60,7 +55,8 @@ super(); } - public void addParticipant(ObjectModeImplAssociationClassParticipant participant) { + public void addParticipant( + ObjectModeImplAssociationClassParticipant participant) { //if (participant == null) // return new ObjectModeImplAssociationClassParticipant(this); participant.postInit(); @@ -98,23 +94,29 @@ protected void parseParticipantsRefs() { participantsClassifiers = new ArrayList<ObjectModelClassifier>(); participantsAttributes = new ArrayList<ObjectModelAttribute>(); - + for (Iterator i = participantsRefs.iterator(); i.hasNext();) { - ObjectModeImplAssociationClassParticipant ref = (ObjectModeImplAssociationClassParticipant) i.next(); - ObjectModelClassifier classifier = objectModelImpl.getClassifier(ref.getName()); + ObjectModeImplAssociationClassParticipant ref = (ObjectModeImplAssociationClassParticipant) i + .next(); + ObjectModelClassifier classifier = objectModelImpl + .getClassifier(ref.getName()); participantsClassifiers.add(classifier); ObjectModelAttribute attribute = null; if (classifier.isClass()) { - attribute = ((ObjectModelClass) classifier).getAttribute(ref.getAttributeName()); + attribute = ((ObjectModelClass) classifier).getAttribute(ref + .getAttributeName()); if (attribute == null) { - log.warn("WARNING : Attribute "+ ref.getAttributeName() +" not found on "+classifier.getQualifiedName()); - log.warn("WARNING : Assuming there is no navigability in this direction for the "+ getQualifiedName()+" association class"); + log.warn("WARNING : Attribute " + ref.getAttributeName() + + " not found on " + classifier.getQualifiedName()); + log + .warn("WARNING : Assuming there is no navigability in this direction for the " + + getQualifiedName() + " association class"); } } participantsAttributes.add(attribute); } } - + public Collection getParticipantsRefs() { return participantsRefs; } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,25 +15,26 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/******************************************************************************* - * ObjectModelAttributeImpl.java + + +package org.codelutin.generator.models.object.xml; + +import org.codelutin.generator.GeneratorUtil; +import org.codelutin.generator.models.object.ObjectModelAttribute; +import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelClassifier; + +/** + * ObjectModelAttributeImpl. * * Created: 14 janv. 2004 * - * @author C�dric Pineau <pineau@codelutin.com> Copyright Code Lutin + * @author Cédric Pineau <pineau@codelutin.com> Copyright Code Lutin * * @version $Revision$ * * Last update : $Date$ by : $Author$ */ - -package org.codelutin.generator.models.object.xml; - -import org.codelutin.generator.GeneratorUtil; -import org.codelutin.generator.models.object.ObjectModelAttribute; -import org.codelutin.generator.models.object.ObjectModelClass; -import org.codelutin.generator.models.object.ObjectModelClassifier; - public class ObjectModelAttributeImpl extends ObjectModelParameterImpl implements ObjectModelAttribute { @@ -62,9 +63,9 @@ } public void setReverseAttributeName(String reverseAttributeName) { - this.reverseAttributeName = reverseAttributeName; + this.reverseAttributeName = reverseAttributeName; } - + public void setAssociationType(String associationType) { this.associationType = associationType; } @@ -178,21 +179,21 @@ } public String getReverseAttributeName() { - if ((reverseAttributeName == null) - || ("".equals(reverseAttributeName))) { - reverseAttributeName = GeneratorUtil + if ((reverseAttributeName == null) || ("".equals(reverseAttributeName))) { + reverseAttributeName = GeneratorUtil .toLowerCaseFirstLetter(getDeclaringElement().getName()); } return reverseAttributeName; } - + public String getName() { if ((name == null || "".equals(name)) && getClassifier() != null) { - name = GeneratorUtil.toLowerCaseFirstLetter(getClassifier().getName()); + name = GeneratorUtil.toLowerCaseFirstLetter(getClassifier() + .getName()); } return name; } - + /* * (non-Javadoc) * @@ -257,15 +258,14 @@ * @see org.codelutin.generator.models.object.ObjectModelAttribute#isOrdered() */ public boolean isOrdered() { - return isIndexed() - || "ordered".equals(ordering) - || getTagValue("order-by") != null; + return isIndexed() || "ordered".equals(ordering) + || getTagValue("order-by") != null; } - + /* (non-Javadoc) * @see org.codelutin.generator.models.object.ObjectModelAttribute#isIndexed() */ - public boolean isIndexed() { + public boolean isIndexed() { return hasStereotype("indexed"); } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,18 +15,7 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * ObjectModelClassImpl.java - * - * Created: 14 janv. 2004 - * - * @author Cédric Pineau <pineau@codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Last update : $Date$ - * by : $Author$ - */ + package org.codelutin.generator.models.object.xml; import java.util.ArrayList; @@ -44,220 +33,236 @@ import org.codelutin.generator.models.object.ObjectModelInterface; import org.codelutin.generator.models.object.ObjectModelOperation; +/** + * ObjectModelClassImpl. + * + * Created: 14 janv. 2004 + * + * @author Cédric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ + */ public class ObjectModelClassImpl extends ObjectModelClassifierImpl implements - ObjectModelClass { + ObjectModelClass { - protected List<ObjectModelClass> superclasses = null; - protected Map<ObjectModelClass, String> superclassesDiscriminators = new HashMap<ObjectModelClass, String>(); - protected List<ObjectModelImplRef> superclassesRefs = new ArrayList<ObjectModelImplRef>(); - protected List<ObjectModelClass> specialisations = null; - protected Map<String,ObjectModelAttribute> attributes = new HashMap<String, ObjectModelAttribute>(); - protected List<ObjectModelAttribute> orderedAttributes = new ArrayList<ObjectModelAttribute>(); - protected boolean abstractz = false; + protected List<ObjectModelClass> superclasses = null; + protected Map<ObjectModelClass, String> superclassesDiscriminators = new HashMap<ObjectModelClass, String>(); + protected List<ObjectModelImplRef> superclassesRefs = new ArrayList<ObjectModelImplRef>(); + protected List<ObjectModelClass> specialisations = null; + protected Map<String, ObjectModelAttribute> attributes = new HashMap<String, ObjectModelAttribute>(); + protected List<ObjectModelAttribute> orderedAttributes = new ArrayList<ObjectModelAttribute>(); + protected boolean abstractz = false; - public ObjectModelClassImpl() { - super(); - } + public ObjectModelClassImpl() { + super(); + } - public void addSuperclass(ObjectModelImplRef ref) { - //if (ref == null) - // return new ObjectModelImplSuperClassRef(); - superclassesRefs.add(ref); - //return ref; - } + public void addSuperclass(ObjectModelImplRef ref) { + //if (ref == null) + // return new ObjectModelImplSuperClassRef(); + superclassesRefs.add(ref); + //return ref; + } - public void addAttribute( - ObjectModelAttributeImpl attribute) { - //if (attribute == null) - // return new ObjectModelAttributeImpl(objectModelImpl, this); - attribute.postInit(); - attribute.setDeclaringElement(this); - attributes.put(attribute.getName(), attribute); - orderedAttributes.add(attribute); - //return attribute; - } + public void addAttribute(ObjectModelAttributeImpl attribute) { + //if (attribute == null) + // return new ObjectModelAttributeImpl(objectModelImpl, this); + attribute.postInit(); + attribute.setDeclaringElement(this); + attributes.put(attribute.getName(), attribute); + orderedAttributes.add(attribute); + //return attribute; + } - public void setAbstract(boolean abstractz) { - this.abstractz = abstractz; - } + public void setAbstract(boolean abstractz) { + this.abstractz = abstractz; + } - public Collection<ObjectModelClass> getSuperclasses() { - if (superclasses == null) { - superclasses = new ArrayList<ObjectModelClass>(); - Iterator i = superclassesRefs.iterator(); - while (i.hasNext()) { - ObjectModelImplSuperClassRef ref = (ObjectModelImplSuperClassRef) i - .next(); - ObjectModelClass superclass = objectModelImpl.getClass(ref - .getName()); - superclasses.add(superclass); - superclassesDiscriminators.put(superclass, ref - .getDiscriminator()); - } - } - return superclasses; - } + public Collection<ObjectModelClass> getSuperclasses() { + if (superclasses == null) { + superclasses = new ArrayList<ObjectModelClass>(); + Iterator i = superclassesRefs.iterator(); + while (i.hasNext()) { + ObjectModelImplSuperClassRef ref = (ObjectModelImplSuperClassRef) i + .next(); + ObjectModelClass superclass = objectModelImpl.getClass(ref + .getName()); + superclasses.add(superclass); + superclassesDiscriminators.put(superclass, ref + .getDiscriminator()); + } + } + return superclasses; + } - /** - * Returns the discriminator for the given superclass. - * - * @return the discriminator for the given superclass as a String if it - * exists, null otherwise. - */ - public String getDiscriminator(ObjectModelClass superclass) { - return superclassesDiscriminators.get(superclass); - } + /** + * Returns the discriminator for the given superclass. + * + * @return the discriminator for the given superclass as a String if it + * exists, null otherwise. + */ + public String getDiscriminator(ObjectModelClass superclass) { + return superclassesDiscriminators.get(superclass); + } - /** - * Returns all known direct specialized classes for this class. - * - * @see ObjectModelClass - * - * @return a Collection containing all known direct specialized - * ObjectModelClass for this class. - */ - public Collection<ObjectModelClass> getSpecialisations() { - if (specialisations == null) { - specialisations = new ArrayList<ObjectModelClass>(); - for (Iterator i = objectModelImpl.getClasses().iterator(); i - .hasNext();) { - ObjectModelClass candidateClass = (ObjectModelClass) i.next(); - if (candidateClass.getSuperclasses().contains(this)) { - specialisations.add(candidateClass); - } - } - } - return specialisations; - } + /** + * Returns all known direct specialized classes for this class. + * + * @see ObjectModelClass + * + * @return a Collection containing all known direct specialized + * ObjectModelClass for this class. + */ + public Collection<ObjectModelClass> getSpecialisations() { + if (specialisations == null) { + specialisations = new ArrayList<ObjectModelClass>(); + for (Iterator i = objectModelImpl.getClasses().iterator(); i + .hasNext();) { + ObjectModelClass candidateClass = (ObjectModelClass) i.next(); + if (candidateClass.getSuperclasses().contains(this)) { + specialisations.add(candidateClass); + } + } + } + return specialisations; + } - /** - * Returns all known specialized classes for this class for the specified - * discriminator. - * - * @see ObjectModelClass - * - * @return a Collection containing all known specialized ObjectModelClass - * for this class for the specified discriminator. - */ - public Collection<ObjectModelClass> getSpecialisations(String discriminator) { - List<ObjectModelClass> discriminatedSpecialisations = new ArrayList<ObjectModelClass>(); - for (Iterator<ObjectModelClass> i = getSpecialisations().iterator(); i.hasNext();) { - ObjectModelClass candidateClass = i.next(); - if (discriminator.equals(candidateClass.getDiscriminator(this))) { - discriminatedSpecialisations.add(candidateClass); - } - } - return discriminatedSpecialisations; - } + /** + * Returns all known specialized classes for this class for the specified + * discriminator. + * + * @see ObjectModelClass + * + * @return a Collection containing all known specialized ObjectModelClass + * for this class for the specified discriminator. + */ + public Collection<ObjectModelClass> getSpecialisations(String discriminator) { + List<ObjectModelClass> discriminatedSpecialisations = new ArrayList<ObjectModelClass>(); + for (Iterator<ObjectModelClass> i = getSpecialisations().iterator(); i + .hasNext();) { + ObjectModelClass candidateClass = i.next(); + if (discriminator.equals(candidateClass.getDiscriminator(this))) { + discriminatedSpecialisations.add(candidateClass); + } + } + return discriminatedSpecialisations; + } - public Collection<ObjectModelAttribute> getAttributes() { - return orderedAttributes; - } + public Collection<ObjectModelAttribute> getAttributes() { + return orderedAttributes; + } - /** - * Returns the attribute corresponding to the given name, or null if the - * class contains no attribute for this name. - * - * @return the ObjectModelAttribute of the found attribute, or null if the - * class contains no attribute for this name. - */ - public ObjectModelAttribute getAttribute(String attributeName) { - return (attributeName == null ? null - : (ObjectModelAttribute) attributes.get(attributeName)); - } + /** + * Returns the attribute corresponding to the given name, or null if the + * class contains no attribute for this name. + * + * @return the ObjectModelAttribute of the found attribute, or null if the + * class contains no attribute for this name. + */ + public ObjectModelAttribute getAttribute(String attributeName) { + return (attributeName == null ? null + : (ObjectModelAttribute) attributes.get(attributeName)); + } - /** - * Returns whether this class is abstract or not. - * - * @return a boolean indicating whether this class is abstract or not. - */ - public boolean isAbstract() { - return abstractz; - } + /** + * Returns whether this class is abstract or not. + * + * @return a boolean indicating whether this class is abstract or not. + */ + public boolean isAbstract() { + return abstractz; + } - public Collection<ObjectModelOperation> getAllOtherOperations(boolean distinct) { - Collection<ObjectModelOperation> result = getAllInterfaceOperations(distinct); - getAllSuperclassOperations(result); - return result; - } + public Collection<ObjectModelOperation> getAllOtherOperations( + boolean distinct) { + Collection<ObjectModelOperation> result = getAllInterfaceOperations(distinct); + getAllSuperclassOperations(result); + return result; + } - public Collection<ObjectModelOperation> getAllSuperclassOperations(boolean distinct) { - Collection<ObjectModelOperation> result = null; - if (distinct) { - result = new HashSet<ObjectModelOperation>(); - } else { - result = new LinkedList<ObjectModelOperation>(); - } - getAllSuperclassOperations(result); - return result; - } + public Collection<ObjectModelOperation> getAllSuperclassOperations( + boolean distinct) { + Collection<ObjectModelOperation> result = null; + if (distinct) { + result = new HashSet<ObjectModelOperation>(); + } else { + result = new LinkedList<ObjectModelOperation>(); + } + getAllSuperclassOperations(result); + return result; + } - protected Collection<ObjectModelOperation> getAllSuperclassOperations(Collection<ObjectModelOperation> result) { - for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { - ObjectModelClassImpl clazz = (ObjectModelClassImpl) i.next(); - result.addAll(clazz.getOperations()); - clazz.getAllSuperclassOperations(result); - clazz.getAllInterfaceOperations(result); - } - return result; - } + protected Collection<ObjectModelOperation> getAllSuperclassOperations( + Collection<ObjectModelOperation> result) { + for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { + ObjectModelClassImpl clazz = (ObjectModelClassImpl) i.next(); + result.addAll(clazz.getOperations()); + clazz.getAllSuperclassOperations(result); + clazz.getAllInterfaceOperations(result); + } + return result; + } - public Collection<ObjectModelAttribute> getAllOtherAttributes() { - Collection<ObjectModelAttribute> result = new LinkedList<ObjectModelAttribute>(); - getAllOtherAttributes(result); - return result; - } + public Collection<ObjectModelAttribute> getAllOtherAttributes() { + Collection<ObjectModelAttribute> result = new LinkedList<ObjectModelAttribute>(); + getAllOtherAttributes(result); + return result; + } - protected Collection<ObjectModelAttribute> getAllOtherAttributes(Collection<ObjectModelAttribute> result) { - for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { - ObjectModelClassImpl clazz = (ObjectModelClassImpl) i.next(); - result.addAll(clazz.getAttributes()); - clazz.getAllOtherAttributes(result); - } - return result; - } + protected Collection<ObjectModelAttribute> getAllOtherAttributes( + Collection<ObjectModelAttribute> result) { + for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { + ObjectModelClassImpl clazz = (ObjectModelClassImpl) i.next(); + result.addAll(clazz.getAttributes()); + clazz.getAllOtherAttributes(result); + } + return result; + } - public String toString() { - StringBuffer result = new StringBuffer(); - result.append("class " + getQualifiedName() + "<<" + getStereotypes() - + ">> tagvalue: " + getTagValues() + " "); - result.append("extends "); - for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { - result.append(((ObjectModelClassifier) i.next()).getName()); - if (i.hasNext()) { - result.append(", "); - } - } - result.append("implements "); - for (Iterator i = getInterfaces().iterator(); i.hasNext();) { - result.append(((ObjectModelClassifier) i.next()).getName()); - if (i.hasNext()) { - result.append(", "); - } - } - return result.toString(); - } + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("class " + getQualifiedName() + "<<" + getStereotypes() + + ">> tagvalue: " + getTagValues() + " "); + result.append("extends "); + for (Iterator i = getSuperclasses().iterator(); i.hasNext();) { + result.append(((ObjectModelClassifier) i.next()).getName()); + if (i.hasNext()) { + result.append(", "); + } + } + result.append("implements "); + for (Iterator i = getInterfaces().iterator(); i.hasNext();) { + result.append(((ObjectModelClassifier) i.next()).getName()); + if (i.hasNext()) { + result.append(", "); + } + } + return result.toString(); + } - /** - * Returns whether this classifier is a class or not - * - * @see ObjectModelClass - * - * @return a boolean indicating whether this classifier is a class or not. - */ - public boolean isClass() { - return true; - } + /** + * Returns whether this classifier is a class or not + * + * @see ObjectModelClass + * + * @return a boolean indicating whether this classifier is a class or not. + */ + public boolean isClass() { + return true; + } - /** - * Returns whether this classifier is an interface or not - * - * @see ObjectModelInterface - * - * @return a boolean indicating whether this classifier is an interface or - * not. - */ - public boolean isInterface() { - return false; - } + /** + * Returns whether this classifier is an interface or not + * + * @see ObjectModelInterface + * + * @return a boolean indicating whether this classifier is an interface or + * not. + */ + public boolean isInterface() { + return false; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassifierImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassifierImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelClassifierImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,6 +14,7 @@ * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + package org.codelutin.generator.models.object.xml; import java.util.ArrayList; @@ -28,8 +29,7 @@ import org.codelutin.generator.models.object.ObjectModelOperation; /** - * - * ObjectModelClassifierImpl.java + * ObjectModelClassifierImpl. * * @author chatellier * @author cedric @@ -38,7 +38,8 @@ * Last update : $Date$ * By : $Author$ */ -public abstract class ObjectModelClassifierImpl extends ObjectModelElementImpl implements ObjectModelClassifier { +public abstract class ObjectModelClassifierImpl extends ObjectModelElementImpl + implements ObjectModelClassifier { protected boolean extern = false; @@ -49,7 +50,7 @@ protected List<ObjectModelOperation> operations = new ArrayList<ObjectModelOperation>(); protected String type = null; - public String toString(){ + public String toString() { return "" + getQualifiedName() + " implements " + getInterfaces(); } @@ -116,9 +117,10 @@ public Collection<ObjectModelOperation> getOperations(String name) { List<ObjectModelOperation> result = new ArrayList<ObjectModelOperation>(); - for(Iterator<ObjectModelOperation> i=getOperations().iterator(); i.hasNext();){ + for (Iterator<ObjectModelOperation> i = getOperations().iterator(); i + .hasNext();) { ObjectModelOperation op = i.next(); - if(name.equals(op.getName())){ + if (name.equals(op.getName())) { result.add(op); } } @@ -129,25 +131,28 @@ return operations; } - public Collection<ObjectModelOperation> getAllOtherOperations(boolean distinct){ + public Collection<ObjectModelOperation> getAllOtherOperations( + boolean distinct) { return getAllInterfaceOperations(distinct); } - public Collection<ObjectModelOperation> getAllInterfaceOperations(boolean distinct){ + public Collection<ObjectModelOperation> getAllInterfaceOperations( + boolean distinct) { Collection<ObjectModelOperation> result = null; - if(distinct){ + if (distinct) { result = new HashSet<ObjectModelOperation>(); - }else{ + } else { result = new LinkedList<ObjectModelOperation>(); } getAllInterfaceOperations(result); return result; } - protected Collection<ObjectModelOperation> getAllInterfaceOperations(Collection<ObjectModelOperation> result){ - for(Iterator i=getInterfaces().iterator(); i.hasNext();){ - ObjectModelClassifierImpl interfacez = - (ObjectModelClassifierImpl)i.next(); + protected Collection<ObjectModelOperation> getAllInterfaceOperations( + Collection<ObjectModelOperation> result) { + for (Iterator i = getInterfaces().iterator(); i.hasNext();) { + ObjectModelClassifierImpl interfacez = (ObjectModelClassifierImpl) i + .next(); result.addAll(interfacez.getOperations()); interfacez.getAllInterfaceOperations(result); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,6 +1,6 @@ /* * *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -16,12 +16,7 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ -/* - * Created on May 13, 2004 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ + package org.codelutin.generator.models.object.xml; import java.util.ArrayList; @@ -33,7 +28,7 @@ import org.codelutin.generator.models.object.ObjectModelElement; /** - * ObjectModelElementImpl.java + * ObjectModelElementImpl. * * @author chatellier * @author cedric @@ -44,170 +39,168 @@ */ public class ObjectModelElementImpl implements ObjectModelElement { - protected ObjectModelImpl objectModelImpl; - protected ObjectModelElement declaringElement; + protected ObjectModelImpl objectModelImpl; + protected ObjectModelElement declaringElement; - protected String name = null; - protected String documentation = null; - protected List<String> stereotypes = new ArrayList<String>(); - protected Map<String,String> tagValues = new HashMap<String, String>(); - protected List<String> comments = new ArrayList<String>(); + protected String name = null; + protected String documentation = null; + protected List<String> stereotypes = new ArrayList<String>(); + protected Map<String, String> tagValues = new HashMap<String, String>(); + protected List<String> comments = new ArrayList<String>(); - public ObjectModelElementImpl() { - super(); - } + public ObjectModelElementImpl() { + super(); + } - /** - * @return the objectModelImpl - */ - public void setObjectModelImpl(ObjectModelImpl objectModelImpl) { - this.objectModelImpl = objectModelImpl; - } + /** + * @return the objectModelImpl + */ + public void setObjectModelImpl(ObjectModelImpl objectModelImpl) { + this.objectModelImpl = objectModelImpl; + } - /** - * @param declaringElement the declaringElement to set - */ - public void setDeclaringElement(ObjectModelElement declaringElement) { - this.declaringElement = declaringElement; - } - - /** - * TODO a tester - * @return - */ - protected ObjectModelImpl getModel() { - if(objectModelImpl != null) { - return objectModelImpl; - } - else if (declaringElement != null) { - return ((ObjectModelElementImpl)declaringElement).getModel(); - } - return null; - } + /** + * @param declaringElement the declaringElement to set + */ + public void setDeclaringElement(ObjectModelElement declaringElement) { + this.declaringElement = declaringElement; + } + /** + * TODO a tester + * @return + */ + protected ObjectModelImpl getModel() { + if (objectModelImpl != null) { + return objectModelImpl; + } else if (declaringElement != null) { + return ((ObjectModelElementImpl) declaringElement).getModel(); + } + return null; + } - public void postInit() {} + public void postInit() { + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public void setDocumentation(String documentation) { - this.documentation = documentation; - } + public void setDocumentation(String documentation) { + this.documentation = documentation; + } - public ObjectModelImplRef addStereotype(ObjectModelImplRef stereotype) { - if (stereotype == null) - return new ObjectModelImplRef(); - stereotypes.add(stereotype.getName()); - return stereotype; - } + public ObjectModelImplRef addStereotype(ObjectModelImplRef stereotype) { + if (stereotype == null) + return new ObjectModelImplRef(); + stereotypes.add(stereotype.getName()); + return stereotype; + } - public ObjectModelImplTagValue addTagValue(ObjectModelImplTagValue tagValue) { - if (tagValue == null) - return new ObjectModelImplTagValue(); - tagValues.put(tagValue.getName(), tagValue.getValue()); - return tagValue; - } + public ObjectModelImplTagValue addTagValue(ObjectModelImplTagValue tagValue) { + if (tagValue == null) + return new ObjectModelImplTagValue(); + tagValues.put(tagValue.getName(), tagValue.getValue()); + return tagValue; + } - public void addComment(String comment) { - this.comments.add(comment); - } + public void addComment(String comment) { + this.comments.add(comment); + } - public String getName() { - return name; - } + public String getName() { + return name; + } - /** - * Returns the element in which this element is defined, or null if there's none. - * - * @return the ObjectModelElement in which this element is defined, or null if there's none. - */ - public ObjectModelElement getDeclaringElement() { - return declaringElement; - } + /** + * Returns the element in which this element is defined, or null if there's none. + * + * @return the ObjectModelElement in which this element is defined, or null if there's none. + */ + public ObjectModelElement getDeclaringElement() { + return declaringElement; + } - /** - * Returns the whole documentation associated with this element (description + source documentation). - * - * @return the whole documentation associated with this element. - */ - public String getDocumentation() { - return documentation; - } + /** + * Returns the whole documentation associated with this element (description + source documentation). + * + * @return the whole documentation associated with this element. + */ + public String getDocumentation() { + return documentation; + } - /** - * Returns the description associated with this element. - * - * @return the description associated with this element. - */ - public String getDescription() { - return documentation.substring(0,documentation.indexOf("--")); - } + /** + * Returns the description associated with this element. + * + * @return the description associated with this element. + */ + public String getDescription() { + return documentation.substring(0, documentation.indexOf("--")); + } - /** - * Returns the source documentation part associated with this element. - * - * @return the source documentation part associated with this element. - */ - public String getSourceDocumentation() { - return documentation.substring(documentation.indexOf("--")+2); - } + /** + * Returns the source documentation part associated with this element. + * + * @return the source documentation part associated with this element. + */ + public String getSourceDocumentation() { + return documentation.substring(documentation.indexOf("--") + 2); + } + /** + * Returns the stereotypes names associated with this element. + * + * @return a Collection containing all stereotypes names associated with this element as String. + */ + public Collection<String> getStereotypes() { + return stereotypes; + } - /** - * Returns the stereotypes names associated with this element. - * - * @return a Collection containing all stereotypes names associated with this element as String. - */ - public Collection<String> getStereotypes() { - return stereotypes; - } + /** + * Returns whether this element has a stereotype corresponding to the given name, or not. + * + * @return a boolean indicating whether this element has a stereotype corresponding to the given name, or not. + */ + public boolean hasStereotype(String stereotypeName) { + return stereotypes.contains(stereotypeName); + } - /** - * Returns whether this element has a stereotype corresponding to the given name, or not. - * - * @return a boolean indicating whether this element has a stereotype corresponding to the given name, or not. - */ - public boolean hasStereotype(String stereotypeName) { - return stereotypes.contains(stereotypeName); - } + /** + * Returns the tagValues associated with this element. + * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) + * + * @return a Map containing all tagValues associated with this element + */ + public Map<String, String> getTagValues() { + return tagValues; + } - /** - * Returns the tagValues associated with this element. - * For each entry, the key is the name of the tagValue, the value is the value of the tagValue :-) - * - * @return a Map containing all tagValues associated with this element - */ - public Map<String,String> getTagValues() { - return tagValues; - } + /** + * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. + * + * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. + */ + public String getTagValue(String tagValue) { + return (tagValue == null ? null : (String) tagValues.get(tagValue)); + } - /** - * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. - * - * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. - */ - public String getTagValue(String tagValue) { - return (tagValue == null?null:(String) tagValues.get(tagValue)); - } + /** + * Returns whether this element has a tagValue corresponding to the given name, or not. + * + * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not. + */ + public boolean hasTagValue(String tagValue) { + return tagValues.containsKey(tagValue); + } - /** - * Returns whether this element has a tagValue corresponding to the given name, or not. - * - * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not. - */ - public boolean hasTagValue(String tagValue) { - return tagValues.containsKey(tagValue); - } - - /** - * Returns all comments lied to this particular model element - * - * @return a List containing all comments for this element as Strings. - */ + /** + * Returns all comments lied to this particular model element + * + * @return a List containing all comments for this element as Strings. + */ public List<String> getComments() { - return comments; + return comments; } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,18 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * ObjectModelImpl.java - * - * Created: 14 janv. 2004 - * - * @author C�dric Pineau <pineau@codelutin.com> - * Copyright Code Lutin - * @version $Revision$ - * - * Last update : $Date$ - * by : $Author$ - */ package org.codelutin.generator.models.object.xml; import java.util.ArrayList; @@ -48,401 +36,407 @@ * several facilities for a direct access to some of the object model elements. * In this concrete class, the tree is build by parsing an object model xml * description using lutinxml XMLObjectParser. + * + * Created: 14 janv. 2004 + * + * @author Cédric Pineau <pineau@codelutin.com> + * Copyright Code Lutin + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ */ public class ObjectModelImpl implements ObjectModel { - protected String name = null; - protected Map<String, ObjectModelClass> classes = new HashMap<String, ObjectModelClass>(); - protected Map<String, ObjectModelInterface> interfaces = new HashMap<String, ObjectModelInterface>(); - protected Map<String, ObjectModelClassifier> classifiers = new HashMap<String, ObjectModelClassifier>(); - protected List<String> comments = new ArrayList<String>(); - private Map<String, String> tagValues = new HashMap<String, String>(); + protected String name = null; + protected Map<String, ObjectModelClass> classes = new HashMap<String, ObjectModelClass>(); + protected Map<String, ObjectModelInterface> interfaces = new HashMap<String, ObjectModelInterface>(); + protected Map<String, ObjectModelClassifier> classifiers = new HashMap<String, ObjectModelClassifier>(); + protected List<String> comments = new ArrayList<String>(); + private Map<String, String> tagValues = new HashMap<String, String>(); - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public void addClass(ObjectModelClassImpl clazz) { - //if (clazz == null) - // return new ObjectModelClassImpl(this, null); - clazz.postInit(); - clazz.setObjectModelImpl(this); - - if (!clazz.isExtern()) { - ObjectModelElementImpl initialElement = (ObjectModelElementImpl) classes - .get(clazz.getQualifiedName()); - if (initialElement == null) { - classes.put(clazz.getQualifiedName(), clazz); - classifiers.put(clazz.getQualifiedName(), clazz); - } else { - if (!(initialElement instanceof ObjectModelClassImpl)) - throw new IllegalArgumentException( - "\"" - + clazz - + "\" is incompatible with already defined element \"" - + initialElement + "\""); - ObjectModelClassImpl initialClazz = (ObjectModelClassImpl) initialElement; + public void addClass(ObjectModelClassImpl clazz) { + //if (clazz == null) + // return new ObjectModelClassImpl(this, null); + clazz.postInit(); + clazz.setObjectModelImpl(this); - // La classe existe déjà. On va prendre tout ce que contient la - // nouvelle classe et l'ajouter à la précédente si nécessaire. + if (!clazz.isExtern()) { + ObjectModelElementImpl initialElement = (ObjectModelElementImpl) classes + .get(clazz.getQualifiedName()); + if (initialElement == null) { + classes.put(clazz.getQualifiedName(), clazz); + classifiers.put(clazz.getQualifiedName(), clazz); + } else { + if (!(initialElement instanceof ObjectModelClassImpl)) + throw new IllegalArgumentException( + "\"" + + clazz + + "\" is incompatible with already defined element \"" + + initialElement + "\""); + ObjectModelClassImpl initialClazz = (ObjectModelClassImpl) initialElement; - mergeClasses(initialClazz, clazz); - clazz = initialClazz; - } - } - //return clazz; - } + // La classe existe déjà. On va prendre tout ce que contient la + // nouvelle classe et l'ajouter à la précédente si nécessaire. - public void addAssociationClass( - ObjectModelAssociationClassImpl clazz) { - //if (clazz == null) - // return new ObjectModelAssociationClassImpl(this, null); - clazz.postInit(); - clazz.setObjectModelImpl(this); - - if (!clazz.isExtern()) { - ObjectModelElementImpl initialElement = (ObjectModelElementImpl) classes - .get(clazz.getQualifiedName()); - if (initialElement == null) { - classes.put(clazz.getQualifiedName(), clazz); - classifiers.put(clazz.getQualifiedName(), clazz); - } else { - if (!(initialElement instanceof ObjectModelAssociationClassImpl)) - throw new IllegalArgumentException( - "\"" - + clazz - + "\" is incompatible with already defined element \"" - + initialElement + "\""); - ObjectModelAssociationClassImpl initialClazz = (ObjectModelAssociationClassImpl) initialElement; + mergeClasses(initialClazz, clazz); + clazz = initialClazz; + } + } + //return clazz; + } - mergeAssociationClasses(initialClazz, clazz); - clazz = initialClazz; - } - } - //return clazz; - } + public void addAssociationClass(ObjectModelAssociationClassImpl clazz) { + //if (clazz == null) + // return new ObjectModelAssociationClassImpl(this, null); + clazz.postInit(); + clazz.setObjectModelImpl(this); - public void addComment(String comment) { - this.comments.add(comment); - } + if (!clazz.isExtern()) { + ObjectModelElementImpl initialElement = (ObjectModelElementImpl) classes + .get(clazz.getQualifiedName()); + if (initialElement == null) { + classes.put(clazz.getQualifiedName(), clazz); + classifiers.put(clazz.getQualifiedName(), clazz); + } else { + if (!(initialElement instanceof ObjectModelAssociationClassImpl)) + throw new IllegalArgumentException( + "\"" + + clazz + + "\" is incompatible with already defined element \"" + + initialElement + "\""); + ObjectModelAssociationClassImpl initialClazz = (ObjectModelAssociationClassImpl) initialElement; - /** - * Returns the name of this model. - * - * @return the name of this model. - */ - public String getName() { - return name; - } + mergeAssociationClasses(initialClazz, clazz); + clazz = initialClazz; + } + } + //return clazz; + } - /** - * Returns all classifiers defined in this model. - * - * @see ObjectModelClassifier - * - * @return a Collection containing all ObjectModelClassifier for this model. - */ - public Collection<ObjectModelClassifier> getClassifiers() { - return classifiers.values(); - } + public void addComment(String comment) { + this.comments.add(comment); + } - /** - * Returns the classifier corresponding to the given qualified name, or null - * if the model contains no classifier for this qualified name. - * - * @param qualifiedClassifierName - - * the qualified name of the classifier to retrieve. - * - * @return the ObjectModelClassifier of the found classifier, or null if the - * model contains no classifier for this qualified name. - */ - public ObjectModelClassifier getClassifier(String qualifiedClassifierName) { - return (qualifiedClassifierName == null ? null - : (ObjectModelClassifier) classifiers - .get(qualifiedClassifierName)); - } + /** + * Returns the name of this model. + * + * @return the name of this model. + */ + public String getName() { + return name; + } - /** - * Returns all classes defined in this model. - * - * @see ObjectModelClass. - * - * @return a Collection containing all ObjectModelClass for this model. - */ - public Collection<ObjectModelClass> getClasses() { - return classes.values(); - } + /** + * Returns all classifiers defined in this model. + * + * @see ObjectModelClassifier + * + * @return a Collection containing all ObjectModelClassifier for this model. + */ + public Collection<ObjectModelClassifier> getClassifiers() { + return classifiers.values(); + } - /** - * Returns the class corresponding to the given qualified name, or null if - * the model contains no class for this qualified name. - * - * @param qualifiedClassName - - * the qualified name of the class to retrieve. - * - * @return the ObjectModelClass of the found class, or null if the model - * contains no class for this qualified name. - */ - public ObjectModelClass getClass(String qualifiedClassName) { - if (qualifiedClassName == null) - return null; - if (!hasClass(qualifiedClassName)) { - System.out.println("WARNING : Class " + qualifiedClassName - + " not found in model"); - System.out - .println("You may forgot to declare for good an external class ?"); - } - return (ObjectModelClass) classes.get(qualifiedClassName); - } + /** + * Returns the classifier corresponding to the given qualified name, or null + * if the model contains no classifier for this qualified name. + * + * @param qualifiedClassifierName - + * the qualified name of the classifier to retrieve. + * + * @return the ObjectModelClassifier of the found classifier, or null if the + * model contains no classifier for this qualified name. + */ + public ObjectModelClassifier getClassifier(String qualifiedClassifierName) { + return (qualifiedClassifierName == null ? null + : (ObjectModelClassifier) classifiers + .get(qualifiedClassifierName)); + } - /* - * (non-Javadoc) - * - * @see org.codelutin.generator.models.object.ObjectModel#hasClass(java.lang.String) - */ - public boolean hasClass(String qualifiedClassName) { - boolean hasClass = classes.containsKey(qualifiedClassName); - return hasClass; - } + /** + * Returns all classes defined in this model. + * + * @see ObjectModelClass. + * + * @return a Collection containing all ObjectModelClass for this model. + */ + public Collection<ObjectModelClass> getClasses() { + return classes.values(); + } - public void addInterface(ObjectModelInterfaceImpl interfacez) { - //if (interfacez == null) - // return new ObjectModelInterfaceImpl(this, null); - interfacez.postInit(); - interfacez.setObjectModelImpl(this); - - if (!interfacez.isExtern()) { - ObjectModelElementImpl initialElement = (ObjectModelElementImpl) interfaces - .get(interfacez.getQualifiedName()); - if (initialElement == null) { - interfaces.put(interfacez.getQualifiedName(), interfacez); - classifiers.put(interfacez.getQualifiedName(), interfacez); - } else { - if (!(initialElement instanceof ObjectModelInterfaceImpl)) - throw new IllegalArgumentException( - "\"" - + interfacez - + "\" is incompatible with already defined element \"" - + initialElement + "\""); - ObjectModelInterfaceImpl initialInterfacez = (ObjectModelInterfaceImpl) initialElement; + /** + * Returns the class corresponding to the given qualified name, or null if + * the model contains no class for this qualified name. + * + * @param qualifiedClassName - + * the qualified name of the class to retrieve. + * + * @return the ObjectModelClass of the found class, or null if the model + * contains no class for this qualified name. + */ + public ObjectModelClass getClass(String qualifiedClassName) { + if (qualifiedClassName == null) + return null; + if (!hasClass(qualifiedClassName)) { + System.out.println("WARNING : Class " + qualifiedClassName + + " not found in model"); + System.out + .println("You may forgot to declare for good an external class ?"); + } + return (ObjectModelClass) classes.get(qualifiedClassName); + } - mergeClassifiers(initialInterfacez, interfacez); - interfacez = initialInterfacez; - } - } - //return interfacez; - } + /* + * (non-Javadoc) + * + * @see org.codelutin.generator.models.object.ObjectModel#hasClass(java.lang.String) + */ + public boolean hasClass(String qualifiedClassName) { + boolean hasClass = classes.containsKey(qualifiedClassName); + return hasClass; + } - /** - * Returns the interface corresponding to the given qualified name, or null - * if the model contains no interface for this qualified name. - * - * @param qualifiedInterfaceName - - * the qualified name of the interface to retrieve. - * - * @return the ObjectModelInterface of the found interface, or null if the - * model contains no interface for this qualified name. - */ - public ObjectModelInterface getInterface(String qualifiedInterfaceName) { - ObjectModelInterface result = null; - result = (ObjectModelInterface) interfaces.get(qualifiedInterfaceName); - if (result == null) { - System.out.println("WARNING : Class " + qualifiedInterfaceName - + " not found in model"); - } - return result; - } + public void addInterface(ObjectModelInterfaceImpl interfacez) { + //if (interfacez == null) + // return new ObjectModelInterfaceImpl(this, null); + interfacez.postInit(); + interfacez.setObjectModelImpl(this); - /** - * Returns all interfaces defined in this model. - * - * @see ObjectModelInterface. - * - * @return a Collection containing all ObjectModelInterface for this model. - */ - public Collection<ObjectModelInterface> getInterfaces() { - return interfaces.values(); - } + if (!interfacez.isExtern()) { + ObjectModelElementImpl initialElement = (ObjectModelElementImpl) interfaces + .get(interfacez.getQualifiedName()); + if (initialElement == null) { + interfaces.put(interfacez.getQualifiedName(), interfacez); + classifiers.put(interfacez.getQualifiedName(), interfacez); + } else { + if (!(initialElement instanceof ObjectModelInterfaceImpl)) + throw new IllegalArgumentException( + "\"" + + interfacez + + "\" is incompatible with already defined element \"" + + initialElement + "\""); + ObjectModelInterfaceImpl initialInterfacez = (ObjectModelInterfaceImpl) initialElement; - /** - * Returns all comments not lied to a particular model element - * - * @return a List containing all comments for this model as Strings. - */ - public List<String> getComments() { - return comments; - } + mergeClassifiers(initialInterfacez, interfacez); + interfacez = initialInterfacez; + } + } + //return interfacez; + } - private void mergeClassifiers(ObjectModelClassifierImpl initialClazzifier, - ObjectModelClassifierImpl additionalClazzifier) { - Iterator it; + /** + * Returns the interface corresponding to the given qualified name, or null + * if the model contains no interface for this qualified name. + * + * @param qualifiedInterfaceName - + * the qualified name of the interface to retrieve. + * + * @return the ObjectModelInterface of the found interface, or null if the + * model contains no interface for this qualified name. + */ + public ObjectModelInterface getInterface(String qualifiedInterfaceName) { + ObjectModelInterface result = null; + result = (ObjectModelInterface) interfaces.get(qualifiedInterfaceName); + if (result == null) { + System.out.println("WARNING : Class " + qualifiedInterfaceName + + " not found in model"); + } + return result; + } - // On n'utilise pas les parsetXXX puisque les post-init sont censés être - // déjà faits... + /** + * Returns all interfaces defined in this model. + * + * @see ObjectModelInterface. + * + * @return a Collection containing all ObjectModelInterface for this model. + */ + public Collection<ObjectModelInterface> getInterfaces() { + return interfaces.values(); + } - // System.out.println("Doc initial : " + - // initialClazzifier.documentation); - // System.out.println("Doc additional : " + - // additionalClazzifier.documentation); - String description = ""; - String sourceDoc = ""; - if (initialClazzifier.documentation != null) { - description += initialClazzifier.getDescription(); - if (initialClazzifier.documentation.contains("--")) - sourceDoc += initialClazzifier.getSourceDocumentation(); - } - if (additionalClazzifier.documentation != null) { - if (!description.equals("")) - description += " - "; - description += additionalClazzifier.getDescription(); - if (additionalClazzifier.documentation.contains("--")) { - if (!sourceDoc.equals("")) - sourceDoc += " - "; - sourceDoc += additionalClazzifier.getSourceDocumentation(); - } - } - if (!description.equals("") || !sourceDoc.equals("")) - initialClazzifier.documentation = description + "--" + sourceDoc; + /** + * Returns all comments not lied to a particular model element + * + * @return a List containing all comments for this model as Strings. + */ + public List<String> getComments() { + return comments; + } - // System.out.println("Doc after : " + initialClazzifier.documentation); + private void mergeClassifiers(ObjectModelClassifierImpl initialClazzifier, + ObjectModelClassifierImpl additionalClazzifier) { + Iterator it; - for (it = additionalClazzifier.interfacesRefs.iterator(); it.hasNext();) { - ObjectModelImplRef interfaceRef = (ObjectModelImplRef) it.next(); - if (!contains(initialClazzifier.interfacesRefs, interfaceRef)) - initialClazzifier.interfacesRefs.add(interfaceRef); - initialClazzifier.interfaces = null; // On force ainsi à - // regénérer l'objet - } - for (it = additionalClazzifier.getOperations().iterator(); it.hasNext();) { - ObjectModelOperationImpl operation = (ObjectModelOperationImpl) it - .next(); - if (!contains(initialClazzifier.getOperations(), operation)) - initialClazzifier.operations.add(operation); - } - for (it = additionalClazzifier.getComments().iterator(); it.hasNext();) { - String comment = (String) it.next(); - if (!initialClazzifier.comments.contains(comment)) - initialClazzifier.comments.add(comment); - } - for (it = additionalClazzifier.getStereotypes().iterator(); it - .hasNext();) { - String stereotype = (String) it.next(); - if (!initialClazzifier.getStereotypes().contains(stereotype)) - initialClazzifier.stereotypes.add(stereotype); - } + // On n'utilise pas les parsetXXX puisque les post-init sont censés être + // déjà faits... - for (it = additionalClazzifier.getTagValues().keySet().iterator(); it - .hasNext();) { - String tagName = (String) it.next(); - if (!initialClazzifier.getTagValues().containsKey(tagName)) - initialClazzifier.tagValues.put(tagName, additionalClazzifier - .getTagValue(tagName)); - } - } + // System.out.println("Doc initial : " + + // initialClazzifier.documentation); + // System.out.println("Doc additional : " + + // additionalClazzifier.documentation); + String description = ""; + String sourceDoc = ""; + if (initialClazzifier.documentation != null) { + description += initialClazzifier.getDescription(); + if (initialClazzifier.documentation.contains("--")) + sourceDoc += initialClazzifier.getSourceDocumentation(); + } + if (additionalClazzifier.documentation != null) { + if (!description.equals("")) + description += " - "; + description += additionalClazzifier.getDescription(); + if (additionalClazzifier.documentation.contains("--")) { + if (!sourceDoc.equals("")) + sourceDoc += " - "; + sourceDoc += additionalClazzifier.getSourceDocumentation(); + } + } + if (!description.equals("") || !sourceDoc.equals("")) + initialClazzifier.documentation = description + "--" + sourceDoc; - /** - * This method takes two ObjectModelClassImpl and merges both of them in the - * first one - * - * @param initialClazz - * the instance of ObjectModelClassImpl to be modified - * @param additionalClazz - * the instance of ObjectModelClassImpl tu be used for merging - */ - private void mergeClasses(ObjectModelClassImpl initialClazz, - ObjectModelClassImpl additionalClazz) { - Iterator it; - mergeClassifiers(initialClazz, additionalClazz); + // System.out.println("Doc after : " + initialClazzifier.documentation); - for (it = additionalClazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttributeImpl attribute = (ObjectModelAttributeImpl) it - .next(); - if (!contains(initialClazz.getAttributes(), attribute)) { - initialClazz.attributes.put(attribute.getName(), attribute); - initialClazz.orderedAttributes.add(attribute); - } - } - for (it = additionalClazz.superclassesRefs.iterator(); it.hasNext();) { - ObjectModelImplRef superclassRef = (ObjectModelImplRef) it.next(); - if (!contains(initialClazz.superclassesRefs, superclassRef)) - initialClazz.superclassesRefs.add(superclassRef); - initialClazz.superclasses = null; // On force ainsi à regénérer - // l'objet - } - } + for (it = additionalClazzifier.interfacesRefs.iterator(); it.hasNext();) { + ObjectModelImplRef interfaceRef = (ObjectModelImplRef) it.next(); + if (!contains(initialClazzifier.interfacesRefs, interfaceRef)) + initialClazzifier.interfacesRefs.add(interfaceRef); + initialClazzifier.interfaces = null; // On force ainsi à + // regénérer l'objet + } + for (it = additionalClazzifier.getOperations().iterator(); it.hasNext();) { + ObjectModelOperationImpl operation = (ObjectModelOperationImpl) it + .next(); + if (!contains(initialClazzifier.getOperations(), operation)) + initialClazzifier.operations.add(operation); + } + for (it = additionalClazzifier.getComments().iterator(); it.hasNext();) { + String comment = (String) it.next(); + if (!initialClazzifier.comments.contains(comment)) + initialClazzifier.comments.add(comment); + } + for (it = additionalClazzifier.getStereotypes().iterator(); it + .hasNext();) { + String stereotype = (String) it.next(); + if (!initialClazzifier.getStereotypes().contains(stereotype)) + initialClazzifier.stereotypes.add(stereotype); + } - private void mergeAssociationClasses( - ObjectModelAssociationClassImpl initialAssocClazz, - ObjectModelAssociationClassImpl additionalAssocClazz) { - mergeClasses(initialAssocClazz, additionalAssocClazz); - Iterator it; - for (it = additionalAssocClazz.participantsRefs.iterator(); it - .hasNext();) { - ObjectModeImplAssociationClassParticipant participant = (ObjectModeImplAssociationClassParticipant) it - .next(); - if (!contains(initialAssocClazz.participantsRefs, participant)) - initialAssocClazz.participantsRefs.add(participant); - initialAssocClazz.participantsAttributes = null; // On force - // ainsi à - // regénérer - // l'objet - initialAssocClazz.participantsClassifiers = null; // On force - // ainsi à - // regénérer - // l'objet - } - } + for (it = additionalClazzifier.getTagValues().keySet().iterator(); it + .hasNext();) { + String tagName = (String) it.next(); + if (!initialClazzifier.getTagValues().containsKey(tagName)) + initialClazzifier.tagValues.put(tagName, additionalClazzifier + .getTagValue(tagName)); + } + } - private boolean contains(Collection<ObjectModelAttribute> coll, - ObjectModelAttributeImpl toFind) { - for (Iterator<ObjectModelAttribute> it = coll.iterator(); it - .hasNext();) { - ObjectModelAttribute attribute = it.next(); - if (attribute.getName().equals(toFind.getName())) // Seul le nom - // de l'attribut - // compte - return true; - } - return false; - } + /** + * This method takes two ObjectModelClassImpl and merges both of them in the + * first one + * + * @param initialClazz + * the instance of ObjectModelClassImpl to be modified + * @param additionalClazz + * the instance of ObjectModelClassImpl tu be used for merging + */ + private void mergeClasses(ObjectModelClassImpl initialClazz, + ObjectModelClassImpl additionalClazz) { + Iterator it; + mergeClassifiers(initialClazz, additionalClazz); - private boolean contains(Collection coll, ObjectModelOperationImpl toFind) { - return coll.contains(toFind); // Le equals(...) de - // ObjectModelOperationImpl convient - } + for (it = additionalClazz.getAttributes().iterator(); it.hasNext();) { + ObjectModelAttributeImpl attribute = (ObjectModelAttributeImpl) it + .next(); + if (!contains(initialClazz.getAttributes(), attribute)) { + initialClazz.attributes.put(attribute.getName(), attribute); + initialClazz.orderedAttributes.add(attribute); + } + } + for (it = additionalClazz.superclassesRefs.iterator(); it.hasNext();) { + ObjectModelImplRef superclassRef = (ObjectModelImplRef) it.next(); + if (!contains(initialClazz.superclassesRefs, superclassRef)) + initialClazz.superclassesRefs.add(superclassRef); + initialClazz.superclasses = null; // On force ainsi à regénérer + // l'objet + } + } - private boolean contains(Collection coll, ObjectModelImplRef toFind) { - return coll.contains(toFind); // Le equals(...) de ObjectModelImplRef - // convient - } + private void mergeAssociationClasses( + ObjectModelAssociationClassImpl initialAssocClazz, + ObjectModelAssociationClassImpl additionalAssocClazz) { + mergeClasses(initialAssocClazz, additionalAssocClazz); + Iterator it; + for (it = additionalAssocClazz.participantsRefs.iterator(); it + .hasNext();) { + ObjectModeImplAssociationClassParticipant participant = (ObjectModeImplAssociationClassParticipant) it + .next(); + if (!contains(initialAssocClazz.participantsRefs, participant)) + initialAssocClazz.participantsRefs.add(participant); + initialAssocClazz.participantsAttributes = null; // On force + // ainsi à + // regénérer + // l'objet + initialAssocClazz.participantsClassifiers = null; // On force + // ainsi à + // regénérer + // l'objet + } + } - public ObjectModelImplTagValue addTagValue( - ObjectModelImplTagValue tagValue) { - if (tagValue == null) - return new ObjectModelImplTagValue(); - tagValues.put(tagValue.getName(), tagValue.getValue()); - return tagValue; - } + private boolean contains(Collection<ObjectModelAttribute> coll, + ObjectModelAttributeImpl toFind) { + for (Iterator<ObjectModelAttribute> it = coll.iterator(); it.hasNext();) { + ObjectModelAttribute attribute = it.next(); + if (attribute.getName().equals(toFind.getName())) // Seul le nom + // de l'attribut + // compte + return true; + } + return false; + } - /** - * Returns the tagValues associated with this element. For each entry, the - * key is the name of the tagValue, the value is the value of the tagValue - * :-) - * - * @return a Map containing all tagValues associated with this element - */ - public Map<String,String> getTagValues() { - return tagValues; - } + private boolean contains(Collection coll, ObjectModelOperationImpl toFind) { + return coll.contains(toFind); // Le equals(...) de + // ObjectModelOperationImpl convient + } - /** - * Returns the tagValue corresponding to the given name, or null if the - * element has no associated tagValue for this name. - * - * @return the value of the found tagValue, or null if the element has no - * associated tagValue for this name. - */ - public String getTagValue(String tagValue) { - return (tagValue == null ? null : (String) tagValues.get(tagValue)); - } + private boolean contains(Collection coll, ObjectModelImplRef toFind) { + return coll.contains(toFind); // Le equals(...) de ObjectModelImplRef + // convient + } + + public ObjectModelImplTagValue addTagValue(ObjectModelImplTagValue tagValue) { + if (tagValue == null) + return new ObjectModelImplTagValue(); + tagValues.put(tagValue.getName(), tagValue.getValue()); + return tagValue; + } + + /** + * Returns the tagValues associated with this element. For each entry, the + * key is the name of the tagValue, the value is the value of the tagValue + * :-) + * + * @return a Map containing all tagValues associated with this element + */ + public Map<String, String> getTagValues() { + return tagValues; + } + + /** + * Returns the tagValue corresponding to the given name, or null if the + * element has no associated tagValue for this name. + * + * @return the value of the found tagValue, or null if the element has no + * associated tagValue for this name. + */ + public String getTagValue(String tagValue) { + return (tagValue == null ? null : (String) tagValues.get(tagValue)); + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplRef.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplRef.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplRef.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,11 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* ObjectModelImplRef.java + +package org.codelutin.generator.models.object.xml; + +/** +* ObjectModelImplRef. * * Created: 14 janv. 2004 * @@ -27,14 +30,13 @@ * Last update : $Date$ * by : $Author$ */ -package org.codelutin.generator.models.object.xml; - public class ObjectModelImplRef { protected String name = null; - public void postInit() {} - + public void postInit() { + } + public void setName(String name) { this.name = name; } @@ -42,14 +44,14 @@ public String getName() { return name; } - + public boolean equals(Object o) { - if (!(o instanceof ObjectModelImplRef)) - return false; - ObjectModelImplRef oRef = (ObjectModelImplRef)o; - if (name == null) - return (oRef.getName() == null); - return name.equals(oRef.getName()); + if (!(o instanceof ObjectModelImplRef)) + return false; + ObjectModelImplRef oRef = (ObjectModelImplRef) o; + if (name == null) + return (oRef.getName() == null); + return name.equals(oRef.getName()); } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplSuperClassRef.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplSuperClassRef.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplSuperClassRef.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -17,8 +17,8 @@ package org.codelutin.generator.models.object.xml; -/* * -* ObjectModelImplRef.java +/** +* ObjectModelImplRef. * * Created: 14 janv. 2004 * @@ -32,8 +32,8 @@ public class ObjectModelImplSuperClassRef extends ObjectModelImplRef { protected String discrimininator = null; - - public void setDiscriminator (String discrimininator) { + + public void setDiscriminator(String discrimininator) { this.discrimininator = discrimininator; } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplTagValue.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplTagValue.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelImplTagValue.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,6 +14,7 @@ * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + package org.codelutin.generator.models.object.xml; /** @@ -27,13 +28,13 @@ */ public class ObjectModelImplTagValue extends ObjectModelImplRef { - protected String value = null; + protected String value = null; - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelInterfaceImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelInterfaceImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelInterfaceImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,7 +23,7 @@ import org.codelutin.generator.models.object.ObjectModelClassifier; import org.codelutin.generator.models.object.ObjectModelInterface; -/* * +/** * ObjectModelInterfaceImpl.java * * Created: 14 janv. 2004 @@ -36,45 +36,45 @@ * by : $Author$ */ public class ObjectModelInterfaceImpl extends ObjectModelClassifierImpl - implements ObjectModelInterface { + implements ObjectModelInterface { - public ObjectModelInterfaceImpl() { - super(); - } + public ObjectModelInterfaceImpl() { + super(); + } - public String toString() { - StringBuffer result = new StringBuffer(); - result.append("interface " + getQualifiedName() + " "); - result.append("extends "); - for (Iterator i = getInterfaces().iterator(); i.hasNext();) { - result.append(((ObjectModelClassifier) i.next()).getName()); - if (i.hasNext()) { - result.append(", "); - } - } - return result.toString(); - } + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("interface " + getQualifiedName() + " "); + result.append("extends "); + for (Iterator i = getInterfaces().iterator(); i.hasNext();) { + result.append(((ObjectModelClassifier) i.next()).getName()); + if (i.hasNext()) { + result.append(", "); + } + } + return result.toString(); + } - /** - * Returns whether this classifier is a class or not - * - * @see ObjectModelClass - * - * @return a boolean indicating whether this classifier is a class or not. - */ - public boolean isClass() { - return false; - } + /** + * Returns whether this classifier is a class or not + * + * @see ObjectModelClass + * + * @return a boolean indicating whether this classifier is a class or not. + */ + public boolean isClass() { + return false; + } - /** - * Returns whether this classifier is an interface or not - * - * @see ObjectModelInterface - * - * @return a boolean indicating whether this classifier is an interface or - * not. - */ - public boolean isInterface() { - return true; - } + /** + * Returns whether this classifier is an interface or not + * + * @see ObjectModelInterface + * + * @return a boolean indicating whether this classifier is an interface or + * not. + */ + public boolean isInterface() { + return true; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelOperationImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelOperationImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelOperationImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /*##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -27,7 +27,7 @@ import org.codelutin.generator.models.object.ObjectModelOperation; import org.codelutin.generator.models.object.ObjectModelParameter; -/* * +/** * ObjectModelOperationImpl.java * * Created: 14 janv. 2004 @@ -39,112 +39,112 @@ * Last update : $Date$ by : $Author$ */ public class ObjectModelOperationImpl extends ObjectModelElementImpl implements - ObjectModelOperation { + ObjectModelOperation { - protected ObjectModelParameter returnParameter = null; + protected ObjectModelParameter returnParameter = null; - protected String visibility = "public"; + protected String visibility = "public"; - protected String transactionLevel = "supports"; + protected String transactionLevel = "supports"; - protected boolean abstractz = false; + protected boolean abstractz = false; - protected List<ObjectModelParameter> parameters = new ArrayList<ObjectModelParameter>(); + protected List<ObjectModelParameter> parameters = new ArrayList<ObjectModelParameter>(); - protected Set<String> exceptions = new HashSet<String>(); + protected Set<String> exceptions = new HashSet<String>(); - public ObjectModelOperationImpl() { - super(); - } + public ObjectModelOperationImpl() { + super(); + } - public String toString() { - return getName() + "(" + parameters + ")" + "<<" + getStereotypes() - + ">> throws " + exceptions + " tagvalue: " + getTagValues(); - } + public String toString() { + return getName() + "(" + parameters + ")" + "<<" + getStereotypes() + + ">> throws " + exceptions + " tagvalue: " + getTagValues(); + } - /** - * 2 operations are equal if the have same name and same argument type. - */ - public boolean equals(Object o) { - if (o instanceof ObjectModelOperation) { - ObjectModelOperation op = (ObjectModelOperation) o; - if (getName().equals(op.getName()) - && getParameters().size() == op.getParameters().size()) { - for (Iterator i = getParameters().iterator(), opi = op - .getParameters().iterator(); i.hasNext() - && opi.hasNext();) { - ObjectModelParameter p = (ObjectModelParameter) i.next(); - ObjectModelParameter pop = (ObjectModelParameter) opi - .next(); - if (!p.getType().equals(pop.getType())) { - return false; - } - } - return true; - } - } - return false; - } + /** + * 2 operations are equal if the have same name and same argument type. + */ + public boolean equals(Object o) { + if (o instanceof ObjectModelOperation) { + ObjectModelOperation op = (ObjectModelOperation) o; + if (getName().equals(op.getName()) + && getParameters().size() == op.getParameters().size()) { + for (Iterator i = getParameters().iterator(), opi = op + .getParameters().iterator(); i.hasNext() + && opi.hasNext();) { + ObjectModelParameter p = (ObjectModelParameter) i.next(); + ObjectModelParameter pop = (ObjectModelParameter) opi + .next(); + if (!p.getType().equals(pop.getType())) { + return false; + } + } + return true; + } + } + return false; + } - public void addParameter(ObjectModelParameterImpl parameter) { - // if (parameter == null) - // return new ObjectModelParameterImpl(objectModelImpl, this); - parameter.postInit(); - parameter.setDeclaringElement(this); - parameters.add(parameter); - // return parameter; - } + public void addParameter(ObjectModelParameterImpl parameter) { + // if (parameter == null) + // return new ObjectModelParameterImpl(objectModelImpl, this); + parameter.postInit(); + parameter.setDeclaringElement(this); + parameters.add(parameter); + // return parameter; + } - public void setVisibility(String visibility) { - this.visibility = visibility; - } + public void setVisibility(String visibility) { + this.visibility = visibility; + } - public void setAbstract(boolean abstractz) { - this.abstractz = abstractz; - } + public void setAbstract(boolean abstractz) { + this.abstractz = abstractz; + } - public void setReturnParameter(ObjectModelParameterImpl returnParameter) { - // /if (returnParameter == null) - // return new ObjectModelParameterImpl(objectModelImpl, this); - returnParameter.postInit(); - returnParameter.setDeclaringElement(this); - this.returnParameter = returnParameter; - // return returnParameter; - } + public void setReturnParameter(ObjectModelParameterImpl returnParameter) { + // /if (returnParameter == null) + // return new ObjectModelParameterImpl(objectModelImpl, this); + returnParameter.postInit(); + returnParameter.setDeclaringElement(this); + this.returnParameter = returnParameter; + // return returnParameter; + } - public String getReturnType() { - return returnParameter.getType(); - } + public String getReturnType() { + return returnParameter.getType(); + } - public String getVisibility() { - return visibility; - } + public String getVisibility() { + return visibility; + } - /** - * Returns whether this operation is abstract or not. - * - * @return a boolean indicating whether this operation is abstract or not. - */ - public boolean isAbstract() { - return abstractz; - } + /** + * Returns whether this operation is abstract or not. + * + * @return a boolean indicating whether this operation is abstract or not. + */ + public boolean isAbstract() { + return abstractz; + } - public Collection<ObjectModelParameter> getParameters() { - return parameters; - } + public Collection<ObjectModelParameter> getParameters() { + return parameters; + } - public void addExceptionParameter(ObjectModelParameterImpl raisedParameter) { - // if (raisedParameter == null) { - // return new ObjectModelParameterImpl(objectModelImpl, this); - // } - raisedParameter.postInit(); - raisedParameter.setDeclaringElement(this); - - this.exceptions.add(raisedParameter.getType()); - // return raisedParameter; - } + public void addExceptionParameter(ObjectModelParameterImpl raisedParameter) { + // if (raisedParameter == null) { + // return new ObjectModelParameterImpl(objectModelImpl, this); + // } + raisedParameter.postInit(); + raisedParameter.setDeclaringElement(this); - public Set<String> getExceptions() { - return exceptions; - } + this.exceptions.add(raisedParameter.getType()); + // return raisedParameter; + } + + public Set<String> getExceptions() { + return exceptions; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelParameterImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelParameterImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelParameterImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -19,8 +19,8 @@ import org.codelutin.generator.models.object.ObjectModelParameter; -/* * - * ObjectModelParameterImpl.java +/** + * ObjectModelParameterImpl. * * Created: 14 janv. 2004 * @@ -31,24 +31,24 @@ * Last update : $Date$ by : $Author$ */ public class ObjectModelParameterImpl extends ObjectModelElementImpl implements - ObjectModelParameter { + ObjectModelParameter { - protected String type = null; + protected String type = null; - public ObjectModelParameterImpl() { - super(); - } + public ObjectModelParameterImpl() { + super(); + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public String toString() { - return getType() + " " + getName() + "<<" + getStereotypes() - + ">> tagvalue: " + getTagValues(); - } + public String toString() { + return getType() + " " + getName() + "<<" + getStereotypes() + + ">> tagvalue: " + getTagValues(); + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModel.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModel.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModel.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -34,10 +34,10 @@ */ public interface StateModel extends Model { - /** - * Return the collection of charts - * @return collection of charts - */ - public abstract List<StateModelStateChart> getStateCharts(); + /** + * Return the collection of charts + * @return collection of charts + */ + public abstract List<StateModelStateChart> getStateCharts(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelComplexState.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelComplexState.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelComplexState.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -32,24 +32,24 @@ */ public interface StateModelComplexState extends StateModelState { - /** - * Return the states set - * @return a collection of states - */ - public Collection<StateModelState> getStates(); - - /** - * Return the non initial state pointed by the initial state of the state - * set. - * - * Exemple : - * myComplexeState = ( - * init1 -> state2 -> state3 -> final4 - * ) - * - * myComplexeState.getInitialState() will return state2. - * - * @return a state - */ - public StateModelState getInitialState(); + /** + * Return the states set + * @return a collection of states + */ + public Collection<StateModelState> getStates(); + + /** + * Return the non initial state pointed by the initial state of the state + * set. + * + * Exemple : + * myComplexeState = ( + * init1 -> state2 -> state3 -> final4 + * ) + * + * myComplexeState.getInitialState() will return state2. + * + * @return a state + */ + public StateModelState getInitialState(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelSimpleState.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelSimpleState.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelSimpleState.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -30,15 +30,15 @@ */ public interface StateModelSimpleState extends StateModelState { - /** - * State final status - * @return true il the state is final - */ - public boolean isFinal(); - - /** - * State initial status - * @return true if the state is initial - */ - public boolean isInitial(); + /** + * State final status + * @return true il the state is final + */ + public boolean isFinal(); + + /** + * State initial status + * @return true if the state is initial + */ + public boolean isInitial(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelState.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelState.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelState.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -35,21 +35,21 @@ */ public interface StateModelState { - /** - * Get the state name - * @return - */ - public String getName(); - - /** - * Return the state's transition set - * @return a list of transition - */ - public List<StateModelTransition> getTransitions(); - - /** - * State complex status - * @return true if the state is complex - */ - public boolean isComplex(); + /** + * Get the state name + * @return state name + */ + public String getName(); + + /** + * Return the state's transition set + * @return a list of transition + */ + public List<StateModelTransition> getTransitions(); + + /** + * State complex status + * @return true if the state is complex + */ + public boolean isComplex(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelStateChart.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelStateChart.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelStateChart.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -31,9 +31,9 @@ */ public interface StateModelStateChart extends StateModelComplexState { - /** - * Get package name - * @return package name - */ - public String getPackageName(); + /** + * Get package name + * @return package name + */ + public String getPackageName(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelTransition.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelTransition.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/StateModelTransition.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -30,15 +30,15 @@ */ public interface StateModelTransition { - /** - * Return the destination state - * @return a state - */ - public StateModelState getDestinationState(); - - /** - * Return the event name - * @return the event name - */ - public String getEvent(); + /** + * Return the destination state + * @return a state + */ + public StateModelState getDestinationState(); + + /** + * Return the event name + * @return the event name + */ + public String getEvent(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/DigesterStateModelRuleSet.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/DigesterStateModelRuleSet.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/DigesterStateModelRuleSet.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -46,39 +46,42 @@ */ public class DigesterStateModelRuleSet extends RuleSetBase { - protected String prefix = null; + protected String prefix = null; - public DigesterStateModelRuleSet() { - this(""); - } + public DigesterStateModelRuleSet() { + this(""); + } - public DigesterStateModelRuleSet(String prefix) { - super(); - this.prefix = prefix; - this.namespaceURI = "http://www.codelutin.org/lutingenerator/stateModel"; - } + public DigesterStateModelRuleSet(String prefix) { + super(); + this.prefix = prefix; + this.namespaceURI = "http://www.codelutin.org/lutingenerator/stateModel"; + } - public void addRuleInstances(Digester digester) { - - //digester.addObjectCreate("stateModel", StateModelImpl.class); - //digester.addFactoryCreate("stateModel", DigesterStateModelFactory.class); - // root element must be present on stask - digester.addSetProperties("stateModel"); - - digester.addObjectCreate("stateModel/stateChart", StateModelStateChartImpl.class); - digester.addSetProperties("stateModel/stateChart"); - digester.addSetNext("stateModel/stateChart", "addStateChart"); - - digester.addObjectCreate("*/state", StateModelSimpleStateImpl.class); - digester.addSetProperties("*/state"); - digester.addSetNext("*/state", "addState"); - - digester.addObjectCreate("*/complexeState", StateModelComplexeStateImpl.class); - digester.addSetProperties("*/complexeState"); - digester.addSetNext("*/complexeState", "addState"); - - digester.addObjectCreate("*/transition", StateModelTransitionImpl.class); - digester.addSetProperties("*/transition"); - digester.addSetNext("*/transition", "addTransition"); - } + public void addRuleInstances(Digester digester) { + + //digester.addObjectCreate("stateModel", StateModelImpl.class); + //digester.addFactoryCreate("stateModel", DigesterStateModelFactory.class); + // root element must be present on stask + digester.addSetProperties("stateModel"); + + digester.addObjectCreate("stateModel/stateChart", + StateModelStateChartImpl.class); + digester.addSetProperties("stateModel/stateChart"); + digester.addSetNext("stateModel/stateChart", "addStateChart"); + + digester.addObjectCreate("*/state", StateModelSimpleStateImpl.class); + digester.addSetProperties("*/state"); + digester.addSetNext("*/state", "addState"); + + digester.addObjectCreate("*/complexeState", + StateModelComplexeStateImpl.class); + digester.addSetProperties("*/complexeState"); + digester.addSetNext("*/complexeState", "addState"); + + digester + .addObjectCreate("*/transition", StateModelTransitionImpl.class); + digester.addSetProperties("*/transition"); + digester.addSetNext("*/transition", "addTransition"); + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelComplexeStateImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelComplexeStateImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelComplexeStateImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -36,114 +36,115 @@ * Last update : $Date$ * By : $Author$ */ -public class StateModelComplexeStateImpl extends StateModelStateImpl implements StateModelComplexState { +public class StateModelComplexeStateImpl extends StateModelStateImpl implements + StateModelComplexState { - /** - * States'set of this state - */ - protected Map<String,StateModelState> mapState; - - /** - * Constructor - */ - public StateModelComplexeStateImpl() { - super(); - mapState = new HashMap<String,StateModelState>(); - } - - /** - * Add a state - * @param state the state - */ - public void addState(StateModelState state) { - mapState.put(state.getName(),state); - } + /** + * States'set of this state + */ + protected Map<String, StateModelState> mapState; - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelComplexeState#getStates() - */ - public Collection<StateModelState> getStates() { - return mapState.values(); - } - - /** - * Correct association, because, the xml file migth be non ordonated - */ - void correctTransitionNameToInstance(StateModelComplexeStateImpl parent) { - - // iterator - Iterator<StateModelState> it = mapState.values().iterator(); - - while(it.hasNext()) { - StateModelState state = it.next(); - - // reboucle si l'etat est complexe - if(state instanceof StateModelComplexeStateImpl) { - ((StateModelComplexeStateImpl)state).correctTransitionNameToInstance(this); - } - else { - for(StateModelTransition tr : state.getTransitions()) { - StateModelTransitionImpl tri = (StateModelTransitionImpl)tr; - String name = tri.getStateName(); - - // l'etat apartient au cas complexe courant - if(this.getState(name) != null) { - tri.setState(this.getState(name)); - } - else { - // l'etat apartient au cas complexe parent - if(parent != null && parent.getState(name)!= null) { - tri.setState(parent.getState(name)); - } - // sinon il reste a null, tant pis - } - } - } - } - } - - /** - * Return a state ref by his name - * @param stateName a state or null if state doesnt exists - */ - StateModelState getState(String stateName) { - return mapState.get(stateName); - } + /** + * Constructor + */ + public StateModelComplexeStateImpl() { + super(); + mapState = new HashMap<String, StateModelState>(); + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.xml.StateModelStateImpl#isComplexe() - */ - @Override - public boolean isComplex() { - // TODO Auto-generated method stub - return true; - } + /** + * Add a state + * @param state the state + */ + public void addState(StateModelState state) { + mapState.put(state.getName(), state); + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelComplexeState#getInitialState() - */ - public StateModelState getInitialState() { - - StateModelState response = null; + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelComplexeState#getStates() + */ + public Collection<StateModelState> getStates() { + return mapState.values(); + } - // iterator - Iterator<StateModelState> it = mapState.values().iterator(); - - while(it.hasNext()) { - StateModelState state = it.next(); - - // if state is simple - if(!state.isComplex()) { - StateModelSimpleState simpleState = (StateModelSimpleState)state; - - if(simpleState.isInitial()) { - // get(0), normalement il n'y a qu'une transition sur un etat initial - response = simpleState.getTransitions().get(0).getDestinationState(); - } - } - } - - return response; - } - + /** + * Correct association, because, the xml file migth be non ordonated + */ + void correctTransitionNameToInstance(StateModelComplexeStateImpl parent) { + + // iterator + Iterator<StateModelState> it = mapState.values().iterator(); + + while (it.hasNext()) { + StateModelState state = it.next(); + + // reboucle si l'etat est complexe + if (state instanceof StateModelComplexeStateImpl) { + ((StateModelComplexeStateImpl) state) + .correctTransitionNameToInstance(this); + } else { + for (StateModelTransition tr : state.getTransitions()) { + StateModelTransitionImpl tri = (StateModelTransitionImpl) tr; + String name = tri.getStateName(); + + // l'etat apartient au cas complexe courant + if (this.getState(name) != null) { + tri.setState(this.getState(name)); + } else { + // l'etat apartient au cas complexe parent + if (parent != null && parent.getState(name) != null) { + tri.setState(parent.getState(name)); + } + // sinon il reste a null, tant pis + } + } + } + } + } + + /** + * Return a state ref by his name + * @param stateName a state or null if state doesnt exists + */ + StateModelState getState(String stateName) { + return mapState.get(stateName); + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.xml.StateModelStateImpl#isComplexe() + */ + @Override + public boolean isComplex() { + // TODO Auto-generated method stub + return true; + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelComplexeState#getInitialState() + */ + public StateModelState getInitialState() { + + StateModelState response = null; + + // iterator + Iterator<StateModelState> it = mapState.values().iterator(); + + while (it.hasNext()) { + StateModelState state = it.next(); + + // if state is simple + if (!state.isComplex()) { + StateModelSimpleState simpleState = (StateModelSimpleState) state; + + if (simpleState.isInitial()) { + // get(0), normalement il n'y a qu'une transition sur un etat initial + response = simpleState.getTransitions().get(0) + .getDestinationState(); + } + } + } + + return response; + } + } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -37,91 +37,92 @@ */ public class StateModelImpl implements StateModel { - /** - * List of charts composing this model - */ - protected List<StateModelStateChart> listStateCharts; - - /** - * Name of this model - */ - protected String name = null; - - /** - * Model tagged values - */ - protected Map<String,String> modelTagValues; - - /** - * Construteur - */ - public StateModelImpl() { - super(); - listStateCharts = new ArrayList<StateModelStateChart>(); - modelTagValues = new HashMap<String, String>(); - } - - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModel#getName() - */ - public String getName() { - return this.name; - } + /** + * List of charts composing this model + */ + protected List<StateModelStateChart> listStateCharts; - /** - * Set model name - * @param name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Add chart - * @param chart - */ - public void addStateChart(StateModelStateChart chart) { - - // appele apres construction du StateModelStateChartImpl - // corrige les liens entre les nom d'etat, et les instances d'etat - ((StateModelStateChartImpl)chart).correctTransitionNameToInstance(null); - - listStateCharts.add(chart); - } + /** + * Name of this model + */ + protected String name = null; - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModel#getStateCharts() - */ - public List<StateModelStateChart> getStateCharts() { - return listStateCharts; - } + /** + * Model tagged values + */ + protected Map<String, String> modelTagValues; - /** - * Add a list of stateCharts into current model - * @param charts list - */ - public void addAllStateCharts(Collection<StateModelStateChart> charts) { - listStateCharts.addAll(charts); - } + /** + * Construteur + */ + public StateModelImpl() { + super(); + listStateCharts = new ArrayList<StateModelStateChart>(); + modelTagValues = new HashMap<String, String>(); + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModel#getTagValues() - */ - public Map<String, String> getTagValues() { - return modelTagValues; - } + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModel#getName() + */ + public String getName() { + return this.name; + } - /** - * Add a tag value - * - * @param key key - * @param value value - */ - public void addTagValue(String key,String value) { - modelTagValues.put(key, value); - } + /** + * Set model name + * @param name + */ + public void setName(String name) { + this.name = name; + } /** + * Add chart + * @param chart + */ + public void addStateChart(StateModelStateChart chart) { + + // appele apres construction du StateModelStateChartImpl + // corrige les liens entre les nom d'etat, et les instances d'etat + ((StateModelStateChartImpl) chart) + .correctTransitionNameToInstance(null); + + listStateCharts.add(chart); + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModel#getStateCharts() + */ + public List<StateModelStateChart> getStateCharts() { + return listStateCharts; + } + + /** + * Add a list of stateCharts into current model + * @param charts list + */ + public void addAllStateCharts(Collection<StateModelStateChart> charts) { + listStateCharts.addAll(charts); + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModel#getTagValues() + */ + public Map<String, String> getTagValues() { + return modelTagValues; + } + + /** + * Add a tag value + * + * @param key key + * @param value value + */ + public void addTagValue(String key, String value) { + modelTagValues.put(key, value); + } + + /** * Get a tag value * * @return the value of the found tagValue, or null if the element has no Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelSimpleStateImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelSimpleStateImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelSimpleStateImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -28,48 +28,48 @@ * Last update : $Date$ * By : $Author$ */ -public class StateModelSimpleStateImpl extends StateModelStateImpl implements StateModelSimpleState { - - /** init state ? */ - protected boolean initialState; - - /** final state ? */ - protected boolean finalState; - - /** - * Constructeur - */ - public StateModelSimpleStateImpl() { - initialState = finalState = false; - } +public class StateModelSimpleStateImpl extends StateModelStateImpl implements + StateModelSimpleState { - /** - * @return the finalState - */ - public boolean isFinal() { - return finalState; - } + /** init state ? */ + protected boolean initialState; - /** - * @param finalState the finalState to set - */ - public void setFinal(boolean finalState) { - this.finalState = finalState; - } + /** final state ? */ + protected boolean finalState; - /** - * @return the initialState - */ - public boolean isInitial() { - return initialState; - } + /** + * Constructeur + */ + public StateModelSimpleStateImpl() { + initialState = finalState = false; + } - /** - * @param initialState the initialState to set - */ - public void setInitial(boolean initialState) { - this.initialState = initialState; - } - - + /** + * @return the finalState + */ + public boolean isFinal() { + return finalState; + } + + /** + * @param finalState the finalState to set + */ + public void setFinal(boolean finalState) { + this.finalState = finalState; + } + + /** + * @return the initialState + */ + public boolean isInitial() { + return initialState; + } + + /** + * @param initialState the initialState to set + */ + public void setInitial(boolean initialState) { + this.initialState = initialState; + } + } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateChartImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateChartImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateChartImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -28,26 +28,26 @@ * Last update : $Date$ * By : $Author$ */ -public class StateModelStateChartImpl extends StateModelComplexeStateImpl implements StateModelStateChart { - - /** - * Package name - */ - protected String packageName; - - - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelStateChart#getPackageName() - */ - public String getPackageName() { - return packageName; - } +public class StateModelStateChartImpl extends StateModelComplexeStateImpl + implements StateModelStateChart { - /** - * Set package name - * @param packageName - */ - public void setPackage(String packageName) { - this.packageName = packageName; - } + /** + * Package name + */ + protected String packageName; + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelStateChart#getPackageName() + */ + public String getPackageName() { + return packageName; + } + + /** + * Set package name + * @param packageName + */ + public void setPackage(String packageName) { + this.packageName = packageName; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelStateImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -43,72 +43,72 @@ */ public class StateModelStateImpl implements StateModelState { - /** - * State name - */ - protected String name; + /** + * State name + */ + protected String name; - /** - * Transition list - */ - protected List<StateModelTransition> listTransitions; - - /** - * Constructor - */ - public StateModelStateImpl() { - super(); - listTransitions = new ArrayList<StateModelTransition>(); - } + /** + * Transition list + */ + protected List<StateModelTransition> listTransitions; - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelState#getName() - */ - public String getName() { - return name; - } - - /** - * Set state name - * @param name the name - */ - public void setName(String name) { - this.name = name; - } + /** + * Constructor + */ + public StateModelStateImpl() { + super(); + listTransitions = new ArrayList<StateModelTransition>(); + } - /** - * Add transition - * @param transition a transition - */ - public void addTransition(StateModelTransition transition) { - listTransitions.add(transition); - } - - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelState#getTransitions() - */ - public List<StateModelTransition> getTransitions() { - return listTransitions; - } + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelState#getName() + */ + public String getName() { + return name; + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelState#isComplexe() - */ - public boolean isComplex() { - return false; - } + /** + * Set state name + * @param name the name + */ + public void setName(String name) { + this.name = name; + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelState#isFinal() - */ - public boolean isFinal() { - return false; - } + /** + * Add transition + * @param transition a transition + */ + public void addTransition(StateModelTransition transition) { + listTransitions.add(transition); + } - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelState#isInitial() - */ - public boolean isInitial() { - return false; - } + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelState#getTransitions() + */ + public List<StateModelTransition> getTransitions() { + return listTransitions; + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelState#isComplexe() + */ + public boolean isComplex() { + return false; + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelState#isFinal() + */ + public boolean isFinal() { + return false; + } + + /* (non-Javadoc) + * @see org.codelutin.generator.models.state.StateModelState#isInitial() + */ + public boolean isInitial() { + return false; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelTransitionImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelTransitionImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/state/xml/StateModelTransitionImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -30,75 +30,75 @@ * By : $Author$ */ public class StateModelTransitionImpl implements StateModelTransition { - - /** - * Destination state name - */ - protected String stateName = null; - - /** - * Event - */ - protected String event; - - /** - * Destination state reference - */ - protected StateModelState state = null; - /** - * Constructor - */ - public StateModelTransitionImpl() { - super(); - } - - /** - * ToState name - * @param stateName name - */ - public void setToState(String stateName) { - this.stateName = stateName; - } - - /** - * Get toState name - * @return the stateName - */ - public String getStateName() { - return stateName; - } + /** + * Destination state name + */ + protected String stateName = null; - /** - * Permet de positionner un lien sur l'instance de l'état. - * - * On ne peut pas le faire directement car le fichier xml n'est - * potentielement par ordonne, et par concequent, les etat n'ont pas encore - * ete traite. - */ - public void setState(StateModelState state) { - this.state = state; - } + /** + * Event + */ + protected String event; - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelTransition#getDestinationState() - */ - public StateModelState getDestinationState() { - return state; - } + /** + * Destination state reference + */ + protected StateModelState state = null; - /* (non-Javadoc) - * @see org.codelutin.generator.models.state.StateModelTransition#getEvent() - */ - public String getEvent() { - return event; - } - - /** - * Set transition event - * @param event event name - */ - public void setEvent(String event) { - this.event = event; - } + /** + * Constructor + */ + public StateModelTransitionImpl() { + super(); + } + + /** + * ToState name + * @param stateName name + */ + public void setToState(String stateName) { + this.stateName = stateName; + } + + /** + * Get toState name + * @return the stateName + */ + public String getStateName() { + return stateName; + } + + /** + * Permet de positionner un lien sur l'instance de l'état. + * + * On ne peut pas le faire directement car le fichier xml n'est + * potentielement par ordonne, et par concequent, les etat n'ont pas encore + * ete traite. + */ + public void setState(StateModelState state) { + this.state = state; + } + + /* + * @see org.codelutin.generator.models.state.StateModelTransition#getDestinationState() + */ + public StateModelState getDestinationState() { + return state; + } + + /* + * @see org.codelutin.generator.models.state.StateModelTransition#getEvent() + */ + public String getEvent() { + return event; + } + + /** + * Set transition event + * @param event event name + */ + public void setEvent(String event) { + this.event = event; + } } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModel.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModel.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModel.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -74,4 +74,3 @@ */ public abstract void addObject(UIModelObject object); } - Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelArguments.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelArguments.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelArguments.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelArguments.java +package org.codelutin.generator.models.ui; + +import java.util.List; + +/** + * UIModelArguments. * * Created: Jun 2, 2004 * @@ -27,13 +31,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui; - -import java.util.List; - - - public interface UIModelArguments { // UIModelArguments /** Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelChild.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelChild.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelChild.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelChild.java + + +package org.codelutin.generator.models.ui; + +/** + * UIModelChild. * * Created: Jun 1, 2004 * @@ -27,10 +31,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui; - - public interface UIModelChild { // UIModelChild /** @@ -49,6 +49,5 @@ */ public abstract UIModelConstraint getConstraint(); - } // UIModelChild Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelConstraint.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelConstraint.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelConstraint.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,10 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelConstraint.java +package org.codelutin.generator.models.ui; + +/** + * UIModelConstraint. * * Created: Jun 3, 2004 * @@ -27,9 +29,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui; - public interface UIModelConstraint { // UIModelConstraint /** @@ -47,6 +46,5 @@ */ public abstract String getStringValue(); - } // UIModelConstraint Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelEvent.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelEvent.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelEvent.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,10 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelEvent.java +package org.codelutin.generator.models.ui; + +/** +* UIModelEvent. * * Created: Jun 1, 2004 * @@ -27,9 +29,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui; - public interface UIModelEvent { // UIModelEvent /** @@ -62,6 +61,5 @@ */ public abstract String getArgument(); - } // UIModelEvent Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelObject.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelObject.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelObject.java 2009-02-19 09:36:12 UTC (rev 451) @@ -100,7 +100,6 @@ */ public abstract Collection<UIModelChild> getChildren(); - /** * Returns the uimodel of this object. * @see UIModel Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelProperty.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelProperty.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/UIModelProperty.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,98 +14,97 @@ * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + package org.codelutin.generator.models.ui; - /** -* UIModelProperty.java -* -* Created: Jun 2, 2004 -* -* @author pineau -* @version $Revision$ -* -* Last update : $Date$ -* by : $Author$ -*/ + * UIModelProperty.java + * + * Created: Jun 2, 2004 + * + * @author pineau + * @version $Revision$ + * + * Last update : $Date$ + * by : $Author$ + */ public interface UIModelProperty { /** - * Returns the name of this property. - * - * @return the name of this property. - */ + * Returns the name of this property. + * + * @return the name of this property. + */ public abstract String getName(); /** - * Returns the value of this property. - * the value returned can be an instance of UIModelObject - * or String or Integer or Boolean or Character - * @return the value of this property. - */ + * Returns the value of this property. + * the value returned can be an instance of UIModelObject + * or String or Integer or Boolean or Character + * @return the value of this property. + */ public abstract Object getValue(); /** - * Returns the index of this property if it's indexed property - * - * @return the index of this property. - */ + * Returns the index of this property if it's indexed property + * + * @return the index of this property. + */ public abstract int getIndex() throws Exception; public abstract boolean isIndexed(); /** - * Returns the value of this property if the type is int - * @return the value of this property. - */ + * Returns the value of this property if the type is int + * @return the value of this property. + */ public abstract int getIntValue(); /** - * Returns the value of this property if the type is boolean - * @return the value of this property. - */ + * Returns the value of this property if the type is boolean + * @return the value of this property. + */ public abstract boolean getBooleanValue(); /** - * Returns the value of this property if the type is char - * @return the value of this property. - */ + * Returns the value of this property if the type is char + * @return the value of this property. + */ public abstract char getCharValue(); /** - * Returns the value of this property if the type is String - * @return the value of this property. - */ + * Returns the value of this property if the type is String + * @return the value of this property. + */ public abstract String getStringValue(); - -/** - * Returns the value of this property if the type is byte - * @return the value of this property. - */ + /** + * Returns the value of this property if the type is byte + * @return the value of this property. + */ public abstract byte getByteValue(); /** - * Returns the value of this property if the type is Short - * @return the value of this property. - */ + * Returns the value of this property if the type is Short + * @return the value of this property. + */ public abstract short getShortValue(); /** - * Returns the value of this property if the type is long - * @return the value of this property. - */ + * Returns the value of this property if the type is long + * @return the value of this property. + */ public abstract long getLongValue(); /** - * Returns the value of this property if the type is float - * @return the value of this property. - */ + * Returns the value of this property if the type is float + * @return the value of this property. + */ public abstract float getFloatValue(); /** - * Returns the value of this property if the type is double - * @return the value of this property. - */ + * Returns the value of this property if the type is double + * @return the value of this property. + */ public abstract double getDoubleValue(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelArgumentsImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelArgumentsImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelArgumentsImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,16 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelArgumentsImpl.java +package org.codelutin.generator.models.ui.impl; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.codelutin.generator.models.ui.UIModelArguments; + +/** +* UIModelArgumentsImpl. * * Created: Aug 9, 2004 * @@ -27,23 +35,15 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelArgumentsImpl implements UIModelArguments { // UIModelArgumentsImpl -package org.codelutin.generator.models.ui.impl; + protected List<Object> arguments = new ArrayList<Object>(); -import org.codelutin.generator.models.ui.UIModelArguments; -import java.util.ArrayList; -import java.util.Iterator; - - -public class UIModelArgumentsImpl implements UIModelArguments{ // UIModelArgumentsImpl - - protected ArrayList arguments = new ArrayList(); - /** * Changes the arguments list. * @param arguments - a new arguments list. */ - public void setArguments(ArrayList arguments) { + public void setArguments(List<Object> arguments) { this.arguments = arguments; } @@ -51,7 +51,7 @@ * Returns a arguments list. * @return a arguments list. */ - public ArrayList getArguments() { + public List<Object> getArguments() { return arguments; } @@ -59,17 +59,17 @@ * Add an argument to the arguments list * @param arg - object argument */ - public void addArgument(Object arg){ + public void addArgument(Object arg) { arguments.add(arg); } /** * @return a string representation of the object */ - public String toString(){ - String argString = "["; - for(Iterator i = arguments.iterator(); i.hasNext();){ - Object arg = i.next(); + public String toString() { + String argString = "["; + for (Iterator<Object> i = arguments.iterator(); i.hasNext();) { + Object arg = i.next(); argString = argString + " " + arg.toString(); } argString = argString + "]"; Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelChildImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelChildImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelChildImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,9 +15,17 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelChildImpl.java -* + + +package org.codelutin.generator.models.ui.impl; + +import org.codelutin.generator.models.ui.UIModelChild; +import org.codelutin.generator.models.ui.UIModelObject; +import org.codelutin.generator.models.ui.UIModelConstraint; + +/** + * UIModelChildImpl. + * * Created: Aug 9, 2004 * * @author Benjamin Poussin <poussin@codelutin.com> @@ -27,15 +35,8 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelChildImpl implements UIModelChild { // UIModelChildImpl -package org.codelutin.generator.models.ui.impl; - -import org.codelutin.generator.models.ui.UIModelChild; -import org.codelutin.generator.models.ui.UIModelObject; -import org.codelutin.generator.models.ui.UIModelConstraint; - -public class UIModelChildImpl implements UIModelChild{ // UIModelChildImpl - protected UIModelObject object = null; protected UIModelConstraint constraint = null; @@ -82,11 +83,12 @@ /** * @return a string representation of the object */ - public String toString(){ - String childString = "["; + public String toString() { + String childString = "["; childString = childString + " child : " + object.toString() + " \n"; - if(constraint!=null) - childString = childString + "constraint : " + constraint.toString() + " \n"; + if (constraint != null) + childString = childString + "constraint : " + constraint.toString() + + " \n"; childString = childString + "]"; return childString; } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelConstraintImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelConstraintImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelConstraintImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,14 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelConstraintImpl.java + + +package org.codelutin.generator.models.ui.impl; + +import org.codelutin.generator.models.ui.UIModelConstraint; + +/** +* UIModelConstraintImpl. * * Created: Aug 9, 2004 * @@ -27,13 +33,8 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelConstraintImpl implements UIModelConstraint { // UIModelConstraintImpl -package org.codelutin.generator.models.ui.impl; - -import org.codelutin.generator.models.ui.UIModelConstraint; - -public class UIModelConstraintImpl implements UIModelConstraint{ // UIModelConstraintImpl - protected Object value = null; /** @@ -71,12 +72,12 @@ /** * @return a string representation of the object */ - public String toString(){ - if (value != null){ - return value.toString(); - }else{ - return null; + public String toString() { + String toString = null; + if (value != null) { + toString = value.toString(); } + return toString; } } // UIModelConstraintImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelEventImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelEventImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelEventImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,14 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelEventImpl.java + + +package org.codelutin.generator.models.ui.impl; + +import org.codelutin.generator.models.ui.UIModelEvent; + +/** +* UIModelEventImpl. * * Created: Aug 9, 2004 * @@ -27,13 +33,8 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelEventImpl implements UIModelEvent { // UIModelEventImpl -package org.codelutin.generator.models.ui.impl; - -import org.codelutin.generator.models.ui.UIModelEvent; - -public class UIModelEventImpl implements UIModelEvent{ // UIModelEventImpl - protected String addMethod = null; protected String source = null; protected String action = null; @@ -120,11 +121,11 @@ return argument; } - /** + /** * @return a string representation of the object */ - public String toString(){ - String eventString = "[ addMethod : " + addMethod + ", "; + public String toString() { + String eventString = "[ addMethod : " + addMethod + ", "; eventString = eventString + "source " + source + ", "; eventString = eventString + "action " + action + ", "; eventString = eventString + "handler " + handler + ", "; Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,19 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelImpl.java + + +package org.codelutin.generator.models.ui.impl; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.codelutin.generator.models.ui.UIModel; +import org.codelutin.generator.models.ui.UIModelObject; + +/** +* UIModelImpl. * * Created: Aug 6, 2004 * @@ -27,23 +38,16 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelImpl implements UIModel { // UIModelImpl -package org.codelutin.generator.models.ui.impl; - -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; -import java.util.Collection; -import java.util.HashMap; - -public class UIModelImpl implements UIModel{ // UIModelImpl - protected String version = null; protected String packageName = null; protected UIModelObject root = null; - /** Contient tous les objets du model. - * key: nom de l'objet; value: l'objet - */ - protected HashMap objects = new HashMap(); + /** + * Contient tous les objets du model. + * key: nom de l'objet; value: l'objet + */ + protected Map<String, UIModelObject> objects = new HashMap<String, UIModelObject>(); /** * Changes the version of this model @@ -104,7 +108,7 @@ * * @return a Collection containing all UIModelObjects for this ui model. */ - public Collection getObjects() { + public Collection<UIModelObject> getObjects() { return objects.values(); } @@ -113,8 +117,8 @@ * @see UIModelObject * */ - public void addObject(UIModelObject object){ - if(object.getName() != null){ + public void addObject(UIModelObject object) { + if (object.getName() != null) { objects.put(object.getName(), object); } } @@ -122,8 +126,8 @@ /** * @return a string representation of the object */ - public String toString(){ - String modelString = "version : " + version + ", "; + public String toString() { + String modelString = "version : " + version + ", "; modelString = modelString + "package : " + packageName + ", "; modelString = modelString + "root : " + root.toString(); return modelString; Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelObjectImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelObjectImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelObjectImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,24 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelObjectImpl.java -* -* Created: Aug 9, 2004 -* -* @author Benjamin Poussin <poussin@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - package org.codelutin.generator.models.ui.impl; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.List; import org.codelutin.generator.models.ui.UIModel; import org.codelutin.generator.models.ui.UIModelArguments; @@ -42,7 +30,19 @@ import org.codelutin.generator.models.ui.UIModelObject; import org.codelutin.generator.models.ui.UIModelProperty; -public class UIModelObjectImpl implements UIModelObject{ // UIModelObjectImpl +/** +* UIModelObjectImpl. +* +* Created: Aug 9, 2004 +* +* @author Benjamin Poussin <poussin@codelutin.com> +* Copyright Code Lutin +* @version $Revision$ +* +* Mise a jour: $Date$ +* par : $Author$ +*/ +public class UIModelObjectImpl implements UIModelObject { // UIModelObjectImpl // model et parent semblent inutiles dans cette implantation mais obligatoire pour l'heritage protected UIModel model = null; @@ -53,9 +53,9 @@ protected UIModelConstraint constraint = null; protected UIModelArguments arguments = null; - protected ArrayList properties = new ArrayList(); - protected ArrayList events = new ArrayList(); - protected ArrayList children = new ArrayList(); + protected List<UIModelProperty> properties = new ArrayList<UIModelProperty>(); + protected List<UIModelEvent> events = new ArrayList<UIModelEvent>(); + protected List<UIModelChild> children = new ArrayList<UIModelChild>(); /** * Changes the model of this object. @@ -81,7 +81,7 @@ * Returns null if this object is root * @param parent - the parent of this object. */ - public void setParent(UIModelObject parent){ + public void setParent(UIModelObject parent) { this.parent = parent; } @@ -111,7 +111,7 @@ * * @param properties - a Collection containing all UIModelProperty for this object. */ - public void setProperties(ArrayList properties) { + public void setProperties(List<UIModelProperty> properties) { this.properties = properties; } @@ -121,7 +121,7 @@ * * @param events - a Collection containing all UIModelEvents for this object. */ - public void setEvents(ArrayList events) { + public void setEvents(List<UIModelEvent> events) { this.events = events; } @@ -131,7 +131,7 @@ * * @param children - a Collection containing all UIModelChildren for this object. */ - public void setChildren(ArrayList children) { + public void setChildren(List<UIModelChild> children) { this.children = children; } @@ -160,10 +160,11 @@ * @return the name of this object. */ public String getName() { - if (name == null){ + if (name == null) { UIModelProperty propName = getProperty("name"); - if(propName!=null) + if (propName != null) { name = propName.getStringValue(); + } } return name; } @@ -194,7 +195,7 @@ * * @return a Collection containing all arguments for this object. */ - public Collection getArguments() { + public Collection<Object> getArguments() { return arguments.getArguments(); } @@ -204,7 +205,7 @@ * * @return a Collection containing all UIModelProperty for this object. */ - public Collection getProperties() { + public Collection<UIModelProperty> getProperties() { return properties; } @@ -214,7 +215,7 @@ * * @return a Collection containing all UIModelEvents for this object. */ - public Collection getEvents() { + public Collection<UIModelEvent> getEvents() { return events; } @@ -224,32 +225,28 @@ * * @return a Collection containing all UIModelChildren for this object. */ - public Collection getChildren() { + public Collection<UIModelChild> getChildren() { return children; } /** * Returns the property defined on this object. * @see UIModelProperty - * @param String the name of the property which must be returned + * @param propName the name of the property which must be returned * @return a UIModelProperty for this object with the . */ - public UIModelProperty getProperty(String propName){ - Iterator i = properties.iterator(); + public UIModelProperty getProperty(String propName) { + Iterator<UIModelProperty> i = properties.iterator(); UIModelPropertyImpl prop = null; boolean find = false; - while (i.hasNext() && find==false){ - prop = (UIModelPropertyImpl)i.next(); - if(propName.equals(prop.getName())){ - find=true; + while (i.hasNext() && find == false) { + prop = (UIModelPropertyImpl) i.next(); + if (propName.equals(prop.getName())) { + find = true; } } - if(find==true){ - return prop; - }else{ - return null; - //throw new GeneratorException("L'objet "+ type +" n'a pas de propriete "+ propName); - } + + return prop; } /** @@ -257,7 +254,7 @@ * @see UIModelProperty * @param prop - a new UIModelProperty */ - public void addProperty(UIModelProperty prop){ + public void addProperty(UIModelProperty prop) { properties.add(prop); } @@ -266,7 +263,7 @@ * @see UIModelEvent * @param event - a new UIModelEvent */ - public void addEvent(UIModelEvent event){ + public void addEvent(UIModelEvent event) { events.add(event); } @@ -275,34 +272,33 @@ * @see UIModelChild * @param child - a new UIModelChild */ - public void addChild(UIModelChild child){ + public void addChild(UIModelChild child) { children.add(child); } - /** * @return a string representation of the object */ - public String toString(){ - String objectString = "\n[ type : " + type + ", "; - objectString = objectString + " name : " + getName() + ", "; - objectString = objectString + " arguments : " + arguments.toString(); + public String toString() { + String objectString = "\n[ type : " + type + ", "; + objectString = objectString + " name : " + getName() + ", "; + objectString = objectString + " arguments : " + arguments.toString(); - objectString = objectString + " properties : "; - for(Iterator i = properties.iterator(); i.hasNext();){ - Object prop = i.next(); + objectString = objectString + " properties : "; + for (Iterator<UIModelProperty> i = properties.iterator(); i.hasNext();) { + Object prop = i.next(); objectString = objectString + " " + prop.toString(); } - objectString = objectString + " events : "; - for(Iterator i = events.iterator(); i.hasNext();){ - Object event = i.next(); + objectString = objectString + " events : "; + for (Iterator<UIModelEvent> i = events.iterator(); i.hasNext();) { + Object event = i.next(); objectString = objectString + " " + event.toString(); } - objectString = objectString + " children : "; - for(Iterator i = children.iterator(); i.hasNext();){ - Object child = i.next(); + objectString = objectString + " children : "; + for (Iterator<UIModelChild> i = children.iterator(); i.hasNext();) { + Object child = i.next(); objectString = objectString + " " + child.toString(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelPropertyImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelPropertyImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/impl/UIModelPropertyImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,15 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* UIModelPropertyImpl.java + + +package org.codelutin.generator.models.ui.impl; + +import org.codelutin.generator.models.ui.UIModelProperty; +import org.codelutin.generator.GeneratorException; + +/** +* UIModelPropertyImpl. * * Created: Aug 9, 2004 * @@ -27,14 +34,8 @@ * Mise a jour: $Date$ * par : $Author$ */ +public class UIModelPropertyImpl implements UIModelProperty { // UIModelPropertyImpl -package org.codelutin.generator.models.ui.impl; - -import org.codelutin.generator.models.ui.UIModelProperty; -import org.codelutin.generator.GeneratorException; - -public class UIModelPropertyImpl implements UIModelProperty{ // UIModelPropertyImpl - protected String name; protected UIModelArgumentsImpl arguments; @@ -63,8 +64,8 @@ * @return the value of this property. */ public Object getValue() { - int i = arguments.getArguments().size()-1; - if(i>=0){ + int i = arguments.getArguments().size() - 1; + if (i >= 0) { return arguments.getArguments().get(i); } return null; @@ -75,11 +76,12 @@ * * @return the index of this property. */ - public int getIndex() throws Exception{ + public int getIndex() throws Exception { if (isIndexed()) { - return ((Integer)arguments.getArguments().get(0)).intValue(); + return ((Integer) arguments.getArguments().get(0)).intValue(); } - throw new Exception("Impossible d'obtenir l'index d'une propriete non indexee"); + throw new Exception( + "Impossible d'obtenir l'index d'une propriete non indexee"); } /** @@ -96,10 +98,11 @@ */ public int getIntValue() { Object object = getValue(); - if(object!=null){ - return ((Integer)object).intValue(); + if (object != null) { + return ((Integer) object).intValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -108,10 +111,11 @@ */ public boolean getBooleanValue() { Object object = getValue(); - if(object!=null){ - return ((Boolean)object).booleanValue(); + if (object != null) { + return ((Boolean) object).booleanValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -120,10 +124,11 @@ */ public char getCharValue() { Object object = getValue(); - if(object!=null){ - return ((Character)object).charValue(); + if (object != null) { + return ((Character) object).charValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -132,10 +137,11 @@ */ public String getStringValue() { Object object = getValue(); - if(object !=null){ + if (object != null) { return getValue().toString(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -144,10 +150,11 @@ */ public byte getByteValue() { Object object = getValue(); - if(object!=null){ - return ((Byte)object).byteValue(); + if (object != null) { + return ((Byte) object).byteValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -156,10 +163,11 @@ */ public long getLongValue() { Object object = getValue(); - if(object!=null){ - return ((Long)object).longValue(); + if (object != null) { + return ((Long) object).longValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -168,10 +176,11 @@ */ public short getShortValue() { Object object = getValue(); - if(object!=null){ - return ((Short)object).shortValue(); + if (object != null) { + return ((Short) object).shortValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -180,10 +189,11 @@ */ public float getFloatValue() { Object object = getValue(); - if(object!=null){ - return ((Float)object).floatValue(); + if (object != null) { + return ((Float) object).floatValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -192,10 +202,11 @@ */ public double getDoubleValue() { Object object = getValue(); - if(object!=null){ - return ((Double)object).doubleValue(); + if (object != null) { + return ((Double) object).doubleValue(); } - throw new GeneratorException("La propriete "+ name +" n'a pas de valeur" ); + throw new GeneratorException("La propriete " + name + + " n'a pas de valeur"); } /** @@ -219,7 +230,7 @@ /** * @return a string representation of the object */ - public String toString(){ + public String toString() { return getValue().toString(); } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/javaxml/JavaXMLParser.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,19 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * -* JavaXMLParser.java -* -* Created: Aug 6, 2004 -* -* @author Benjamin Poussin <poussin@codelutin.com> -* Copyright Code Lutin -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - package org.codelutin.generator.models.ui.javaxml; import java.io.File; @@ -53,7 +40,16 @@ import org.dom4j.io.SAXReader; /** -* Parser of a xml file issue of XMLEncoder +* Parser of a xml file issue of XMLEncoder. +* +* Created: Aug 6, 2004 +* +* @author Benjamin Poussin <poussin@codelutin.com> +* Copyright Code Lutin +* @version $Revision$ +* +* Mise a jour: $Date$ +* par : $Author$ */ public class JavaXMLParser { // JavaXMLParser protected Element rootElement; @@ -64,7 +60,8 @@ * @param file - xml file issue of XMLEncoder * @return UIModelImpl */ - public UIModelImpl parse(File file) throws DocumentException, MalformedURLException { + public UIModelImpl parse(File file) throws DocumentException, + MalformedURLException { return parse(file.toURI().toURL()); } @@ -73,7 +70,8 @@ * @param url - url of xml file issue of XMLEncoder * @return UIModelImpl */ - public UIModelImpl parse(URL url) throws DocumentException, MalformedURLException { + public UIModelImpl parse(URL url) throws DocumentException, + MalformedURLException { SAXReader reader = new SAXReader(); Document document = reader.read(url); @@ -90,14 +88,14 @@ // org.codelutin.chorem.entities.ui int indexSlash = urlName.lastIndexOf("/"); - if(indexSlash!=-1){ + if (indexSlash != -1) { indexSlash++; - String name = urlName.substring(indexSlash, - urlName.lastIndexOf(".javaxml")); + String name = urlName.substring(indexSlash, urlName + .lastIndexOf(".javaxml")); int indexPoint = name.lastIndexOf("."); - if(indexPoint!=-1){ - name = name.substring(0,indexPoint); + if (indexPoint != -1) { + name = name.substring(0, indexPoint); } result.setPackageName(name); } @@ -109,14 +107,15 @@ * @param current - element root of model * @return UIModelImpl */ - protected UIModelImpl parseModel(Element current){ + protected UIModelImpl parseModel(Element current) { uimodel = new UIModelImpl(); String version = current.attributeValue("version"); uimodel.setVersion(version); // selectionne l'unique object racine de l'arbre - Element rootElement = (Element)current.selectSingleNode("/java/object"); + Element rootElement = (Element) current + .selectSingleNode("/java/object"); UIModelObject root = parseObject(rootElement, null); uimodel.setRoot(root); @@ -129,7 +128,8 @@ * @param current - element to parse * @return UIModelObjectImpl */ - protected UIModelObjectImpl parseObject(Element current, UIModelObject parent){ + protected UIModelObjectImpl parseObject(Element current, + UIModelObject parent) { UIModelObjectImpl result = new UIModelObjectImpl(); @@ -144,14 +144,15 @@ result.setArguments(arguments); // liste des enfants de l'objet (collection de UIModelChild) - ArrayList children =null; + ArrayList children = null; // Cas ou l'objet est une instance de RootPaneContainer, les enfants se trouvent dans le contentPane - Element contentPaneElem = (Element)current.selectSingleNode("void[@property=\"contentPane\"]"); + Element contentPaneElem = (Element) current + .selectSingleNode("void[@property=\"contentPane\"]"); - if (contentPaneElem!=null){ + if (contentPaneElem != null) { children = parseChildren(contentPaneElem, result); - }else{ + } else { children = parseChildren(current, result); } @@ -159,13 +160,14 @@ // liste des properties de l'objet courant, on est sur que le tag des properties est de la forme <void property="propertyName">, ce tag est un enfant de l'objet courant List propertiesElement = current.selectNodes("void[@property]"); - if (contentPaneElem!=null){ - Element layoutElement = (Element)contentPaneElem.selectSingleNode(" void[@property=\"layout\"]"); + if (contentPaneElem != null) { + Element layoutElement = (Element) contentPaneElem + .selectSingleNode(" void[@property=\"layout\"]"); propertiesElement.add(layoutElement); } - for(Iterator i = propertiesElement.iterator(); i.hasNext();){ - Element propElement = (Element)i.next(); + for (Iterator i = propertiesElement.iterator(); i.hasNext();) { + Element propElement = (Element) i.next(); System.out.println(" propElement " + propElement); UIModelProperty prop = parseProperty(propElement, result); result.addProperty(prop); @@ -176,10 +178,11 @@ addMethod sera utilisee pour decrire l'event sous ce tag un objet de type EventHandler avec sa methode create dessous on trouve l'ensemble des proprietes de l'event (source, action ...)*/ - List eventsElement = current.selectNodes("void/object[@class=\"java.beans.EventHandler\" and @method=\"create\"]"); + List eventsElement = current + .selectNodes("void/object[@class=\"java.beans.EventHandler\" and @method=\"create\"]"); - for(Iterator i = eventsElement.iterator(); i.hasNext();){ - Element eventProp = (Element)i.next(); + for (Iterator i = eventsElement.iterator(); i.hasNext();) { + Element eventProp = (Element) i.next(); UIModelEvent event = parseEvent(eventProp); result.addEvent(event); } @@ -195,35 +198,36 @@ * @param current - element to parse * @return UIModelArgumentsImpl */ - protected UIModelArgumentsImpl parseArguments(Element current, UIModelObject parent){ + protected UIModelArgumentsImpl parseArguments(Element current, + UIModelObject parent) { UIModelArgumentsImpl result = new UIModelArgumentsImpl(); //liste des arguments d'un propriete ou d'un objet. Ils ne sont pas des entites void mais int, double, ... (types primitfs), String List listPrimitivElement = current.selectNodes("*[not(self::void)]"); - for(Iterator i = listPrimitivElement.iterator(); i.hasNext();){ - Element element = (Element)i.next(); - String type = element.getQualifiedName(); + for (Iterator i = listPrimitivElement.iterator(); i.hasNext();) { + Element element = (Element) i.next(); + String type = element.getQualifiedName(); // pour eviter le cas ou l'element est de type <null/> - if (!type.equals("null")){ + if (!type.equals("null")) { String valueString = element.getText(); Object value = valueString; - if(type.equals("int")){ + if (type.equals("int")) { value = new Integer(valueString); - }else if (type.equals("float")){ + } else if (type.equals("float")) { value = new Float(valueString); - }else if (type.equals("double")){ + } else if (type.equals("double")) { value = new Double(valueString); - }else if (type.equals("long")){ + } else if (type.equals("long")) { value = new Long(valueString); - }else if (type.equals("short")){ + } else if (type.equals("short")) { value = new Short(valueString); - }else if (type.equals("boolean")){ + } else if (type.equals("boolean")) { value = new Boolean(valueString); - }else if (type.equals("byte")){ + } else if (type.equals("byte")) { value = new Byte(valueString); - }else if (type.equals("object")){ + } else if (type.equals("object")) { value = parseObject(element, parent); } result.addArgument(value); @@ -239,7 +243,8 @@ * @param current - element to parse * @return UIModelPropertyImpl */ - protected UIModelPropertyImpl parseProperty(Element current, UIModelObject parent){ + protected UIModelPropertyImpl parseProperty(Element current, + UIModelObject parent) { // la propriete possede un nom definit par la valeur de l'attribut property UIModelPropertyImpl result = new UIModelPropertyImpl(); @@ -254,14 +259,13 @@ return result; } - /** * Returns UIModelEventImpl equivalent to current element * A event has a addMethod, source, handler, argument and an action * @param current - element to parse * @return UIModelEventImpl */ - protected UIModelEventImpl parseEvent(Element current){ + protected UIModelEventImpl parseEvent(Element current) { UIModelEventImpl result = new UIModelEventImpl(); /* Modele d'un event @@ -276,39 +280,42 @@ </void> */ // parfois il n'y aura pas d'arguments et il est possible que handler soit vide ! - // recuperation de la valeur de addMethod dans le tag parent void de l'objet courant avec l'attribut method - Element addMethodElement = (Element)current.selectSingleNode("parent::void[@method]"); + Element addMethodElement = (Element) current + .selectSingleNode("parent::void[@method]"); result.setAddMethod(addMethodElement.attributeValue("method")); // la source est definie pour le tag class place juste en dessous de l'objet courant - Element sourceElement = (Element)current.selectSingleNode("class"); - if(sourceElement!=null){ + Element sourceElement = (Element) current.selectSingleNode("class"); + if (sourceElement != null) { result.setSource(sourceElement.getText()); } // le handler sera le troisieme element en tout - Element handlerElement = (Element)current.selectSingleNode("*[position()=3]"); - if(handlerElement!=null){ + Element handlerElement = (Element) current + .selectSingleNode("*[position()=3]"); + if (handlerElement != null) { result.setHandler(handlerElement.getText()); } // on ne connait pas le type d'arguments (null ou string) d'ou * mais on sait que sa position sera toujours 4 ! - Element argumentsElement = (Element)current.selectSingleNode("*[position()=4]"); - if(argumentsElement!=null){ + Element argumentsElement = (Element) current + .selectSingleNode("*[position()=4]"); + if (argumentsElement != null) { result.setArgument(argumentsElement.getText()); } // l'action est toujours de type string mais on ne peut pas vraiment determine sa position a cause de arguments : position= 4 si arguments est de type string 3 sinon mais on sait que action sera toujours en dernier position - Element actionElement = (Element)current.selectSingleNode("*[position()=last()]"); - if(actionElement!=null){ + Element actionElement = (Element) current + .selectSingleNode("*[position()=last()]"); + if (actionElement != null) { result.setAction(actionElement.getText()); } return result; } - protected ArrayList parseChildren(Element current, UIModelObject parent){ + protected ArrayList parseChildren(Element current, UIModelObject parent) { ArrayList result = new ArrayList(); //liste des enfants de l'objet @@ -316,18 +323,21 @@ // l'objet est identifie par un id //un enfant est un objet qui a ete ajoute par la methode add au container // sous l'objet courant, on cherche la methode add du tag void puis on recupere l'objet se trouvant sous ce tag. L'enfant est alors identifie par un id ou idref (si l'objet a deja ete defini) - List childrenElement = current.selectNodes("void[@method=\"add\"]/object"); + List childrenElement = current + .selectNodes("void[@method=\"add\"]/object"); - if (!childrenElement.isEmpty()){ + if (!childrenElement.isEmpty()) { - for(Iterator i = childrenElement.iterator(); i.hasNext();){ + for (Iterator i = childrenElement.iterator(); i.hasNext();) { - Element childElem = (Element)i.next(); + Element childElem = (Element) i.next(); String id = childElem.attributeValue("idref"); // selectionner l'enfant qui possede le meme id que l'idref // cet enfant se trouve dans les descendants du noeud root - if(id != null){ - childElem = (Element)rootElement.selectSingleNode("descendant::object[@id=\""+id+"\"]"); + if (id != null) { + childElem = (Element) rootElement + .selectSingleNode("descendant::object[@id=\"" + id + + "\"]"); } id = childElem.attributeValue("id"); @@ -338,16 +348,26 @@ // sous cet objet layout, se trouve la methode addLayoutComponent // avec object ajoute au container avec un idref qui doit etre identique a l'un des enfants vus precedemment (definis dans la methode add) (cet objet est toujours en premiere position // en deuxieme position se trouve la constrainte du premier object (string ou object) - Element constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/object[(@class)]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); + Element constraintElem = (Element) current + .selectSingleNode("descendant::void[@property=\"layout\"]/object[(@class)]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\"" + + id + + "\") or (@id=\"" + + id + + "\")]/../*[2][(self::object) or (self::string)]"); // ATTENTION : dans l'expression XPath on trouve deux conditions car dans le cas des panels generes l'argument de la proptriete layout n'apparait pas, nous n'avons pas du determine l'origine de l'erreur - if(constraintElem==null){ - constraintElem = (Element)current.selectSingleNode("descendant::void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\""+id+"\") or (@id=\""+id+"\")]/../*[2][(self::object) or (self::string)]"); + if (constraintElem == null) { + constraintElem = (Element) current + .selectSingleNode("descendant::void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]/object[1][(@idref=\"" + + id + + "\") or (@id=\"" + + id + + "\")]/../*[2][(self::object) or (self::string)]"); } UIModelConstraintImpl constraint = null; - if(constraintElem != null){ + if (constraintElem != null) { constraint = parseConstraint(constraintElem, parent); } @@ -361,21 +381,24 @@ result.add(ch); } - }else{ + } else { - childrenElement = current.selectNodes("void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]"); + childrenElement = current + .selectNodes("void[@property=\"layout\"]/void[@method=\"addLayoutComponent\"]"); - for(Iterator i = childrenElement.iterator(); i.hasNext();){ + for (Iterator i = childrenElement.iterator(); i.hasNext();) { - Element objElem = (Element)i.next(); - Element childElem = (Element)objElem.selectSingleNode("object[1]"); + Element objElem = (Element) i.next(); + Element childElem = (Element) objElem + .selectSingleNode("object[1]"); UIModelObjectImpl child = parseObject(childElem, parent); - Element constraintElem = (Element)current.selectSingleNode("*[2][(self::object) or (self::string)]"); + Element constraintElem = (Element) current + .selectSingleNode("*[2][(self::object) or (self::string)]"); UIModelConstraintImpl constraint = null; - if(constraintElem != null){ + if (constraintElem != null) { constraint = parseConstraint(constraintElem, parent); } @@ -394,22 +417,22 @@ return result; } - /** * Returns UIModelConstraintImpl ewuivalent to current element * This is ths constraint of an object. It has an object value. * @param current - element to parse * @return UIModelConstraintImpl */ - protected UIModelConstraintImpl parseConstraint(Element current, UIModelObject parent){ + protected UIModelConstraintImpl parseConstraint(Element current, + UIModelObject parent) { UIModelConstraintImpl result = new UIModelConstraintImpl(); Object value = null; - if (current.matches("self::object")){ + if (current.matches("self::object")) { // la valeur de la constrainte est un objet value = parseObject(current, parent); - }else if (current.matches("self::string")){ + } else if (current.matches("self::string")) { // la valeur de la constrainte est une string value = current.getData(); Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/DigesterUIModelRuleSet.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -43,28 +43,28 @@ */ public class DigesterUIModelRuleSet extends RuleSetBase { - protected String prefix = null; + protected String prefix = null; - public DigesterUIModelRuleSet() { - this(""); - } + public DigesterUIModelRuleSet() { + this(""); + } - public DigesterUIModelRuleSet(String prefix) { - super(); - this.prefix = prefix; - this.namespaceURI = "http://www.codelutin.org/lutingenerator/uiModel"; - } - - /* - * (non-Javadoc) - * - * @see org.apache.commons.digester.RuleSetBase#addRuleInstances(org.apache.commons.digester.Digester) - */ - @Override - public void addRuleInstances(Digester d) { + public DigesterUIModelRuleSet(String prefix) { + super(); + this.prefix = prefix; + this.namespaceURI = "http://www.codelutin.org/lutingenerator/uiModel"; + } - // FIXME pas d'exemple pour pouvoir definir les regles + /* + * (non-Javadoc) + * + * @see org.apache.commons.digester.RuleSetBase#addRuleInstances(org.apache.commons.digester.Digester) + */ + @Override + public void addRuleInstances(Digester d) { - } + // FIXME pas d'exemple pour pouvoir definir les regles + } + } Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelArgumentsImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,18 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelArgumentsImpl.java + + +package org.codelutin.generator.models.ui.xml; + +import java.util.ArrayList; +import java.util.List; + +import org.codelutin.generator.models.ui.UIModelArguments; +import org.codelutin.generator.models.ui.UIModelObject; + +/** + * UIModelArgumentsImpl. * * Created: Jun 4, 2004 * @@ -27,82 +37,73 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import java.util.ArrayList; -import java.util.List; - -import org.codelutin.generator.models.ui.UIModelArguments; -import org.codelutin.generator.models.ui.UIModelObject; - public class UIModelArgumentsImpl implements UIModelArguments { // UIModelArgumentsImpl - // protected UIModel model = null; - // protected UIModelObject parent = null; - // Liste des arguments de differents types (object, int, bool, String, ...) - protected List<Object> arguments = new ArrayList<Object>(); + // protected UIModel model = null; + // protected UIModelObject parent = null; + // Liste des arguments de differents types (object, int, bool, String, ...) + protected List<Object> arguments = new ArrayList<Object>(); - public UIModelArgumentsImpl() { - super(); - } + public UIModelArgumentsImpl() { + super(); + } - public void addObject(UIModelObject value) { - // if(value == null) { - // return new UIModelObjectImpl(model, parent); - // } + public void addObject(UIModelObject value) { + // if(value == null) { + // return new UIModelObjectImpl(model, parent); + // } - arguments.add(value); - // return value; - } + arguments.add(value); + // return value; + } - public void addInt(Integer value) { - arguments.add(value); - } + public void addInt(Integer value) { + arguments.add(value); + } - public void addBoolean(Boolean value) { - arguments.add(value); - } + public void addBoolean(Boolean value) { + arguments.add(value); + } - public void addChar(Character value) { - arguments.add(value); - } + public void addChar(Character value) { + arguments.add(value); + } - public void addString(String value) { - arguments.add(value); - } + public void addString(String value) { + arguments.add(value); + } - public void addLong(Long value) { - arguments.add(value); - } + public void addLong(Long value) { + arguments.add(value); + } - public void addFloat(Float value) { - arguments.add(value); - } + public void addFloat(Float value) { + arguments.add(value); + } - public void addByte(Byte value) { - arguments.add(value); - } + public void addByte(Byte value) { + arguments.add(value); + } - public void addShort(Short value) { - arguments.add(value); - } + public void addShort(Short value) { + arguments.add(value); + } - public void addDouble(Double value) { - arguments.add(value); - } + public void addDouble(Double value) { + arguments.add(value); + } - /** - * Returns a arguments list. - * - * @see UIModelObject This list can contain UIModelObject or a primitive - * type - * - * @return a arguments list. - */ - public List<Object> getArguments() { - return arguments; - } + /** + * Returns a arguments list. + * + * @see UIModelObject This list can contain UIModelObject or a primitive + * type + * + * @return a arguments list. + */ + public List<Object> getArguments() { + return arguments; + } } // UIModelArgumentsImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelChildImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,16 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelChildImpl.java + + +package org.codelutin.generator.models.ui.xml; + +import org.codelutin.generator.models.ui.UIModelChild; +import org.codelutin.generator.models.ui.UIModelConstraint; +import org.codelutin.generator.models.ui.UIModelObject; + +/** + * UIModelChildImpl. * * Created: Jun 4, 2004 * @@ -27,64 +35,57 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import org.codelutin.generator.models.ui.UIModelChild; -import org.codelutin.generator.models.ui.UIModelConstraint; -import org.codelutin.generator.models.ui.UIModelObject; - public class UIModelChildImpl implements UIModelChild { // UIModelChildImpl - // protected UIModel model = null; - // protected UIModelObject parent = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - protected UIModelObject object = null; + protected UIModelObject object = null; - protected UIModelConstraintImpl constraint = null; + protected UIModelConstraintImpl constraint = null; - public UIModelChildImpl() { - super(); - } + public UIModelChildImpl() { + super(); + } - public void setObject(UIModelObject object) { - // if(object == null) { - // return new UIModelObjectImpl(model, parent); - // } + public void setObject(UIModelObject object) { + // if(object == null) { + // return new UIModelObjectImpl(model, parent); + // } - this.object = object; - // return object; - } + this.object = object; + // return object; + } - public void setLayout(UIModelConstraintImpl constraint) { - // if (constraint == null) - // return new UIModelConstraintImpl(model, parent); + public void setLayout(UIModelConstraintImpl constraint) { + // if (constraint == null) + // return new UIModelConstraintImpl(model, parent); - this.constraint = constraint; - // return constraint; - } + this.constraint = constraint; + // return constraint; + } - /** - * Returns a UIModelObject for this child. - * - * @see UIModelObject - * - * @return a UIModelObject for this child. - */ - public UIModelObject getObject() { - return object; - } + /** + * Returns a UIModelObject for this child. + * + * @see UIModelObject + * + * @return a UIModelObject for this child. + */ + public UIModelObject getObject() { + return object; + } - /** - * Returns a UIModelConstraint for this child - * - * @see UIModelConstraint - * - * @return a UIModelConstraint for this child. - */ - public UIModelConstraint getConstraint() { - return constraint; - } + /** + * Returns a UIModelConstraint for this child + * + * @see UIModelConstraint + * + * @return a UIModelConstraint for this child. + */ + public UIModelConstraint getConstraint() { + return constraint; + } } // UIModelChildImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelConstraintImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,12 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/******************************************************************************* - * UIModelConstraintImpl.java +package org.codelutin.generator.models.ui.xml; + +import org.codelutin.generator.models.ui.UIModelConstraint; + +/** + * UIModelConstraintImpl. * * Created: Jun 4, 2004 * @@ -26,59 +30,54 @@ * * Mise a jour: $Date$ par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import org.codelutin.generator.models.ui.UIModelConstraint; - public class UIModelConstraintImpl implements UIModelConstraint { // UIModelConstraintImpl - // protected UIModel model = null; - // protected UIModelObject parent = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - // valeur de la constraint de type UIModelObject ou String (cas du - // borderLayout) - protected Object value = null; + // valeur de la constraint de type UIModelObject ou String (cas du + // borderLayout) + protected Object value = null; - public UIModelConstraintImpl() { - // this.model = model; - // this.parent = parent; - } + public UIModelConstraintImpl() { + // this.model = model; + // this.parent = parent; + } - public void setObject(UIModelObjectImpl value) { - // if (value == null) { - // return new UIModelObjectImpl(model, parent); - // } + public void setObject(UIModelObjectImpl value) { + // if (value == null) { + // return new UIModelObjectImpl(model, parent); + // } - this.value = value; - // return value; - } + this.value = value; + // return value; + } - public void setString(String value) { - this.value = value; - } + public void setString(String value) { + this.value = value; + } - /** - * Returns the value of this constraint. the value returned can be an - * instance of UIModelObject or String or null - * - * @return the value of this constraint. - */ - public Object getValue() { - return value; - } + /** + * Returns the value of this constraint. the value returned can be an + * instance of UIModelObject or String or null + * + * @return the value of this constraint. + */ + public Object getValue() { + return value; + } - /** - * Returns the value of this constraint if the type is String else return - * null - * - * @return the value of this constraint. - */ - public String getStringValue() { - if (value instanceof String) - return (String) value; - return null; - } + /** + * Returns the value of this constraint if the type is String else return + * null + * + * @return the value of this constraint. + */ + public String getStringValue() { + if (value instanceof String) + return (String) value; + return null; + } } // UIModelConstraintImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelEventImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,14 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelEventImpl.java + + +package org.codelutin.generator.models.ui.xml; + +import org.codelutin.generator.models.ui.UIModelEvent; + +/** + * UIModelEventImpl. * * Created: Jun 4, 2004 * @@ -27,94 +33,89 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import org.codelutin.generator.models.ui.UIModelEvent; - public class UIModelEventImpl implements UIModelEvent { // UIModelEventImpl - //protected UIModel model = null; + //protected UIModel model = null; - protected String addMethod = null; + protected String addMethod = null; - protected String source = null; + protected String source = null; - protected String action = null; + protected String action = null; - protected String handler = null; + protected String handler = null; - protected String argument = null; + protected String argument = null; - public UIModelEventImpl() { - super(); - } + public UIModelEventImpl() { + super(); + } - public void setAddmethod(String addMethod) { - this.addMethod = addMethod; - } + public void setAddmethod(String addMethod) { + this.addMethod = addMethod; + } - public void setSource(String source) { - this.source = source; - } + public void setSource(String source) { + this.source = source; + } - public void setAction(String action) { - this.action = action; - } + public void setAction(String action) { + this.action = action; + } - public void setHandler(String handler) { - this.handler = handler; - } + public void setHandler(String handler) { + this.handler = handler; + } - public void setArgument(String argument) { - this.argument = argument; - } + public void setArgument(String argument) { + this.argument = argument; + } - /** - * Return the method which will have the EventHandler in parameter - * - * @return String - */ - public String getAddMethod() { - return addMethod; - } + /** + * Return the method which will have the EventHandler in parameter + * + * @return String + */ + public String getAddMethod() { + return addMethod; + } - /** - * Return the listener interface to create a proxy for - * - * @return String - */ - public String getSource() { - return source; - } + /** + * Return the listener interface to create a proxy for + * + * @return String + */ + public String getSource() { + return source; + } - /** - * Return the name of the method in the listener interface that should - * trigger the action - * - * @return String - */ - public String getAction() { - return action; - } + /** + * Return the name of the method in the listener interface that should + * trigger the action + * + * @return String + */ + public String getAction() { + return action; + } - /** - * Return the name of a writable method on the target - * - * @return String - */ - public String getHandler() { - return handler; - } + /** + * Return the name of a writable method on the target + * + * @return String + */ + public String getHandler() { + return handler; + } - /** - * Return the name of a readable property of the incoming event - * - * @return String - */ - public String getArgument() { - return argument; - } + /** + * Return the name of a readable property of the incoming event + * + * @return String + */ + public String getArgument() { + return argument; + } } // UIModelEventImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,17 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelImpl.java +package org.codelutin.generator.models.ui.xml; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.codelutin.generator.models.ui.UIModel; +import org.codelutin.generator.models.ui.UIModelObject; + +/** + * UIModelImpl. * * Created: Jun 4, 2004 * @@ -27,16 +36,6 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.codelutin.generator.models.ui.UIModel; -import org.codelutin.generator.models.ui.UIModelObject; - public class UIModelImpl implements UIModel { // UIModelImpl protected String version = null; @@ -47,10 +46,10 @@ * Contient tous les objets du model. * key: nom de l'objet; value: l'objet */ - protected Map<String,UIModelObject> objects = new HashMap<String, UIModelObject>(); + protected Map<String, UIModelObject> objects = new HashMap<String, UIModelObject>(); public UIModelImpl() { - super(); + super(); } public void setVersion(String version) { @@ -70,11 +69,11 @@ //if (object == null) { // return new UIModelObjectImpl(this, null); //} - - // set model and parent - object.setParent(null); - object.setModel(this); - + + // set model and parent + object.setParent(null); + object.setModel(this); + root = object; addObject(root); //return object; @@ -85,7 +84,7 @@ * @see UIModelObject */ public void addObject(UIModelObject object) { - if(object.getName() != null){ + if (object.getName() != null) { objects.put(object.getName(), object); } } @@ -114,11 +113,10 @@ * * @return the object root defined in this ui model. */ - public UIModelObject getRoot(){ + public UIModelObject getRoot() { return root; } - /** * Returns all objects defined in this ui model. * @see UIModelObject @@ -130,9 +128,8 @@ } public UIModelObject getObject(String name) { - return (UIModelObject)objects.get(name); + return (UIModelObject) objects.get(name); } - } // UIModelImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelObjectImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,18 +15,6 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/******************************************************************************* - * UIModelObjectImpl.java - * - * Created: Jun 4, 2004 - * - * @author Benjamin Poussin <poussin@codelutin.com>Copyright Code Lutin - * - * @version $Revision$ - * - * Mise a jour: $Date$ par : $Author$ - */ - package org.codelutin.generator.models.ui.xml; import java.util.ArrayList; @@ -40,225 +28,236 @@ import org.codelutin.generator.models.ui.UIModelObject; import org.codelutin.generator.models.ui.UIModelProperty; +/** + * UIModelObjectImpl. + * + * Created: Jun 4, 2004 + * + * @author Benjamin Poussin <poussin@codelutin.com>Copyright Code Lutin + * + * @version $Revision$ + * + * Mise a jour: $Date$ par : $Author$ + */ public class UIModelObjectImpl implements UIModelObject { // UIModelObjectImpl - protected UIModel model = null; + protected UIModel model = null; - protected UIModelObject parent = null; + protected UIModelObject parent = null; - protected UIModelConstraint constraint = null; + protected UIModelConstraint constraint = null; - protected String type = null; + protected String type = null; - protected String name = null; + protected String name = null; - protected UIModelArgumentsImpl arguments = null; + protected UIModelArgumentsImpl arguments = null; - protected List<UIModelProperty> properties = new ArrayList<UIModelProperty>(); + protected List<UIModelProperty> properties = new ArrayList<UIModelProperty>(); - protected List<UIModelEvent> events = new ArrayList<UIModelEvent>(); + protected List<UIModelEvent> events = new ArrayList<UIModelEvent>(); - /** Collection de UIModelObject */ - protected List<UIModelChild> children = new ArrayList<UIModelChild>(); + /** Collection de UIModelObject */ + protected List<UIModelChild> children = new ArrayList<UIModelChild>(); - public UIModelObjectImpl() { - super(); - } + public UIModelObjectImpl() { + super(); + } - public void setClass(String type) { - this.type = type; - } + public void setClass(String type) { + this.type = type; + } - public void setArguments(UIModelArgumentsImpl argument) { - // if (argument == null) { - // return new UIModelArgumentsImpl(model, this); - // } + public void setArguments(UIModelArgumentsImpl argument) { + // if (argument == null) { + // return new UIModelArgumentsImpl(model, this); + // } - this.arguments = argument; - // return argument; - } + this.arguments = argument; + // return argument; + } - public void addProperty(UIModelPropertyImpl property) { - // if (property == null) { - // return new UIModelPropertyImpl(model, this); - // } + public void addProperty(UIModelPropertyImpl property) { + // if (property == null) { + // return new UIModelPropertyImpl(model, this); + // } - if (property.getValue() instanceof UIModelObjectImpl) { - getModel().addObject((UIModelObject) property.getValue()); - } + if (property.getValue() instanceof UIModelObjectImpl) { + getModel().addObject((UIModelObject) property.getValue()); + } - if (property.getName().equals("name")) { - name = property.getStringValue(); - } - properties.add(property); - // return property; - } + if (property.getName().equals("name")) { + name = property.getStringValue(); + } + properties.add(property); + // return property; + } - public void addEvent(UIModelEventImpl event) { - // if (event == null) { - // return new UIModelEventImpl(model); - // } + public void addEvent(UIModelEventImpl event) { + // if (event == null) { + // return new UIModelEventImpl(model); + // } - events.add(event); - // return event; - } + events.add(event); + // return event; + } - public void addChild(UIModelChildImpl child) { - // if (child == null) { - // return new UIModelChildImpl(model, this); - // } + public void addChild(UIModelChildImpl child) { + // if (child == null) { + // return new UIModelChildImpl(model, this); + // } - UIModelObjectImpl childObject = (UIModelObjectImpl) child.getObject(); - UIModelConstraintImpl childConstraint = (UIModelConstraintImpl) child - .getConstraint(); - childObject.setConstraint(childConstraint); + UIModelObjectImpl childObject = (UIModelObjectImpl) child.getObject(); + UIModelConstraintImpl childConstraint = (UIModelConstraintImpl) child + .getConstraint(); + childObject.setConstraint(childConstraint); - getModel().addObject(childObject); + getModel().addObject(childObject); - children.add(child); - // return child; - } + children.add(child); + // return child; + } - public void setConstraint(UIModelConstraintImpl constraint) { - this.constraint = constraint; - } + public void setConstraint(UIModelConstraintImpl constraint) { + this.constraint = constraint; + } - /** - * Returns the parent of this object. Returns null if this object is root - * - * @return the parent of this object. - */ - public UIModelObject getParent() { - return parent; - } + /** + * Returns the parent of this object. Returns null if this object is root + * + * @return the parent of this object. + */ + public UIModelObject getParent() { + return parent; + } - /** - * Set the parent of this object. - */ - public void setParent(UIModelObject parent) { - this.parent = parent; - } + /** + * Set the parent of this object. + */ + public void setParent(UIModelObject parent) { + this.parent = parent; + } - /** - * Returns the type of this object. - * - * @return the type of this object. - */ - public String getType() { - return type; - } + /** + * Returns the type of this object. + * + * @return the type of this object. + */ + public String getType() { + return type; + } - /** - * Returns the value of the property "name" of this object - * - * @return the name of this object. - */ - public String getName() { - return name; - } + /** + * Returns the value of the property "name" of this object + * + * @return the name of this object. + */ + public String getName() { + return name; + } - /** - * Returns the constraint of this object - * - * @see UIModelConstraint - * - * @return the constraint of this object. - */ - public UIModelConstraint getConstraint() { - return constraint; - } + /** + * Returns the constraint of this object + * + * @see UIModelConstraint + * + * @return the constraint of this object. + */ + public UIModelConstraint getConstraint() { + return constraint; + } - /** - * Returns all arguments defined on this object. if this objects hasn't - * arguments return null This collection can contain UIModelObject or a - * primitive type - * - * @return a Collection containing all arguments for this object. - */ - public Collection<Object> getArguments() { - if (arguments != null) - return arguments.getArguments(); - return new ArrayList<Object>(); - } + /** + * Returns all arguments defined on this object. if this objects hasn't + * arguments return null This collection can contain UIModelObject or a + * primitive type + * + * @return a Collection containing all arguments for this object. + */ + public Collection<Object> getArguments() { + if (arguments != null) + return arguments.getArguments(); + return new ArrayList<Object>(); + } - /** - * Returns all properties defined on this object. - * - * @see UIModelProperty - * - * @return a Collection containing all UIModelProperties for this object. - */ - public Collection<UIModelProperty> getProperties() { - return properties; - } + /** + * Returns all properties defined on this object. + * + * @see UIModelProperty + * + * @return a Collection containing all UIModelProperties for this object. + */ + public Collection<UIModelProperty> getProperties() { + return properties; + } - /** - * Returns the property defined on this object. - * - * @see UIModelProperty - * @param String - * the name of the property which must be returned - * @return a UIModelProperty for this object with the . - */ - public UIModelProperty getProperty(String name) { + /** + * Returns the property defined on this object. + * + * @see UIModelProperty + * @param String + * the name of the property which must be returned + * @return a UIModelProperty for this object with the . + */ + public UIModelProperty getProperty(String name) { - UIModelProperty property = null; - int position = 0; + UIModelProperty property = null; + int position = 0; - while (position < properties.size()) { + while (position < properties.size()) { - property = (UIModelProperty) properties.get(position); + property = (UIModelProperty) properties.get(position); - if (property.getName().equals(name)) { - break; - } - position++; - } + if (property.getName().equals(name)) { + break; + } + position++; + } - if (position >= properties.size()) { - throw new IllegalStateException("Propriete " + name - + " inexistante pour l'objet " + this.name); - } - return property; - } + if (position >= properties.size()) { + throw new IllegalStateException("Propriete " + name + + " inexistante pour l'objet " + this.name); + } + return property; + } - /** - * Returns all events defined on this object. - * - * @see UIModelEvent - * - * @return a Collection containing all UIModelEvents for this object. - */ - public Collection<UIModelEvent> getEvents() { - return events; - } + /** + * Returns all events defined on this object. + * + * @see UIModelEvent + * + * @return a Collection containing all UIModelEvents for this object. + */ + public Collection<UIModelEvent> getEvents() { + return events; + } - /** - * Returns all children defined on this object. - * - * @return a Collection containing all UIModelObject for this object. - */ - public Collection<UIModelChild> getChildren() { - return children; - } + /** + * Returns all children defined on this object. + * + * @return a Collection containing all UIModelObject for this object. + */ + public Collection<UIModelChild> getChildren() { + return children; + } - /** - * Returns the uimodel of this object. - * - * @see UIModel - * - * @return the uimodel of this object. - */ - public UIModel getModel() { - return model; - } + /** + * Returns the uimodel of this object. + * + * @see UIModel + * + * @return the uimodel of this object. + */ + public UIModel getModel() { + return model; + } - /** - * Set model - */ - public void setModel(UIModel model) { - this.model = model; - } + /** + * Set model + */ + public void setModel(UIModel model) { + this.model = model; + } } // UIModelObjectImpl Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/ui/xml/UIModelPropertyImpl.java 2009-02-19 09:36:12 UTC (rev 451) @@ -1,5 +1,5 @@ /* *##% Lutin Generator - * Copyright (C) 2004 - 2008 CodeLutin + * Copyright (C) 2004 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -15,8 +15,14 @@ * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ -/* * - * UIModelPropertyImpl.java + + +package org.codelutin.generator.models.ui.xml; + +import org.codelutin.generator.models.ui.UIModelProperty; + +/** + * UIModelPropertyImpl. * * Created: Jun 4, 2004 * @@ -27,154 +33,149 @@ * Mise a jour: $Date$ * par : $Author$ */ - -package org.codelutin.generator.models.ui.xml; - -import org.codelutin.generator.models.ui.UIModelProperty; - public class UIModelPropertyImpl implements UIModelProperty { // UIModelPropertyImpl - // protected UIModel model = null; - // protected UIModelObject parent = null; + // protected UIModel model = null; + // protected UIModelObject parent = null; - protected String name = null; + protected String name = null; - protected UIModelArgumentsImpl arguments = null; + protected UIModelArgumentsImpl arguments = null; - public UIModelPropertyImpl() { - super(); - } + public UIModelPropertyImpl() { + super(); + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public void setArguments(UIModelArgumentsImpl argument) { - // if (argument == null) { - // return new UIModelArgumentsImpl(model, parent); - // } + public void setArguments(UIModelArgumentsImpl argument) { + // if (argument == null) { + // return new UIModelArgumentsImpl(model, parent); + // } - this.arguments = argument; - // return argument; - } + this.arguments = argument; + // return argument; + } - /** - * Returns the name of this property. - * - * @return the name of this property. - */ - public String getName() { - return name; - } + /** + * Returns the name of this property. + * + * @return the name of this property. + */ + public String getName() { + return name; + } - /** - * Returns the value of this property. the value returned can be an instance - * of UIModelObject or String or Integer or Boolean or Character - * - * @return the value of this property. - */ - public Object getValue() { - int i = (arguments.getArguments().size()) - 1; - return arguments.getArguments().get(i); - } + /** + * Returns the value of this property. the value returned can be an instance + * of UIModelObject or String or Integer or Boolean or Character + * + * @return the value of this property. + */ + public Object getValue() { + int i = (arguments.getArguments().size()) - 1; + return arguments.getArguments().get(i); + } - /** - * Returns the index of this property if it's indexed property - * - * @return the index of this property. - */ - public int getIndex() throws Exception { - if (isIndexed()) { - return ((Integer) arguments.getArguments().get(0)).intValue(); - } - throw new Exception( - "Impossible d'obtenir l'index d'une propriete non indexee"); - } + /** + * Returns the index of this property if it's indexed property + * + * @return the index of this property. + */ + public int getIndex() throws Exception { + if (isIndexed()) { + return ((Integer) arguments.getArguments().get(0)).intValue(); + } + throw new Exception( + "Impossible d'obtenir l'index d'une propriete non indexee"); + } - public boolean isIndexed() { - return arguments.getArguments().size() >= 2; - } + public boolean isIndexed() { + return arguments.getArguments().size() >= 2; + } - /** - * Returns the value of this property if the type is int - * - * @return the value of this property. - */ - public int getIntValue() { - return ((Integer) getValue()).intValue(); - } + /** + * Returns the value of this property if the type is int + * + * @return the value of this property. + */ + public int getIntValue() { + return ((Integer) getValue()).intValue(); + } - /** - * Returns the value of this property if the type is boolean - * - * @return the value of this property. - */ - public boolean getBooleanValue() { - return ((Boolean) getValue()).booleanValue(); - } + /** + * Returns the value of this property if the type is boolean + * + * @return the value of this property. + */ + public boolean getBooleanValue() { + return ((Boolean) getValue()).booleanValue(); + } - /** - * Returns the value of this property if the type is char - * - * @return the value of this property. - */ - public char getCharValue() { - return ((Character) getValue()).charValue(); - } + /** + * Returns the value of this property if the type is char + * + * @return the value of this property. + */ + public char getCharValue() { + return ((Character) getValue()).charValue(); + } - /** - * Returns the value of this property if the type is String - * - * @return the value of this property. - */ - public String getStringValue() { - return getValue().toString(); - } + /** + * Returns the value of this property if the type is String + * + * @return the value of this property. + */ + public String getStringValue() { + return getValue().toString(); + } - /** - * Returns the value of this property if the type is byte - * - * @return the value of this property. - */ - public byte getByteValue() { - return ((Byte) getValue()).byteValue(); - } + /** + * Returns the value of this property if the type is byte + * + * @return the value of this property. + */ + public byte getByteValue() { + return ((Byte) getValue()).byteValue(); + } - /** - * Returns the value of this property if the type is long - * - * @return the value of this property. - */ - public long getLongValue() { - return ((Long) getValue()).longValue(); - } + /** + * Returns the value of this property if the type is long + * + * @return the value of this property. + */ + public long getLongValue() { + return ((Long) getValue()).longValue(); + } - /** - * Returns the value of this property if the type is short - * - * @return the value of this property. - */ - public short getShortValue() { - return ((Short) getValue()).shortValue(); - } + /** + * Returns the value of this property if the type is short + * + * @return the value of this property. + */ + public short getShortValue() { + return ((Short) getValue()).shortValue(); + } - /** - * Returns the value of this property if the type is float - * - * @return the value of this property. - */ - public float getFloatValue() { - return ((Float) getValue()).floatValue(); - } + /** + * Returns the value of this property if the type is float + * + * @return the value of this property. + */ + public float getFloatValue() { + return ((Float) getValue()).floatValue(); + } - /** - * Returns the value of this property if the type is double - * - * @return the value of this property. - */ - public double getDoubleValue() { - return ((Double) getValue()).doubleValue(); - } + /** + * Returns the value of this property if the type is double + * + * @return the value of this property. + */ + public double getDoubleValue() { + return ((Double) getValue()).doubleValue(); + } } // UIModelPropertyImpl Added: lutingenerator/trunk/src/main/java/org/codelutin/generator/package-info.java =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/package-info.java (rev 0) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/package-info.java 2009-02-19 09:36:12 UTC (rev 451) @@ -0,0 +1,5 @@ +/** + * Lutin Generator. + */ +package org.codelutin.generator; + Deleted: lutingenerator/trunk/src/main/java/org/codelutin/generator/package.html =================================================================== --- lutingenerator/trunk/src/main/java/org/codelutin/generator/package.html 2009-02-18 19:27:05 UTC (rev 450) +++ lutingenerator/trunk/src/main/java/org/codelutin/generator/package.html 2009-02-19 09:36:12 UTC (rev 451) @@ -1,7 +0,0 @@ -<html> - <body> -<h1>lutingenerator<h1> - -description du package. - </body> -</html>
participants (1)
-
chatellier@users.labs.libre-entreprise.org