Coverage Report - org.argouml.uml.generator.CodeGenerator
 
Classes in this File Line Coverage Branch Coverage Complexity
CodeGenerator
N/A
N/A
1
 
 1  
 /* $Id: CodeGenerator.java 17868 2010-01-12 20:47:51Z linus $
 2  
  *****************************************************************************
 3  
  * Copyright (c) 2009 Contributors - see below
 4  
  * All rights reserved. This program and the accompanying materials
 5  
  * are made available under the terms of the Eclipse Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/epl-v10.html
 8  
  *
 9  
  * Contributors:
 10  
  *    tfmorris
 11  
  *****************************************************************************
 12  
  *
 13  
  * Some portions of this file was previously release using the BSD License:
 14  
  */
 15  
 
 16  
 // Copyright (c) 2005-2008 The Regents of the University of California. All
 17  
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 18  
 // software and its documentation without fee, and without a written
 19  
 // agreement is hereby granted, provided that the above copyright notice
 20  
 // and this paragraph appear in all copies.  This software program and
 21  
 // documentation are copyrighted by The Regents of the University of
 22  
 // California. The software program and documentation are supplied "AS
 23  
 // IS", without any accompanying services from The Regents. The Regents
 24  
 // does not warrant that the operation of the program will be
 25  
 // uninterrupted or error-free. The end-user understands that the program
 26  
 // was developed for research purposes and is advised not to rely
 27  
 // exclusively on the program for any reason.  IN NO EVENT SHALL THE
 28  
 // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
 29  
 // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
 30  
 // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 31  
 // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 32  
 // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
 33  
 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 34  
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 35  
 // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 36  
 // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
 37  
 // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 38  
 
 39  
 package org.argouml.uml.generator;
 40  
 
 41  
 import java.util.Collection;
 42  
 
 43  
 /**
 44  
  * Defines the methods to generate source code from the model. Each class
 45  
  * providing code generation functionality must implement this to be recognized
 46  
  * by ArgoUML as a code generator.
 47  
  * <p>
 48  
  * TODO: A GUI-independent mechanism to pass settings to the code generator is
 49  
  * needed similar to what we have for reverse engineering.  See
 50  
  * {@link org.argouml.uml.reveng.ImportInterface#getImportSettings()} and
 51  
  * {@link org.argouml.uml.reveng.SettingsTypes}
 52  
  * 
 53  
  * @since 0.20 when it replaced the FileGenerator interface.
 54  
  */
 55  
 public interface CodeGenerator {
 56  
     
 57  
     /**
 58  
      * The file separator for this operating system.
 59  
      */
 60  
     String FILE_SEPARATOR = System.getProperty("file.separator");
 61  
 
 62  
     /**
 63  
      * Generate code for the specified classifiers. If generation of
 64  
      * dependencies is requested, then every file the specified elements
 65  
      * depends on is generated too (e.g. if the class MyClass has an attribute
 66  
      * of type OtherClass, then files for OtherClass are generated too).
 67  
      *
 68  
      * @param elements the UML model elements to generate code for.
 69  
      * @param deps Recursively generate dependency files too.
 70  
      * @return A collection of {@link SourceUnit} objects. The collection
 71  
      *         may be empty if no file is generated.
 72  
      */
 73  
     Collection<SourceUnit> generate(Collection elements, boolean deps);
 74  
 
 75  
     /**
 76  
      * Generate files for the specified classifiers.
 77  
      * 
 78  
      * @see #generate(Collection, boolean)
 79  
      * @param elements the UML model elements to generate code for.
 80  
      * @param path The source base path.
 81  
      * @param deps Recursively generate dependency files too.
 82  
      * @return The filenames (with relative path) as a collection of Strings.
 83  
      *         The collection may be empty if no file will be generated.
 84  
      */
 85  
     Collection<String> generateFiles(Collection elements, String path, 
 86  
             boolean deps);
 87  
 
 88  
     /**
 89  
      * Returns a list of files that will be generated from the specified
 90  
      * modelelements.
 91  
      * 
 92  
      * @see #generate(Collection, boolean)
 93  
      * @param elements the UML model elements to generate code for.
 94  
      * @param deps Recursively generate dependency files too.
 95  
      * @return The filenames (with relative path) as a collection of Strings.
 96  
      *         The collection may be empty if no file will be generated.
 97  
      */
 98  
     Collection<String> generateFileList(Collection elements, boolean deps);
 99  
 }