[Japi-cvs] SF.net SVN: japi:[1339] libs/lang/trunk/src/prj/net/sf/japi/lang/ PropertyComparator.jav
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2009-06-14 09:25:11
|
Revision: 1339 http://japi.svn.sourceforge.net/japi/?rev=1339&view=rev Author: christianhujer Date: 2009-06-14 09:25:09 +0000 (Sun, 14 Jun 2009) Log Message: ----------- Handle serialization of the getter method. Modified Paths: -------------- libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java Modified: libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java =================================================================== --- libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2009-06-14 09:20:46 UTC (rev 1338) +++ libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2009-06-14 09:25:09 UTC (rev 1339) @@ -18,6 +18,8 @@ package net.sf.japi.lang; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -60,7 +62,7 @@ /** The getter to read the property. * @serial include */ - @Nullable private final Method getter; // TODO:2009-02-16:christianhujer:Handle this field. + @Nullable private transient Method getter; /** Create a PropertyComparator. * @param targetClass The target class of which properties should be compared, maybe <code>null</code> in which case the target class will be evaluated dynamically. @@ -75,6 +77,12 @@ } /** {@inheritDoc} */ + private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException { + in.defaultReadObject(); + getter = targetClass == null ? null : getPropertyGetter(targetClass, propertyName); + } + + /** {@inheritDoc} */ public int compare(final C o1, final C o2) { try { final Method o1Getter = getter != null ? getter : getPropertyGetter(o1.getClass(), propertyName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |