Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.BeanMap$Entry


  }

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
View Full Code Here


    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

    log("doPut " + uri);
    if ("/".equals(uri.getPath())) {
      log("create bucket");
      bucket = true;
    } else {
      Entry e = new Entry(key(uri));
      e.setLastModified(new Date());
      e.setSize(req.getContentLength());
      e.setOwner(new Owner("id", "name"));
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ServletInputStream is = req.getInputStream();
      byte b[] = new byte[128];
      while (true) {
        int len = is.read(b);
View Full Code Here

   *            忽略数字和字符串的默认值
   * @return
   */
  @SuppressWarnings("unchecked")
  public static boolean isEmpty(Entity<?> entity, boolean ignoreDefault) {
    BeanMap map = new BeanMap(entity);
    List<String> attList = CollectUtils.newArrayList();
    attList.addAll(map.keySet());
    attList.remove("class");
    try {
      for (final String attr : attList) {
        if (!PropertyUtils.isWriteable(entity, attr)) {
          continue;
        }
        Object value = map.get(attr);
        if (null == value) {
          continue;
        }
        if (ignoreDefault) {
          if (value instanceof Number) {
View Full Code Here

  @SuppressWarnings("rawtypes")
  public static List<Criterion> getEntityCriterions(String nestedName, Object entity,
      String[] excludePropertes, MatchMode mode, boolean ignoreZero) {
    if (null == entity) { return Collections.emptyList(); }
    List<Criterion> criterions = CollectUtils.newArrayList();
    BeanMap map = new BeanMap(entity);
    Set keySet = map.keySet();
    Collection properties = null;
    if (null == excludePropertes) {
      List proList = CollectUtils.newArrayList();
      proList.addAll(keySet);
      properties = proList;
    } else {
      properties = CollectionUtils.subtract(keySet, Arrays.asList(excludePropertes));
    }
    properties.remove("class");

    for (Iterator iter = properties.iterator(); iter.hasNext();) {
      String propertyName = (String) iter.next();
      if (!PropertyUtils.isWriteable(entity, propertyName)) {
        continue;
      }
      Object value = map.get(propertyName);
      addCriterion(nestedName, entity, excludePropertes, propertyName, value, criterions, mode,
          ignoreZero);
    }
    return criterions;
  }
View Full Code Here

    return criterions;
  }

  public static List<Criterion> getEqCriterions(Object entity, String[] properties) {
    List<Criterion> criterions = CollectUtils.newArrayList();
    BeanMap map = new BeanMap(entity);
    for (int i = 0; i < properties.length; i++) {
      criterions.add(Restrictions.eq(properties[i], map.get(properties[i])));
    }
    return criterions;
  }
View Full Code Here

    }
    return criterions;
  }

  public static List<Criterion> getForeignerCriterions(Object entity) {
    BeanMap map = new BeanMap(entity);
    return getForeignerCriterions(entity, map.keySet());
  }
View Full Code Here

    return getForeignerCriterions(entity, map.keySet());
  }

  public static List<Criterion> getForeignerCriterions(Object entity, Collection<String> properties) {
    List<Criterion> criterions = CollectUtils.newArrayList();
    BeanMap map = new BeanMap(entity);
    for (Iterator<String> iter = properties.iterator(); iter.hasNext();) {
      String propertyName = iter.next();
      Object foreigner = map.get(propertyName);
      if (foreigner instanceof Entity) {
        BeanMap foreignerMap = new BeanMap(foreigner);
        Object foreignKey = foreignerMap.get("id");
        // 该值不能为空,而且要么不是String类型,要么是不空String类型变量.
        if (ValidEntityKeyPredicate.getInstance().evaluate(foreignKey)) {
          // 在查询中添加该键值.
          criterions.add(Restrictions.eq(propertyName + ".id", foreignKey));
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.BeanMap$Entry

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.