Ejemplo n.º 1
0
  /** Converts method type short names into names. */
  protected String[] convertTypeNames(Method actionClassMethod) {
    Class[] types = actionClassMethod.getParameterTypes();

    String[] names = new String[types.length];

    for (int i = 0; i < types.length; i++) {
      Class type = types[i];

      names[i] = StringUtil.uncapitalize(type.getSimpleName());
    }

    return names;
  }
Ejemplo n.º 2
0
  @Override
  public void process(StringBuilder out) {
    if (isPreviousChunkOfType(CHUNK_TABLE)) {
      appendMissingSpace(out);
    }

    DbEntityDescriptor ded =
        tableRef != null ? lookupTableRef(tableRef) : lookupType(resolveClass(data));

    out.append(SET);

    DbEntityColumnDescriptor[] decList = ded.getColumnDescriptors();
    String typeName = StringUtil.uncapitalize(ded.getEntityName());
    // String table = resolveTable(tableRef, ded);

    int size = 0;
    for (DbEntityColumnDescriptor dec : decList) {
      String property = dec.getPropertyName();
      Object value = BeanUtil.getDeclaredProperty(data, property);

      if (includeColumns == COLS_ONLY_EXISTING) {
        if (DbOomUtil.isEmptyColumnValue(dec, value)) {
          continue;
        }
      }

      if (size > 0) {
        out.append(',').append(' ');
      }

      size++;

      // do not add table reference in set
      // as only one table can be updated
      // also, Postgress database does not allow it (see #JODD-21)

      // out.append(table).append('.');

      out.append(dec.getColumnName()).append('=');

      String propertyName = typeName + '.' + property;
      defineParameter(out, propertyName, value, dec);
    }
    if (size > 0) {
      out.append(' ');
    }
  }