本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}