Package pt.opensoft.dbaccess

Examples of pt.opensoft.dbaccess.Field


    if (fieldNames == null || fieldNames.length == 0) return false;

    boolean equal = true;
    for (int i = 0; i < fieldNames.length; i++) {
      String fieldName = fieldNames[i];
      Field fldThis = this.record.getField(fieldName);
      Field fldOther = other.record.getField(fieldName);
      if (fldThis == null || fldOther == null) return false;

      if (fldThis.getObject() instanceof BigDecimal && fldOther.getObject() instanceof BigDecimal) { // caso especial BigDecimal
        equal &= fldThis.getBigDecimal().compareTo(fldOther.getBigDecimal()) == 0;

      } else if (fldThis.getObject() instanceof BigInteger && fldOther.getObject() instanceof BigInteger) { // caso especial BigInteger
        equal &= fldThis.getBigInteger().compareTo(fldOther.getBigInteger()) == 0;

            } else if (fldThis.getObject() instanceof Date && fldOther.getObject() instanceof Date) {
                equal &= fldThis.getDate().equals(fldOther.getDate());

      } else { // caso comum
        String strThis = fldThis.getString();
        String strOther = fldOther.getString();
        if (strThis == null && strOther != null) return false;
        if (strThis != null && strOther == null) return false;
        if (strThis != null && strOther != null) {
          equal &= strThis.equals(strOther);
        }
View Full Code Here


  public String toCSV (String separator) throws Exception {
    List fields = record.getFields();
    StringBuffer buffer = new StringBuffer(fields.size()*16);
    for (int i = 0; i < fields.size(); i++) {
      Field field = (Field) fields.get(i);
      if (i > 0) buffer.append(separator);
      buffer.append(field.getString());
    }
    return buffer.toString();
  }
View Full Code Here

  public void fromCSV (String csv, String separator) {
    List fields = record.getFields();
    StringTokenizer st = new StringTokenizer(csv, separator);
    for (int i = 0; i < fields.size(); i++) {
      Field field = (Field) fields.get(i);
      String value = st.nextToken();
      setValue(field.getName(), value);
    }
  }
View Full Code Here

TOP

Related Classes of pt.opensoft.dbaccess.Field

Copyright © 2018 www.massapicom. 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.