Package se.unlogic.standardutils.dao

Examples of se.unlogic.standardutils.dao.ResultSetField


        Method resultSetColumnIndexMethod = ResultSetMethods.getColumnIndexMethod(field.getType());

        if(!StringUtils.isEmpty(annotation.columnName())){

          this.resultSetFieldMap.put(field,new ResultSetField(field,resultSetColumnNameMethod,resultSetColumnIndexMethod,annotation.columnName(),typePopulator));

        }else{

          this.resultSetFieldMap.put(field,new ResultSetField(field,resultSetColumnNameMethod,resultSetColumnIndexMethod,field.getName(),typePopulator));
        }
      }
    }

    if(this.resultSetFieldMap.isEmpty()){
View Full Code Here


    return null;
  }

  public T populate(ResultSet rs) throws SQLException, BeanResultSetPopulationException {

    ResultSetField currentField = null;

    try {
      T bean = beanClass.newInstance();

      for(ResultSetField resultSetField : this.resultSetFieldMap.values()){

        currentField = resultSetField;

        if(currentField.getResultSetColumnNameMethod() != null){

          Object value = resultSetField.getResultSetColumnNameMethod().invoke(rs, resultSetField.getAlias());

          if(rs.wasNull() && !resultSetField.getBeanField().getType().isPrimitive()){

            resultSetField.getBeanField().set(bean, null);

          }else{

            resultSetField.getBeanField().set(bean, value);
          }

        }else{

          String value = rs.getString(currentField.getAlias());

          if(value != null || currentField.getBeanStringPopulator().getType().isPrimitive()){

            resultSetField.getBeanField().set(bean, currentField.getBeanStringPopulator().getValue(value));
          }else{
            resultSetField.getBeanField().set(bean, null);
          }
        }
      }
View Full Code Here

        Method resultSetColumnIndexMethod = ResultSetMethods.getColumnIndexMethod(field.getType());

        if(!StringUtils.isEmpty(annotation.columnName())){

          this.resultSetFieldMap.put(field,new ResultSetField(field,resultSetColumnNameMethod,resultSetColumnIndexMethod,annotation.columnName(),typePopulator));

        }else{

          this.resultSetFieldMap.put(field,new ResultSetField(field,resultSetColumnNameMethod,resultSetColumnIndexMethod,field.getName(),typePopulator));
        }
      }
    }

    if(this.resultSetFieldMap.isEmpty()){
View Full Code Here

    return null;
  }

  public T populate(ResultSet rs) throws SQLException, BeanResultSetPopulationException {

    ResultSetField currentField = null;

    try {
      T bean = beanClass.newInstance();

      for(ResultSetField resultSetField : this.resultSetFieldMap.values()){

        currentField = resultSetField;

        if(currentField.getResultSetColumnNameMethod() != null){

          Object value = resultSetField.getResultSetColumnNameMethod().invoke(rs, resultSetField.getAlias());

          if(rs.wasNull() && !resultSetField.getBeanField().getType().isPrimitive()){

            resultSetField.getBeanField().set(bean, null);

          }else{

            resultSetField.getBeanField().set(bean, value);
          }

        }else{

          String value = rs.getString(currentField.getAlias());

          if(value != null || currentField.getBeanStringPopulator().getType().isPrimitive()){

            resultSetField.getBeanField().set(bean, currentField.getBeanStringPopulator().getValue(value));
          }else{
            resultSetField.getBeanField().set(bean, null);
          }
        }
      }
View Full Code Here

TOP

Related Classes of se.unlogic.standardutils.dao.ResultSetField

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.