org.apache.openjpa.kernel.Filters.clip()方法的使用及代码示例

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

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

Filters.clip介绍

[英]Removes the first and last string if they are the terminal sequence in the given string.
[中]删除第一个和最后一个字符串(如果它们是给定字符串中的终端序列)。

代码示例

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

/**
 * Parses the given string assuming it is a JDBC key expression. Extracts the 
 * data portion and based on the key, calls static java.sql.Date/Time/Timestamp.valueOf(String)
 * method to convert to a java.sql.Date/Time/Timestamp instance.
 */
public static Object parseJDBCTemporalSyntax(String s) {
  s = clip(s.trim(), "{", "}", true);
  if (s.startsWith("ts")) {
    return java.sql.Timestamp.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else if (s.startsWith("d")) {
    return java.sql.Date.valueOf(clip(s.substring(1).trim(), "'", "'", false));
  } else if (s.startsWith("t")) {
    return java.sql.Time.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Parses the given string assuming it is a JDBC key expression. Extracts the 
 * data portion and based on the key, calls static java.sql.Date/Time/Timestamp.valueOf(String)
 * method to convert to a java.sql.Date/Time/Timestamp instance.
 */
public static Object parseJDBCTemporalSyntax(String s) {
  s = clip(s.trim(), "{", "}", true);
  if (s.startsWith("ts")) {
    return java.sql.Timestamp.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else if (s.startsWith("d")) {
    return java.sql.Date.valueOf(clip(s.substring(1).trim(), "'", "'", false));
  } else if (s.startsWith("t")) {
    return java.sql.Time.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

/**
 * Parses the given string assuming it is a JDBC key expression. Extracts the 
 * data portion and based on the key, calls static java.sql.Date/Time/Timestamp.valueOf(String)
 * method to convert to a java.sql.Date/Time/Timestamp instance.
 */
public static Object parseJDBCTemporalSyntax(String s) {
  s = clip(s.trim(), "{", "}", true);
  if (s.startsWith("ts")) {
    return java.sql.Timestamp.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else if (s.startsWith("d")) {
    return java.sql.Date.valueOf(clip(s.substring(1).trim(), "'", "'", false));
  } else if (s.startsWith("t")) {
    return java.sql.Time.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

/**
 * Parses the given string assuming it is a JDBC key expression. Extracts the 
 * data portion and based on the key, calls static java.sql.Date/Time/Timestamp.valueOf(String)
 * method to convert to a java.sql.Date/Time/Timestamp instance.
 */
public static Object parseJDBCTemporalSyntax(String s) {
  s = clip(s.trim(), "{", "}", true);
  if (s.startsWith("ts")) {
    return java.sql.Timestamp.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else if (s.startsWith("d")) {
    return java.sql.Date.valueOf(clip(s.substring(1).trim(), "'", "'", false));
  } else if (s.startsWith("t")) {
    return java.sql.Time.valueOf(clip(s.substring(2).trim(), "'", "'", false));
  } else {
    return null;
  }
}

相关文章