Revision: 1352
http://japi.svn.sourceforge.net/japi/?rev=1352&view=rev
Author: christianhujer
Date: 2009-06-14 09:31:39 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Improve serialization.
Modified Paths:
--------------
progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
Modified: progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
===================================================================
--- progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2009-06-14 09:31:05 UTC (rev 1351)
+++ progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2009-06-14 09:31:39 UTC (rev 1352)
@@ -19,6 +19,8 @@
import javax.swing.JComponent;
import javax.swing.JLabel;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.awt.GridBagLayout;
@@ -33,6 +35,9 @@
*/
public class ReflectionField extends JComponent {
+ /** Serial version. */
+ private static final long serialVersionUID = 1L;
+
/** The label to update.
* @serial include
*/
@@ -48,10 +53,13 @@
*/
private final Object target;
+ /** The name of the property field. */
+ private final String fieldName;
+
/** The method used to retrieve the value of the property.
* @serial include
*/
- private final Method getter;
+ private transient Method getter;
/** Creates a ReflactionField.
* @param label The label that shall be displayed.
@@ -66,10 +74,16 @@
add(this.label);
this.format = format;
this.target = target;
+ this.fieldName = fieldName;
getter = getGetterMethod(target.getClass(), fieldName);
}
+ /** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ getter = getGetterMethod(target.getClass(), fieldName);
+ }
+
/** Updates the display to reflect the latest property value. */
public void update() {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|