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


Java EValidity.VALID属性代码示例

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


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

示例1: internalCheckParentDirectoryExistanceAndAccess

@Nonnull
static EValidity internalCheckParentDirectoryExistanceAndAccess (@Nonnull final File aFile)
{
  try
  {
    ensureParentDirectoryIsPresent (aFile);
  }
  catch (final IllegalStateException ex)
  {
    // Happens e.g. when the parent directory is " "
    s_aLogger.warn ("Failed to create parent directory of '" + aFile + "'", ex);
    return EValidity.INVALID;
  }

  // Check if parent directory is writable, to avoid catching the
  // FileNotFoundException with "permission denied" afterwards
  final File aParentDir = aFile.getParentFile ();
  if (aParentDir != null && !aParentDir.canWrite ())
  {
    s_aLogger.warn ("Parent directory '" +
                    aParentDir +
                    "' of '" +
                    aFile +
                    "' is not writable for current user '" +
                    SystemProperties.getUserName () +
                    "'");
    return EValidity.INVALID;
  }

  return EValidity.VALID;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:31,代码来源:FileHelper.java

示例2: validateMessage

/**
 * Validates a UPC-A message. The method throws IllegalArgumentExceptions if
 * an invalid message is passed.
 *
 * @param sMsg
 *        the message to validate
 * @return {@link EValidity#VALID} if the msg is valid,
 *         {@link EValidity#INVALID} otherwise.
 */
@Nonnull
public static EValidity validateMessage (@Nullable final String sMsg)
{
  final int nLen = StringHelper.getLength (sMsg);
  if (nLen >= 11 && nLen <= 12)
    if (AbstractUPCEAN.validateMessage (sMsg).isValid ())
      return EValidity.VALID;
  return EValidity.INVALID;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:18,代码来源:UPCA.java

示例3: validateMessage

/**
 * Validates a EAN-13 message. The method throws IllegalArgumentExceptions if
 * an invalid message is passed.
 *
 * @param sMsg
 *        the message to validate
 * @return {@link EValidity#VALID} if the msg is valid,
 *         {@link EValidity#INVALID} otherwise.
 */
@Nonnull
public static EValidity validateMessage (@Nullable final String sMsg)
{
  final int nLen = StringHelper.getLength (sMsg);
  if (nLen >= 12 && nLen <= 13)
    if (AbstractUPCEAN.validateMessage (sMsg).isValid ())
      return EValidity.VALID;
  return EValidity.INVALID;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:18,代码来源:EAN13.java

示例4: validateMessage

/**
 * Validates an UPC-E message. The message can also be UPC-A in which case the
 * message is compacted to a UPC-E message if possible. If it's not possible
 * an IllegalArgumentException is thrown
 *
 * @param sMsg
 *        the message to validate
 * @return {@link EValidity}
 */
@Nonnull
public static EValidity validateMessage (@Nullable final String sMsg)
{
  final int nLen = StringHelper.getLength (sMsg);
  if (nLen >= 7 && nLen <= 8)
  {
    final byte nNumberSystem = _extractNumberSystem (sMsg);
    if (nNumberSystem >= 0 && nNumberSystem <= 1)
      return EValidity.VALID;
  }
  return EValidity.INVALID;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:21,代码来源:UPCE.java

示例5: validateMessage

/**
 * Validates a UPC/EAN/GTIN/GLN message.
 *
 * @param aChars
 *        the chars to validate
 * @return {@link EValidity#VALID} if the msg is valid,
 *         {@link EValidity#INVALID} otherwise.
 */
@Nonnull
protected static EValidity validateMessage (@Nonnull final char [] aChars)
{
  ValueEnforcer.notNull (aChars, "Chars");

  for (final char c : aChars)
    if (c < '0' || c > '9')
      return EValidity.INVALID;
  return EValidity.VALID;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:18,代码来源:AbstractUPCEAN.java

示例6: validateMessage

/**
 * Validates a EAN-8 message. The method throws IllegalArgumentExceptions if
 * an invalid message is passed.
 *
 * @param sMsg
 *        the message to validate
 * @return {@link EValidity#VALID} if the msg is valid,
 *         {@link EValidity#INVALID} otherwise.
 */
@Nonnull
public static EValidity validateMessage (@Nullable final String sMsg)
{
  final int nLen = StringHelper.getLength (sMsg);
  if (nLen >= 7 && nLen <= 8)
    if (AbstractUPCEAN.validateMessage (sMsg).isValid ())
      return EValidity.VALID;
  return EValidity.INVALID;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:18,代码来源:EAN8.java

示例7: getSchematronValidity

@Nonnull
public EValidity getSchematronValidity (@Nonnull final SchematronOutputType aSO)
{
  for (final Object aObj : aSO.getActivePatternAndFiredRuleAndFailedAssert ())
    if (aObj instanceof FailedAssert || aObj instanceof SuccessfulReport)
      return EValidity.INVALID;
  return EValidity.VALID;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:8,代码来源:SchematronXSLTValidatorDefault.java

示例8: getSchematronValidity

@Nonnull
public EValidity getSchematronValidity (@Nonnull final SchematronOutputType aSO)
{
  for (final Object aObj : aSO.getActivePatternAndFiredRuleAndFailedAssert ())
    if (aObj instanceof FailedAssert)
      return EValidity.INVALID;
  return EValidity.VALID;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:8,代码来源:SchematronXSLTValidatorFailedAssertOnly.java


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