Package org.jtester.module.dbfit.db.model

Source Code of org.jtester.module.dbfit.db.model.DbTypeAdapter

package org.jtester.module.dbfit.db.model;

import org.jtester.fit.util.ParseArg;

import fit.TypeAdapter;

public class DbTypeAdapter extends TypeAdapter {

  public Object parse(final String s) throws Exception {
    String text = ParseArg.parseCellValue(s);
    boolean isNull = text.toLowerCase().equals("<null>");
    if (isNull) {
      return null;
    }

    TypeAdapter ta = TypeAdapter.adapterFor(this.type);
    boolean isTypeAdapter = ta.getClass().equals(TypeAdapter.class);
    if (isTypeAdapter) {
      return super.parse(text);
    } else {
      return ta.parse(text);
    }
  }
}
TOP

Related Classes of org.jtester.module.dbfit.db.model.DbTypeAdapter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.