@@ -0,0 +1,2374 @@
+package org.ppwcode.value_III.ext.java.util;%0D%0A%0D%0Aimport static org.ppwcode.metainfo_I.License.Type.PROPRIETARY;%0D%0A%0D%0Aimport javax.mail.internet.AddressException;%0D%0Aimport javax.mail.internet.InternetAddress;%0D%0A%0D%0Aimport org.apache.openjpa.jdbc.kernel.JDBCStore;%0D%0Aimport org.apache.openjpa.jdbc.meta.ValueMapping;%0D%0Aimport org.apache.openjpa.jdbc.meta.strats.AbstractValueHandler;%0D%0Aimport org.apache.openjpa.jdbc.schema.Column;%0D%0Aimport org.apache.openjpa.jdbc.schema.ColumnIO;%0D%0Aimport org.apache.openjpa.meta.JavaTypes;%0D%0Aimport org.ppwcode.metainfo_I.Copyright;%0D%0Aimport org.ppwcode.metainfo_I.License;%0D%0Aimport org.ppwcode.metainfo_I.vcs.SvnInfo;%0D%0A%0D%0A/**%0D%0A * The valuehandler will store an %7B@link InternetAddress%7D in the database as%0D%0A * %7B@link String%7D.%0D%0A *%0D%0A * @author Peter Sinjan%0D%0A */%0D%0A@Copyright(%222008 - $Date: 2008-12-02 17:58:19 +0100 (Tue, 02 Dec 2008) $, AristA v.z.w.%22)%0D%0A@License(PROPRIETARY)%0D%0A@SvnInfo(revision = %22$Revision: 4291 $%22,%0D%0A         date     = %22$Date: 2008-12-02 17:58:19 +0100 (Tue, 02 Dec 2008) $%22)%0D%0Apublic class InternetAddressValueHandler extends AbstractValueHandler %7B%0D%0A%0D%0A  private static final long serialVersionUID = -7946528814038849098L;%0D%0A%0D%0A  /**%0D%0A   * This function will map take care of the mapping in the database%0D%0A   */%0D%0A  public Column%5B%5D map(ValueMapping vm, String name, ColumnIO io,%0D%0A      boolean adapt) %7B%0D%0A    Column col = new Column();%0D%0A    col.setName(name);%0D%0A    col.setJavaType(JavaTypes.STRING);%0D%0A    return new Column%5B%5D%7B col %7D;%0D%0A  %7D%0D%0A%0D%0A  /**%0D%0A   * @see AbstractValueHandler#toDataStoreValue(ValueMapping, Object, JDBCStore)%0D%0A   */%0D%0A  @Override%0D%0A  public Object toDataStoreValue(ValueMapping vm, Object val,%0D%0A      JDBCStore store) %7B%0D%0A      if (val == null %7C%7C !(val instanceof InternetAddress))%0D%0A          return null;%0D%0A      InternetAddress storeObj = (InternetAddress) val;%0D%0A      //Store the InternetAddress in the DB as String%0D%0A      return storeObj.getAddress();%0D%0A  %7D%0D%0A%0D%0A  /**%0D%0A   * @see AbstractValueHandler#toObjectValue(ValueMapping, Object)%0D%0A   */%0D%0A  @Override%0D%0A  public Object toObjectValue(ValueMapping vm, Object val) %7B%0D%0A    if (val == null)%0D%0A      return null;%0D%0A    InternetAddress ia = null;%0D%0A    try %7B%0D%0A      //make a new InternetAddress with the retrieved value as address%0D%0A      ia = new InternetAddress((String) val);%0D%0A      ia.validate();%0D%0A    %7D catch (AddressException e) %7B%0D%0A      //NOP%0D%0A    %7D%0D%0A    return ia;%0D%0A  %7D%0D%0A%0D%0A%7D%0D%0A

save commit; from another library, where it was proven to work, and where we don't need it anymore