Source Code Cross Referenced for Mapping.java in  » UML » AndroMDA-3.2 » org » andromda » core » mapping » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » AndroMDA 3.2 » org.andromda.core.mapping 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.mapping;
002:
003:        import java.io.FileNotFoundException;
004:        import java.io.FileReader;
005:        import java.util.ArrayList;
006:        import java.util.Collection;
007:        import java.util.Iterator;
008:        import java.util.LinkedHashSet;
009:        import java.util.List;
010:
011:        import org.andromda.core.common.ExceptionUtils;
012:        import org.andromda.core.common.ResourceUtils;
013:
014:        /**
015:         * A single child mapping instance belonging to a Mappings instance. It doesn't make sense to instantiate this class by
016:         * itself.
017:         *
018:         * @author Chad Brandon
019:         * @author Wouter Zoons
020:         * @see org.andromda.core.mapping.Mappings
021:         */
022:        public class Mapping {
023:            /**
024:             * Stores the from elements.
025:             */
026:            private final Collection froms = new LinkedHashSet();
027:
028:            /**
029:             * Adds the <code>from</code> type to the mapping.
030:             *
031:             * @param from the type that we are mapping from.
032:             */
033:            public void addFrom(final String from) {
034:                ExceptionUtils.checkNull("from", from);
035:                froms.add(from);
036:            }
037:
038:            /**
039:             * Return the Collection of froms.
040:             *
041:             * @return Collection
042:             */
043:            public Collection getFroms() {
044:                return froms;
045:            }
046:
047:            /**
048:             * Returns the to type for this mapping.
049:             *
050:             * @return String the to type
051:             */
052:            public String getTo() {
053:                if (!this .paths.isEmpty()) {
054:                    try {
055:                        final StringBuffer pathsContents = new StringBuffer();
056:                        for (final Iterator iterator = this .paths.iterator(); iterator
057:                                .hasNext();) {
058:                            pathsContents.append(ResourceUtils
059:                                    .getContents(new FileReader(this .mappings
060:                                            .getCompletePath((String) iterator
061:                                                    .next()))));
062:                        }
063:                        this .to = pathsContents.toString();
064:                    } catch (final FileNotFoundException exception) {
065:                        throw new MappingsException(exception);
066:                    }
067:                }
068:                return this .to;
069:            }
070:
071:            /**
072:             * Stores any paths used by this mapping.
073:             */
074:            private final List paths = new ArrayList();
075:
076:            /**
077:             * Adds the path to the listof paths.
078:             * @param path
079:             */
080:            public void addPath(final String path) {
081:                this .paths.add(path);
082:            }
083:
084:            /**
085:             * Stores the to mapping.
086:             */
087:            private String to;
088:
089:            /**
090:             * Sets the type for this mapping.
091:             *
092:             * @param to the value to which the from
093:             *        values are mapped.
094:             */
095:            public void setTo(final String to) {
096:                this .to = to;
097:            }
098:
099:            /**
100:             * The parent of this instance.
101:             */
102:            private Mappings mappings;
103:
104:            /**
105:             * Sets the mappings to which this Mapping instance
106:             * belongs.
107:             *
108:             * @param mappings the owning mappings.
109:             */
110:            final void setMappings(final Mappings mappings) {
111:                this .mappings = mappings;
112:            }
113:
114:            /**
115:             * Returns a String representation of this mapping in the form of <code>from1, from2, from3 --> to</code>.
116:             *
117:             * @return a String representing the mapping instance
118:             */
119:            public String toString() {
120:                final StringBuffer buffer = new StringBuffer(512); // 512 should be enough for resizing not to occur
121:
122:                for (Iterator fromIterator = this .froms.iterator(); fromIterator
123:                        .hasNext();) {
124:                    final String from = (String) fromIterator.next();
125:                    buffer.append(from);
126:
127:                    if (fromIterator.hasNext()) {
128:                        buffer.append(", ");
129:                    }
130:                }
131:
132:                buffer.append(" --> ").append(this.to);
133:
134:                return buffer.toString();
135:            }
136:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.