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