jodd.bean.BeanUtil.setDeclaredPropertyForcedSilent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中jodd.bean.BeanUtil.setDeclaredPropertyForcedSilent()方法的一些代码示例,展示了BeanUtil.setDeclaredPropertyForcedSilent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanUtil.setDeclaredPropertyForcedSilent()方法的具体详情如下:
包路径:jodd.bean.BeanUtil
类名称:BeanUtil
方法名:setDeclaredPropertyForcedSilent

BeanUtil.setDeclaredPropertyForcedSilent介绍

暂无

代码示例

代码示例来源:origin: org.jodd/jodd-wot

/**
 * Sets target bean property, optionally creates instance if doesn't exist.
 */
protected void setTargetProperty(Object target, String name, Object attrValue, boolean create) {
  if (create == true) {
    BeanUtil.setDeclaredPropertyForcedSilent(target, name, attrValue);
  } else {
    BeanUtil.setDeclaredPropertySilent(target, name, attrValue);
  }
}

代码示例来源:origin: com.threewks.thundr/thundr-gae

@Override
  public T from(Map<String, Object> from) {
    try {
      T instance = type.newInstance();
      for (Map.Entry<String, Object> entry : from.entrySet()) {
        String field = metadata.getDecodedFieldName(entry.getKey());
        BeanUtil.setDeclaredPropertyForcedSilent(instance, field, entry.getValue());
      }
      return instance;
    } catch (Exception e) {
      throw new SearchException(e, "Failed to create a new instance of %s for search results: %s", type.getName(), e.getMessage());
    }
  }
});

代码示例来源:origin: org.jodd/jodd-wot

public void inject(Object target, ActionRequest actionRequest) {
    ActionConfig config = actionRequest.getActionConfig();
    ActionConfigSet set = config.getActionConfigSet();
    if (set.actionPathMacros== null) {
      return;
    }

    String[] actionPathChunks = actionRequest.getActionPathChunks();
    for (int i = 0; i < set.actionPathMacros.length; i++) {
      ActionConfigSet.PathMacro macro = set.actionPathMacros[i];
      int ndx = macro.ndx;
      String name = macro.name;
      String value = actionPathChunks[ndx];

      int leftLen = macro.left.length();
      int rightLen = macro.right.length();

      if (leftLen + rightLen > 0) {
        // there is additional prefix and/or suffix
        value = value.substring(leftLen, value.length() - rightLen);
      }
      BeanUtil.setDeclaredPropertyForcedSilent(target, name, value);
    }
  }
}

相关文章