Package com.ibatis.common.beans

Examples of com.ibatis.common.beans.Probe


  private Object prepareDomParameterObject(ResultSet rs, ResultMapping mapping) throws SQLException {
    TypeHandlerFactory typeHandlerFactory = getDelegate().getTypeHandlerFactory();

    Document doc = newDocument("parameter");
    Probe probe = ProbeFactory.getProbe(doc);

    String complexName = mapping.getColumnName();

    TypeHandler stringTypeHandler = typeHandlerFactory.getTypeHandler(String.class);
    if (complexName.indexOf('=') > -1) {
      // old 1.x style multiple params
      StringTokenizer parser = new StringTokenizer(complexName, "{}=, ", false);
      while (parser.hasMoreTokens()) {
        String propName = parser.nextToken();
        String colName = parser.nextToken();
        Object propValue = stringTypeHandler.getResult(rs, colName);
        probe.setObject(doc, propName, propValue.toString());
      }
    } else {
      // single param
      Object propValue = stringTypeHandler.getResult(rs, complexName);
      probe.setObject(doc, "value", propValue.toString());
    }

    return doc;
  }
View Full Code Here


  public void initialize(Map properties) {
  }

  public Object[] getData(RequestScope request, ParameterMap parameterMap, Object parameterObject) {
    Probe probe = ProbeFactory.getProbe(parameterObject);

    ParameterMapping[] mappings = parameterMap.getParameterMappings();
    Object[] values = new Object[mappings.length];

    for (int i = 0; i < mappings.length; i++) {
      values[i] = probe.getObject(parameterObject, mappings[i].getPropertyName());
    }

    return values;
  }
View Full Code Here

      } catch (ParserConfigurationException e) {
        throw new SqlMapException("Error creating new Document for DOM result.  Cause: " + e, e);
      }
    }

    Probe probe = ProbeFactory.getProbe(resultObject);

    ResultMapping[] mappings = resultMap.getResultMappings();

    for (int i = 0; i < mappings.length; i++) {
      if (values[i] != null) {
        probe.setObject(resultObject, mappings[i].getPropertyName(), values[i]);
      }
    }

    return resultObject;
  }
View Full Code Here

    return resultObject;
  }

  public Object setData(RequestScope request, ParameterMap parameterMap, Object parameterObject, Object[] values) {
    Probe probe = ProbeFactory.getProbe(parameterObject);

    ParameterMapping[] mappings = parameterMap.getParameterMappings();

    for (int i = 0; i < mappings.length; i++) {
      if (values[i] != null) {
        if (mappings[i].isOutputAllowed()) {
          probe.setObject(parameterObject, mappings[i].getPropertyName(), values[i]);
        }
      }
    }

    return parameterObject;
View Full Code Here

          if (javaType == null) {
            javaType = DomTypeMarker.class;
          }
          columnValues[i] = getNestedSelectMappingValue(request, rs, mapping, javaType);
        } else {
          Probe p = ProbeFactory.getProbe(resultClass);
          Class type = p.getPropertyTypeForSetter(resultClass, mapping.getPropertyName());
          columnValues[i] = getNestedSelectMappingValue(request, rs, mapping, type);
        }
        foundData = foundData || columnValues[i] != null;
      } else if (mapping.getNestedResultMapName() == null) {
        columnValues[i] = getPrimitiveResultMappingValue(rs, mapping);
View Full Code Here

  private Object prepareDomParameterObject(ResultSet rs, BasicResultMapping mapping) throws SQLException {
    TypeHandlerFactory typeHandlerFactory = getDelegate().getTypeHandlerFactory();

    Document doc = newDocument("parameter");
    Probe probe = ProbeFactory.getProbe(doc);

    String complexName = mapping.getColumnName();

    TypeHandler stringTypeHandler = typeHandlerFactory.getTypeHandler(String.class);
    if (complexName.indexOf('=') > -1) {
      // old 1.x style multiple params
      StringTokenizer parser = new StringTokenizer(complexName, "{}=, ", false);
      while (parser.hasMoreTokens()) {
        String propName = parser.nextToken();
        String colName = parser.nextToken();
        Object propValue = stringTypeHandler.getResult(rs, colName);
        probe.setObject(doc, propName, propValue.toString());
      }
    } else {
      // single param
      Object propValue = stringTypeHandler.getResult(rs, complexName);
      probe.setObject(doc, "value", propValue.toString());
    }

    return doc;
  }
View Full Code Here

        String columnName = rsmd.getColumnLabel(i + 1);
        String upperColumnName = columnName.toUpperCase(java.util.Locale.ENGLISH);
        String matchedProp = (String) propertyMap.get(upperColumnName);
        Class type = null;
        if (matchedProp == null) {
          Probe p = ProbeFactory.getProbe(this.getResultClass());
          try {
            type = p.getPropertyTypeForSetter(this.getResultClass(), columnName);
          } catch (Exception e) {
            //TODO - add logging to this class?
          }
        } else {
          type = classInfo.getSetterType(matchedProp);
View Full Code Here

          if (javaType == null) {
            javaType = DomTypeMarker.class;
          }
          columnValues[i] = getNestedSelectMappingValue(statementScope, rs, mapping, javaType);
        } else {
          Probe p = ProbeFactory.getProbe(resultClass);
          Class type = p.getPropertyTypeForSetter(resultClass, mapping.getPropertyName());
          columnValues[i] = getNestedSelectMappingValue(statementScope, rs, mapping, type);
        }
        foundData = foundData || columnValues[i] != null;
      } else if (mapping.getNestedResultMapName() == null) {
        columnValues[i] = getPrimitiveResultMappingValue(rs, mapping);
View Full Code Here

  private Object prepareDomParameterObject(ResultSet rs, ResultMapping mapping) throws SQLException {
    TypeHandlerFactory typeHandlerFactory = getDelegate().getTypeHandlerFactory();

    Document doc = newDocument("parameter");
    Probe probe = ProbeFactory.getProbe(doc);

    String complexName = mapping.getColumnName();

    TypeHandler stringTypeHandler = typeHandlerFactory.getTypeHandler(String.class);
    if (complexName.indexOf('=') > -1) {
      // old 1.x style multiple params
      StringTokenizer parser = new StringTokenizer(complexName, "{}=, ", false);
      while (parser.hasMoreTokens()) {
        String propName = parser.nextToken();
        String colName = parser.nextToken();
        Object propValue = stringTypeHandler.getResult(rs, colName);
        probe.setObject(doc, propName, propValue.toString());
      }
    } else {
      // single param
      Object propValue = stringTypeHandler.getResult(rs, complexName);
      probe.setObject(doc, "value", propValue.toString());
    }

    return doc;
  }
View Full Code Here

        for (int j=0; j < writeables.size(); j++) {
          String writeable = (String)writeables.get(j);
          if (readables.contains(writeable)) {
            Class type = info.getGetterType(writeable);
            Object sample = getSampleFor(type);
            Probe probe = ProbeFactory.getProbe(object);
            probe.setObject(object, writeable, sample);
            assertEquals(sample,probe.getObject(object, writeable));
          }
        }
      }
    } catch(Exception e) {
      throw new RuntimeException("Error. ", e);
View Full Code Here

TOP

Related Classes of com.ibatis.common.beans.Probe

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.