org.boon.Boon.jstl()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(79)

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

Boon.jstl介绍

[英]Creates JSTL/JSP style template results from string template and context Facade over boon template system.
[中]通过boon模板系统上的字符串模板和上下文外观创建JSTL/JSP样式的模板结果。

代码示例

代码示例来源:origin: boonproject/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: boonproject/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: io.fastjson/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: boonproject/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

代码示例来源:origin: boonproject/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

代码示例来源:origin: io.fastjson/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(Path path, Object context) {
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

代码示例来源:origin: boonproject/boon

/**
 * Like puts, but prints out a whole slew of objects on the same
 * line using the template if the message is a character sequence.
 * Uses JSTL style templates.
 *
 * @param messages objects you want to print on the same line.
 */
public static void putc(Object context, Object... messages) {
  for (Object message : messages) {
    if (message instanceof CharSequence) {
      String transformedMessage =
          jstl(message.toString(), context);
      print(message);
    } else {
      print(message);
    }
    print(' ');
  }
  println();
}

代码示例来源:origin: boonproject/boon

/**
 * Like puts, but prints out a whole slew of objects on the same
 * line using the template if the message is a character sequence.
 * Uses JSTL style templates.
 *
 * @param messages objects you want to print on the same line.
 */
public static void putc(Object context, Object... messages) {
  for (Object message : messages) {
    if (message instanceof CharSequence) {
      String transformedMessage =
          jstl(message.toString(), context);
      print(message);
    } else {
      print(message);
    }
    print(' ');
  }
  println();
}

代码示例来源:origin: io.fastjson/boon

/**
 * Like puts, but prints out a whole slew of objects on the same
 * line using the template if the message is a character sequence.
 * Uses JSTL style templates.
 *
 * @param messages objects you want to print on the same line.
 */
public static void putc(Object context, Object... messages) {
  for (Object message : messages) {
    if (message instanceof CharSequence) {
      String transformedMessage =
          jstl(message.toString(), context);
      print(message);
    } else {
      print(message);
    }
    print(' ');
  }
  println();
}

代码示例来源:origin: boonproject/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template.
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: boonproject/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template.
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: io.fastjson/boon

/**
 * Load a resource and apply the given template against it.
 * If file resource is not found, tries to load the resource from classpath.
 * Uses JSTL style template.
 *
 * @param path    path to resource
 * @param context context that the template uses
 * @return the resource as a string
 */
public static String resourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
  }
  return str;
}

代码示例来源:origin: boonproject/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system first and then classpath.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

代码示例来源:origin: boonproject/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system first and then classpath.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

代码示例来源:origin: io.fastjson/boon

/**
 * <p>
 * Load JSON object as resource but first applies the template to the JSON file.
 * LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
 * </p>
 * Looks in file system first and then classpath.
 *
 * @param path path to resource
 * @return JSON object loaded as resource
 */
public static Object jsonResourceFromTemplate(String path, Object context) {
  if (!IO.exists(IO.path(path))) {
    path = add("classpath:/", path);
  }
  String str = IO.read(path);
  if (str != null) {
    str = Boon.jstl(str, context);
    return fromJson(str);
  }
  return null;
}

相关文章