Source Code Cross Referenced for XStreamBuilder.java in  » XML » xstream-1.3 » com » thoughtworks » xstream » builder » 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 » XML » xstream 1.3 » com.thoughtworks.xstream.builder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2007 XStream Committers.
003:         * All rights reserved.
004:         *
005:         * The software in this package is published under the terms of the BSD
006:         * style license a copy of which has been included with this distribution in
007:         * the LICENSE.txt file.
008:         * 
009:         * Created on 14. May 2007 by Guilherme Silveira
010:         */
011:        package com.thoughtworks.xstream.builder;
012:
013:        import java.util.ArrayList;
014:        import java.util.List;
015:
016:        import com.thoughtworks.xstream.ReadOnlyXStream;
017:        import com.thoughtworks.xstream.XStream;
018:        import com.thoughtworks.xstream.builder.processor.AbsoluteReferencesProcessor;
019:        import com.thoughtworks.xstream.builder.processor.AliasFieldProcessor;
020:        import com.thoughtworks.xstream.builder.processor.AliasTypeProcessor;
021:        import com.thoughtworks.xstream.builder.processor.ConfigProcessor;
022:        import com.thoughtworks.xstream.builder.processor.ConverterProcessor;
023:        import com.thoughtworks.xstream.builder.processor.FieldConfigProcessor;
024:        import com.thoughtworks.xstream.builder.processor.IdReferencesProcessor;
025:        import com.thoughtworks.xstream.builder.processor.IgnoreFieldProcessor;
026:        import com.thoughtworks.xstream.builder.processor.ImplementedByProcessor;
027:        import com.thoughtworks.xstream.builder.processor.NoReferencesProcessor;
028:        import com.thoughtworks.xstream.builder.processor.TypeConfigProcessor;
029:        import com.thoughtworks.xstream.builder.processor.annotations.AnnotatedTypeProcessor;
030:        import com.thoughtworks.xstream.converters.Converter;
031:
032:        /**
033:         * The base xstream builder. This is xstream's new entrypoint. Instantiate a builder, configure it
034:         * and invoke buildXStream at the end.
035:         *
036:         * @author Guilherme Silveira
037:         * @since upcoming
038:         */
039:        public class XStreamBuilder {
040:
041:            private final List childrenNodes = new ArrayList();
042:
043:            protected TypeConfig handle(Class type) {
044:                TypeConfig classConfig = new TypeConfig(type);
045:                childrenNodes.add(classConfig);
046:                return classConfig;
047:            }
048:
049:            public ReadOnlyXStream buildXStream() {
050:                XStream instance = createBasicInstance();
051:                for (int i = 0; i < childrenNodes.size(); i++) {
052:                    ConfigProcessor node = (ConfigProcessor) childrenNodes
053:                            .get(i);
054:                    node.process(instance);
055:                }
056:                return new ReadOnlyXStream(instance);
057:            }
058:
059:            /**
060:             * Extension point to allow lower-level programmers to create their own xstream instance.
061:             * @return the xstream instance to configure and wrap
062:             */
063:            protected XStream createBasicInstance() {
064:                return new XStream();
065:            }
066:
067:            protected TypeConfigProcessor alias(String alias) {
068:                return new AliasTypeProcessor(alias);
069:            }
070:
071:            protected FieldConfigProcessor as(String alias) {
072:                return new AliasFieldProcessor(alias);
073:            }
074:
075:            protected TypeConfigProcessor ignores(String fieldName) {
076:                return new IgnoreFieldProcessor(fieldName);
077:            }
078:
079:            protected TypeConfigProcessor implementedBy(
080:                    Class defaultImplementation) {
081:                return new ImplementedByProcessor(defaultImplementation);
082:            }
083:
084:            protected FieldConfig field(String fieldName) {
085:                return new FieldConfig(fieldName);
086:            }
087:
088:            protected XStreamBuilder register(ConfigProcessor[] nodes) {
089:                for (int i = 0; i < nodes.length; i++) {
090:                    ConfigProcessor node = nodes[i];
091:                    childrenNodes.add(node);
092:                }
093:                return this ;
094:            }
095:
096:            protected XStreamBuilder register(ConfigProcessor node) {
097:                childrenNodes.add(node);
098:                return this ;
099:            }
100:
101:            protected ConfigProcessor converter(Converter converter) {
102:                return new ConverterProcessor(converter);
103:            }
104:
105:            protected TypeConfigProcessor annotated() {
106:                return new AnnotatedTypeProcessor();
107:            }
108:
109:            protected ConfigProcessor absoluteReferences() {
110:                return new AbsoluteReferencesProcessor();
111:            }
112:
113:            protected ConfigProcessor idReferences() {
114:                return new IdReferencesProcessor();
115:            }
116:
117:            protected ConfigProcessor noReferences() {
118:                return new NoReferencesProcessor();
119:            }
120:
121:            protected void with(ConfigProcessor processor) {
122:                this.childrenNodes.add(processor);
123:            }
124:
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.