org.apache.juneau.json.JsonSerializer.toStringObject()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(174)

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

JsonSerializer.toStringObject介绍

暂无

代码示例

代码示例来源:origin: apache/juneau

  1. /**
  2. * Same as {@link #log(Level, String, Object...)} excepts runs the arguments through {@link JsonSerializer#DEFAULT_READABLE}.
  3. *
  4. * <p>
  5. * Serialization of arguments do not occur if message is not logged, so it's safe to use this method from within
  6. * debug log statements.
  7. *
  8. * <h5 class='section'>Example:</h5>
  9. * <p class='bcode w800'>
  10. * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>, myPojo);
  11. * </p>
  12. *
  13. * @param level The log level.
  14. * @param msg The message to log.
  15. * @param args Optional {@link MessageFormat}-style arguments.
  16. */
  17. @Override /* RestLogger */
  18. public void logObjects(Level level, String msg, Object...args) {
  19. for (int i = 0; i < args.length; i++)
  20. args[i] = SimpleJsonSerializer.DEFAULT_READABLE.toStringObject(args[i]);
  21. log(level, null, msg, args);
  22. }

代码示例来源:origin: org.apache.juneau/juneau-server

  1. /**
  2. * Same as {@link #log(Level, String, Object...)} excepts runs the
  3. * arguments through {@link JsonSerializer#DEFAULT_LAX_READABLE}.
  4. * <p>
  5. * Serialization of arguments do not occur if message is not logged, so
  6. * it's safe to use this method from within debug log statements.
  7. * </p>
  8. *
  9. * <h6 class='topic'>Example:</h6>
  10. * <p class='bcode'>
  11. * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>, myPojo);
  12. * </p>
  13. *
  14. * @param level The log level.
  15. * @param msg The message to log.
  16. * @param args {@link MessageFormat} style arguments in the message.
  17. */
  18. protected void logObjects(Level level, String msg, Object...args) {
  19. for (int i = 0; i < args.length; i++)
  20. args[i] = JsonSerializer.DEFAULT_LAX_READABLE.toStringObject(args[i]);
  21. log(level, null, msg, args);
  22. }

代码示例来源:origin: org.apache.juneau/juneau-rest-server

  1. /**
  2. * Same as {@link #log(Level, String, Object...)} excepts runs the arguments through {@link JsonSerializer#DEFAULT_READABLE}.
  3. *
  4. * <p>
  5. * Serialization of arguments do not occur if message is not logged, so it's safe to use this method from within
  6. * debug log statements.
  7. *
  8. * <h5 class='section'>Example:</h5>
  9. * <p class='bcode w800'>
  10. * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>, myPojo);
  11. * </p>
  12. *
  13. * @param level The log level.
  14. * @param msg The message to log.
  15. * @param args Optional {@link MessageFormat}-style arguments.
  16. */
  17. @Override /* RestLogger */
  18. public void logObjects(Level level, String msg, Object...args) {
  19. for (int i = 0; i < args.length; i++)
  20. args[i] = SimpleJsonSerializer.DEFAULT_READABLE.toStringObject(args[i]);
  21. log(level, null, msg, args);
  22. }

代码示例来源:origin: apache/juneau

  1. /**
  2. * Same as {@link #log(Level, String, Object...)} excepts runs the arguments through {@link JsonSerializer#DEFAULT_READABLE}.
  3. *
  4. * <p>
  5. * Serialization of arguments do not occur if message is not logged, so it's safe to use this method from within
  6. * debug log statements.
  7. *
  8. * <h5 class='section'>Example:</h5>
  9. * <p class='bcode w800'>
  10. * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>, myPojo);
  11. * </p>
  12. *
  13. * @param level The log level.
  14. * @param msg The message to log.
  15. * @param args Optional {@link MessageFormat}-style arguments.
  16. */
  17. @Override /* RestLogger */
  18. public void logObjects(Level level, String msg, Object...args) {
  19. for (int i = 0; i < args.length; i++)
  20. args[i] = SimpleJsonSerializer.DEFAULT_READABLE.toStringObject(args[i]);
  21. log(level, null, msg, args);
  22. }

相关文章