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


Java EValidity类代码示例

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


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

示例1: _validateJson

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * Validate a JSON without building the tree in memory.
 *
 * @param aReader
 *        The reader to read from. Should be buffered. May not be
 *        <code>null</code>.
 * @return {@link EValidity#VALID} if the JSON is valid,
 *         {@link EValidity#INVALID} otherwise.
 */
@Nonnull
private static EValidity _validateJson (@Nonnull @WillClose final Reader aReader)
{
  // Force silent parsing :)
  final ESuccess eSuccess = parseJson (aReader,
                                       new DoNothingJsonParserHandler (),
                                       (IJsonParserCustomizeCallback) null,
                                       ex -> {});
  return EValidity.valueOf (eSuccess.isSuccess ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:20,代码来源:JsonReader.java

示例2: internalCheckParentDirectoryExistanceAndAccess

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@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,代码行数:32,代码来源:FileHelper.java

示例3: validateMessage

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * 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,代码行数:19,代码来源:UPCA.java

示例4: validateMessage

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * 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,代码行数:19,代码来源:EAN13.java

示例5: validateMessage

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * 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,代码行数:22,代码来源:UPCE.java

示例6: validateMessage

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * 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,代码行数:19,代码来源:AbstractUPCEAN.java

示例7: validateMessage

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * 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,代码行数:19,代码来源:EAN8.java

示例8: getSchematronValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@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,代码行数:9,代码来源:SchematronXSLTValidatorDefault.java

示例9: getSchematronValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@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,代码行数:9,代码来源:SchematronXSLTValidatorFailedAssertOnly.java

示例10: getSchematronValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@Nonnull
public EValidity getSchematronValidity (@Nonnull final Node aXMLNode,
                                        @Nullable final String sBaseURI) throws Exception
{
  ValueEnforcer.notNull (aXMLNode, "XMLNode");

  // We don't have a short circuit here - apply the full validation
  final SchematronOutputType aSO = applySchematronValidationToSVRL (aXMLNode, sBaseURI);
  if (aSO == null)
    return EValidity.INVALID;

  // And now filter all elements that make the passed source invalid
  return m_aXSLTValidator.getSchematronValidity (aSO);
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:15,代码来源:AbstractSchematronXSLTBasedResource.java

示例11: onFailedAssert

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@Override
@Nonnull
public EContinue onFailedAssert (@Nonnull final PSAssertReport aAssertReport,
                                 @Nonnull final String sTestExpression,
                                 @Nonnull final Node aRuleMatchingNode,
                                 final int nNodeIndex,
                                 @Nullable final Object aContext)
{
  m_eValidity = EValidity.INVALID;
  return EContinue.BREAK;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:12,代码来源:PSValidationHandlerBreakOnFirstError.java

示例12: onSuccessfulReport

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@Override
@Nonnull
public EContinue onSuccessfulReport (@Nonnull final PSAssertReport aAssertReport,
                                     @Nonnull final String sTestExpression,
                                     @Nonnull final Node aRuleMatchingNode,
                                     final int nNodeIndex,
                                     @Nullable final Object aContext)
{
  m_eValidity = EValidity.INVALID;
  return EContinue.BREAK;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:12,代码来源:PSValidationHandlerBreakOnFirstError.java

示例13: getValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * @return The validity of the XML file. {@link EValidity#VALID} if no failed
 *         assertion and no successful report occurred,
 *         {@link EValidity#INVALID} otherwise.
 */

@Override
@Nonnull
public EValidity getValidity ()
{
  return m_eValidity;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:13,代码来源:PSValidationHandlerBreakOnFirstError.java

示例14: getValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
/**
 * @return The validity of the XML file. {@link EValidity#VALID} if no failed
 *         assertion and no successful report occurred,
 *         {@link EValidity#INVALID} otherwise.
 */
@Override
@Nonnull
public EValidity getValidity ()
{
  return m_eValidity;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:12,代码来源:PSValidationHandlerBreakOnFirstFailedAssert.java

示例15: getSchematronValidity

import com.helger.commons.state.EValidity; //导入依赖的package包/类
@Nonnull
public EValidity getSchematronValidity (@Nonnull final Node aXMLNode,
                                        @Nullable final String sBaseURI) throws Exception
{
  ValueEnforcer.notNull (aXMLNode, "XMLNode");

  if (!isValidSchematron ())
    return EValidity.INVALID;

  return getOrCreateBoundSchema ().validatePartially (aXMLNode, sBaseURI);
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:12,代码来源:SchematronResourcePure.java


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