Java Doc for Encoder.java in  » Apache-Harmony-Java-SE » java-package » java » beans » 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 » Apache Harmony Java SE » java package » java.beans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.beans.Encoder

All known Subclasses:   java.beans.XMLEncoder,
Encoder
public class Encoder (Code)
The Encoder, together with PersistenceDelegate s, can encode an object into a series of java statements. By executing these statements, a new object can be created and it will has the same state as the original object which has been passed to the encoder. Here "has the same state" means the two objects are indistinguishable from their public API.

The Encoder and PersistenceDelegate s do this by creating copies of the input object and all objects it references. The copy process continues recursively util every object in the object graph has its new copy and the new version has the same state as the old version. All statements used to create those new objects and executed on them during the process form the result of encoding.




Constructor Summary
public  Encoder()
     Construct a new encoder.

Method Summary
 voidclear()
     Clear all the new objects have been created.
public  Objectget(Object old)
     Gets the new copy of the given old object.
public  ExceptionListenergetExceptionListener()
     Returns the exception listener of this encoder.

An encoder always have a non-null exception listener.

public  PersistenceDelegategetPersistenceDelegate(Class type)
     Returns a PersistenceDelegate for the given class type.

The PersistenceDelegate is determined as following:

  1. If a PersistenceDelegate has been registered by calling setPersistenceDelegate for the given type, it is returned.
  2. If the given type is an array class, a special PersistenceDelegate for array types is returned.
  3. If the given type is a proxy class, a special PersistenceDelegate for proxy classes is returned.
  4. Introspector is used to check the bean descriptor value "persistenceDelegate".
public  Objectremove(Object old)
     Remvoe the existing new copy of the given old object.
public  voidsetExceptionListener(ExceptionListener listener)
     Sets the exception listener of this encoder.
public  voidsetPersistenceDelegate(Class type, PersistenceDelegate delegate)
     Register the PersistenceDelegate of the specified type.
public  voidwriteExpression(Expression oldExp)
     Write an expression of old objects.

The implementation first check the return value of the expression.

protected  voidwriteObject(Object o)
     Encode the given object into a series of statements and expressions.
public  voidwriteStatement(Statement oldStat)
     Write a statement of old objects.

A new statement is created by using the new versions of the target and arguments.



Constructor Detail
Encoder
public Encoder()(Code)
Construct a new encoder.




Method Detail
clear
void clear()(Code)
Clear all the new objects have been created.



get
public Object get(Object old)(Code)
Gets the new copy of the given old object.

Strings are special objects which have their new copy by default, so if the old object is a string, it is returned directly.


Parameters:
  old - an old object the new copy of the given old object, or null if there is notone.



getExceptionListener
public ExceptionListener getExceptionListener()(Code)
Returns the exception listener of this encoder.

An encoder always have a non-null exception listener. A default exception listener is used when the encoder is created.

the exception listener of this encoder



getPersistenceDelegate
public PersistenceDelegate getPersistenceDelegate(Class type)(Code)
Returns a PersistenceDelegate for the given class type.

The PersistenceDelegate is determined as following:

  1. If a PersistenceDelegate has been registered by calling setPersistenceDelegate for the given type, it is returned.
  2. If the given type is an array class, a special PersistenceDelegate for array types is returned.
  3. If the given type is a proxy class, a special PersistenceDelegate for proxy classes is returned.
  4. Introspector is used to check the bean descriptor value "persistenceDelegate". If one is set, it is returned.
  5. If none of the above applies, the DefaultPersistenceDelegate is returned.


Parameters:
  type - a class type a PersistenceDelegate for the given class type



remove
public Object remove(Object old)(Code)
Remvoe the existing new copy of the given old object.
Parameters:
  old - an old object the removed new version of the old object, or null if there isnot one



setExceptionListener
public void setExceptionListener(ExceptionListener listener)(Code)
Sets the exception listener of this encoder.
Parameters:
  listener - the exception listener to set



setPersistenceDelegate
public void setPersistenceDelegate(Class type, PersistenceDelegate delegate)(Code)
Register the PersistenceDelegate of the specified type.
Parameters:
  type -
Parameters:
  delegate -



writeExpression
public void writeExpression(Expression oldExp)(Code)
Write an expression of old objects.

The implementation first check the return value of the expression. If there exists a new version of the object, simply return.

A new expression is created using the new versions of the target and the arguments. If any of the old objects do not have its new version yet, writeObject() is called to create the new version.

The new expression is then executed to obtained a new copy of the old return value.

Call writeObject() with the old return value, so that more statements will be executed on its new version to change it into the same state as the old value.


Parameters:
  oldExp - the expression to write. The target, arguments, and returnvalue of the expression are all old objects.



writeObject
protected void writeObject(Object o)(Code)
Encode the given object into a series of statements and expressions.

The implementation simply finds the PersistenceDelegate responsible for the object's class, and delegate the call to it.


Parameters:
  o - the object to encode



writeStatement
public void writeStatement(Statement oldStat)(Code)
Write a statement of old objects.

A new statement is created by using the new versions of the target and arguments. If any of the objects do not have its new copy yet, writeObject() is called to create one.

The new statement is then executed to change the state of the new object.


Parameters:
  oldStat - a statement of old objects



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.