Source Code Cross Referenced for Fragment.java in  » UML » AndroMDA-3.2 » org » andromda » core » translation » library » 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.translation.library 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.core.translation.library;
002:
003:        import java.util.LinkedHashMap;
004:        import java.util.Map;
005:
006:        import org.andromda.core.common.ExceptionUtils;
007:        import org.apache.commons.lang.StringUtils;
008:        import org.apache.commons.lang.builder.ToStringBuilder;
009:
010:        /**
011:         * A Translation "fragment" of a translation file. This fragment belongs to a Translation object.
012:         *
013:         * @author Chad Brandon
014:         * @see org.andromda.core.translation.library.Translation
015:         */
016:        public class Fragment {
017:            private String name;
018:            private String handlerMethod;
019:
020:            /**
021:             * The Translation to which this Fragment belongs.
022:             */
023:            private Translation translation;
024:
025:            /**
026:             * The possible kinds available to this Fragment
027:             */
028:            private Map kinds = new LinkedHashMap();
029:
030:            /**
031:             * It doesn't make any sense to instatiate this object explicitly. It intended to be instantiated as part of a
032:             * Translation.
033:             *
034:             * @see org.andromda.core.translation.library.Translation
035:             */
036:            public Fragment() {
037:                // Here for documentation purposes
038:            }
039:
040:            /**
041:             * Gets the name of this fragment
042:             *
043:             * @return the name of this fragment.
044:             */
045:            public String getName() {
046:                return name;
047:            }
048:
049:            /**
050:             * Sets the name of this fragment.
051:             *
052:             * @param name the name to set.
053:             */
054:            public void setName(final String name) {
055:                this .name = StringUtils.trimToEmpty(name);
056:            }
057:
058:            /**
059:             * Returns the kinds contained within this translation fragment
060:             *
061:             * @return Map the Kinds keyed by name.
062:             */
063:            public Map getKinds() {
064:                return this .kinds;
065:            }
066:
067:            /**
068:             * Returns the body for the fragment kind with the specified name.
069:             *
070:             * @param name the name of the kind to get.
071:             * @return FragmentKind
072:             */
073:            public String getKind(String name) {
074:                // clean the name first
075:                name = StringUtils.trimToEmpty(name);
076:                ExceptionUtils.checkEmpty("name", name);
077:                String kind = StringUtils.trimToEmpty((String) kinds.get(name));
078:                if (kind == null) {
079:                    throw new LibraryException("No kind '"
080:                            + name
081:                            + "' could be found for the translation fragment '"
082:                            + this .getName()
083:                            + "' check the fragment '"
084:                            + this .getName()
085:                            + "' in translation template --> '"
086:                            + getTranslation().getLibraryTranslation()
087:                                    .getTemplate() + "'");
088:                }
089:                return kind;
090:            }
091:
092:            /**
093:             * Adds the specified kind having the specified name and body to the Fragment.
094:             *
095:             * @param name the name of the kind of expression.
096:             * @param body the body of the kind of expression.
097:             */
098:            public void addKind(final String name, final String body) {
099:                kinds.put(StringUtils.trimToEmpty(name), body);
100:            }
101:
102:            /**
103:             * Returns the name of the handler method.
104:             *
105:             * @return Returns the handlerMethod.
106:             */
107:            public String getHandlerMethod() {
108:                return this .handlerMethod;
109:            }
110:
111:            /**
112:             * Sets the name of the handler method. This method is the method within the Translator that handles the processing
113:             * of the fragment.
114:             *
115:             * @param handlerMethod The handlerMethod to set.
116:             * @see org.andromda.core.translation.Translator
117:             */
118:            public void setHandlerMethod(final String handlerMethod) {
119:                this .handlerMethod = handlerMethod;
120:            }
121:
122:            /**
123:             * Gets the Translation to which this Fragment belongs.
124:             *
125:             * @return Translation
126:             */
127:            public Translation getTranslation() {
128:                final String methodName = "Fragment.getTranslation";
129:
130:                // should never happen, but it doesn't hurt to be safe
131:                if (this .translation == null) {
132:                    throw new LibraryException(methodName
133:                            + " - translation can not be null");
134:                }
135:                return translation;
136:            }
137:
138:            /**
139:             * Sets the Translation to which this Fragment belongs.
140:             *
141:             * @param translation
142:             */
143:            public void setTranslation(final Translation translation) {
144:                this .translation = translation;
145:            }
146:
147:            /**
148:             * @see java.lang.Object#toString()
149:             */
150:            public String toString() {
151:                return ToStringBuilder.reflectionToString(this);
152:            }
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.