当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionClass.FORMATTING属性代码示例

本文整理汇总了Java中com.vangav.backend.exceptions.VangavException.ExceptionClass.FORMATTING属性的典型用法代码示例。如果您正苦于以下问题:Java ExceptionClass.FORMATTING属性的具体用法?Java ExceptionClass.FORMATTING怎么用?Java ExceptionClass.FORMATTING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.vangav.backend.exceptions.VangavException.ExceptionClass的用法示例。


在下文中一共展示了ExceptionClass.FORMATTING属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseDate

/**
 * parseDate
 * @param dateString
 * @return A Date Object reflecting the param's String date
 * @throws Exception
 */
public static Date parseDate (String dateString) throws Exception {
  
  ArgumentsInl.checkNotEmpty(
    "Date String",
    dateString,
    ExceptionType.CODE_EXCEPTION);
  
  for (DateFormat dateFormat : kDateFormats) {
   
    try {
      
      return (Date)dateFormat.parse(dateString);
      
    } catch (Exception e) {
      
    }
  }
  
  throw new CodeException(
    151,
    4,
    "Date ["
      + dateString
      + "] doesn't follow any of the supported formats.",
    ExceptionClass.FORMATTING);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:32,代码来源:ParamParsersInl.java

示例2: verifyName

/**
 * verifyName
 * throws an exception if name is:
 * - null
 * - empty
 * - longer than 32 characters
 * - starts with something other than a lower case letter, an upper case
 *     letter or an under score
 * - has characters other than lower case letters, upper case letters,
 *     underscores and digits
 * @param name
 * @throws Exception
 */
public static void verifyName (String name) throws Exception {
  
  ArgumentsInl.checkNotEmpty(
    "Cassandra CQL name",
    name,
    ExceptionType.CODE_EXCEPTION);
  
  if (name.length() > 32) {
    
    throw new CodeException(
      23,
      1,
      "a name in Cassandra CQL must have at least one char and not more than"
      + "32 chars, current name["
      + name
      + "] has ["
      + name.length()
      + "] chars",
      ExceptionClass.FORMATTING);
  }
  
  if (CharVerifierInl.isOneOfChar(
        name.charAt(0),
        CharVerifierInl.CharType.LOWER_CASE,
        CharVerifierInl.CharType.UPPER_CASE,
        CharVerifierInl.CharType.UNDER_SCORE) == false) {
    
    throw new CodeException(
      23,
      2,
      "a name in Cassandra CQL must start with a lower case letter, "
      + "an upper case letter or an under score; invalid name ["
      + name
      + "] starts with ["
      + name.charAt(0)
      + "]",
      ExceptionClass.FORMATTING);
  }
  
  for (int i = 1; i < name.length(); i ++) {
    
    if (CharVerifierInl.isOneOfChar(
          name.charAt(i),
          CharVerifierInl.CharType.LOWER_CASE,
          CharVerifierInl.CharType.UPPER_CASE,
          CharVerifierInl.CharType.UNDER_SCORE,
          CharVerifierInl.CharType.DIGIT) == false) {
      
      throw new CodeException(
        23,
        3,
        "a name in Cassandra CQL can only contain a lower case letter, "
        + "an upper case letter, an under score or a digit; invalid name ["
        + name
        + "] has ["
        + name.charAt(i)
        + "]",
        ExceptionClass.FORMATTING);
    }
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:74,代码来源:CassandraCqlVerifierInl.java

示例3: verifyIdentifier

/**
 * verifyIdentifier
 * throws an exception if java code identifier is invalid
 * @param identifierName
 * @param identifier
 * @throws Exception
 */
public static void verifyIdentifier (
  String identifierName,
  String identifier) throws Exception {

  ArgumentsInl.checkNotEmpty(
    "identifier ["
      + identifier
      + "]",
    identifier,
    ExceptionType.CODE_EXCEPTION);
    
  if (CharVerifierInl.isOneOfChar(
        identifier.charAt(0),
        CharVerifierInl.CharType.LOWER_CASE,
        CharVerifierInl.CharType.UPPER_CASE,
        CharVerifierInl.CharType.UNDER_SCORE) == false) {
    
    throw new CodeException(
      23,
      4,
      "["
      + identifierName
      + "] "
      + "Java code identifier must start with a letter or an underscore ["
      + identifier
      + "]",
      ExceptionClass.FORMATTING);
  }
  
  for (int i = 1; i < identifier.length(); i ++) {
    
    if (CharVerifierInl.isOneOfChar(
        identifier.charAt(0),
        CharVerifierInl.CharType.LOWER_CASE,
        CharVerifierInl.CharType.UPPER_CASE,
        CharVerifierInl.CharType.UNDER_SCORE,
        CharVerifierInl.CharType.DIGIT) == false) {
      
      throw new CodeException(
        23,
        5,
        "["
        + identifierName
        + "] "
        + "Java code identifier must contain only letters, underscores and "
        + "digits ["
        + identifier
        + "]",
        ExceptionClass.FORMATTING);
    }
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:59,代码来源:JavaCodeVerifierInl.java

示例4: verifyPackageName

/**
 * verifyPackageName
 * throws an exception if param packageName doesn't have a valid format
 * @param packageName
 * @throws Exception
 */
public static void verifyPackageName (
  String packageName) throws Exception {

  ArgumentsInl.checkNotEmpty(
    "package name",
    packageName,
    ExceptionType.CODE_EXCEPTION);
  
  for (int i = 0; i < packageName.length(); i ++) {
    
    if (CharVerifierInl.isOneOfChar(
        packageName.charAt(i),
        CharVerifierInl.CharType.LOWER_CASE,
        CharVerifierInl.CharType.UPPER_CASE,
        CharVerifierInl.CharType.UNDER_SCORE) == false) {
      
      throw new CodeException(
        23,
        6,
        "invalid java package name ["
        + packageName
        + "]",
        ExceptionClass.FORMATTING);
    }
    
    for (int j = i; j < (packageName.length() - 1); j ++, i ++) {
      
      if (CharVerifierInl.isOneOfChar(
          packageName.charAt(j),
          CharVerifierInl.CharType.LOWER_CASE,
          CharVerifierInl.CharType.UPPER_CASE,
          CharVerifierInl.CharType.UNDER_SCORE,
          CharVerifierInl.CharType.DIGIT,
          CharVerifierInl.CharType.DOT) == false) {
        
        throw new CodeException(
          23,
          7,
          "invalid java package name ["
          + packageName
          + "]",
          ExceptionClass.FORMATTING);
      }

      if (CharVerifierInl.isDotChar(packageName.charAt(j) ) == true) {
        
        break;
      }
    }
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:57,代码来源:JavaCodeVerifierInl.java


注:本文中的com.vangav.backend.exceptions.VangavException.ExceptionClass.FORMATTING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。