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


Java IErrorLevel类代码示例

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


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

示例1: getErrorLevel

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
/**
 * Get the error level matching the passed JAXB severity.
 *
 * @param nSeverity
 *        The JAXB severity.
 * @return The matching {@link IErrorLevel}. Never <code>null</code>.
 */
@Nonnull
@OverrideOnDemand
protected IErrorLevel getErrorLevel (final int nSeverity)
{
  switch (nSeverity)
  {
    case ValidationEvent.WARNING:
      return EErrorLevel.WARN;
    case ValidationEvent.ERROR:
      return EErrorLevel.ERROR;
    case ValidationEvent.FATAL_ERROR:
      return EErrorLevel.FATAL_ERROR;
    default:
      s_aLogger.warn ("Unknown JAXB validation severity: " + nSeverity + "; defaulting to error");
      return EErrorLevel.ERROR;
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:AbstractValidationEventHandler.java

示例2: log

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
public static void log (@Nonnull final Logger aLogger,
                        @Nonnull final IErrorLevel eErrorLevel,
                        @Nonnull final String sMsg,
                        @Nullable final Throwable t)
{
  ValueEnforcer.notNull (aLogger, "Logger");
  ValueEnforcer.notNull (eErrorLevel, "ErrorLevel");
  ValueEnforcer.notNull (sMsg, "Message");

  if (eErrorLevel.isGE (EErrorLevel.ERROR))
    aLogger.error (sMsg, t);
  else
    if (eErrorLevel.isGE (EErrorLevel.WARN))
      aLogger.warn (sMsg, t);
    else
      if (eErrorLevel.isGE (EErrorLevel.INFO))
        aLogger.info (sMsg, t);
      else
        if (aLogger.isDebugEnabled ())
          aLogger.debug (sMsg, t);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:22,代码来源:LogHelper.java

示例3: handle

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Override
protected void handle (@Nullable final IReadableResource aRes,
                       @Nonnull final IErrorLevel aErrorLevel,
                       @Nullable final IPSElement aSourceElement,
                       @Nonnull final String sMessage,
                       @Nullable final Throwable t)
{
  final SingleErrorBuilder aBuilder = SingleError.builder ()
                                                 .setErrorLevel (aErrorLevel)
                                                 .setErrorLocation (aRes == null ? null
                                                                                 : new SimpleLocation (aRes.getResourceID ()))
                                                 .setErrorText (sMessage)
                                                 .setLinkedException (t);

  if (aSourceElement != null)
  {
    String sField = ClassHelper.getClassLocalName (aSourceElement);
    if (aSourceElement instanceof IPSHasID && ((IPSHasID) aSourceElement).hasID ())
      sField += " [ID=" + ((IPSHasID) aSourceElement).getID () + "]";
    aBuilder.setErrorFieldName (sField);
  }
  m_aErrorList.add (aBuilder.build ());
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:24,代码来源:AbstractCollectingPSErrorHandler.java

示例4: getErrorLevelFromFlag

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Nonnull
public IErrorLevel getErrorLevelFromFlag (@Nullable final String sFlag)
{
  if (sFlag == null)
    return DEFAULT_ERROR_LEVEL;

  if (sFlag.equalsIgnoreCase ("warning") || sFlag.equalsIgnoreCase ("warn"))
    return EErrorLevel.WARN;

  if (sFlag.equalsIgnoreCase ("error") || sFlag.equalsIgnoreCase ("err"))
    return EErrorLevel.ERROR;

  if (sFlag.equalsIgnoreCase ("fatal") ||
      sFlag.equalsIgnoreCase ("fatal_error") ||
      sFlag.equalsIgnoreCase ("fatalerror"))
    return EErrorLevel.FATAL_ERROR;

  throw new IllegalArgumentException ("Cannot convert the SVRL flag '" +
                                      sFlag +
                                      "' to an error level. Please extend the preceeding list!");
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:22,代码来源:DefaultSVRLErrorLevelDeterminator.java

示例5: getAllFailedAssertionsMoreOrEqualSevereThan

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
/**
 * Get a list of all failed assertions in a given schematron output, with an
 * error level equally or more severe than the passed error level.
 *
 * @param aSchematronOutput
 *        The schematron output to be used. May not be <code>null</code>.
 * @param aErrorLevel
 *        Minimum error level to be queried
 * @return A non-<code>null</code> list with all failed assertions.
 */
@Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLFailedAssert> getAllFailedAssertionsMoreOrEqualSevereThan (@Nonnull final SchematronOutputType aSchematronOutput,
                                                                                           @Nonnull final IErrorLevel aErrorLevel)
{
  final ICommonsList <SVRLFailedAssert> ret = new CommonsArrayList <> ();
  for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
    if (aObj instanceof FailedAssert)
    {
      final SVRLFailedAssert aFA = new SVRLFailedAssert ((FailedAssert) aObj);
      if (aFA.getFlag ().isGE (aErrorLevel))
        ret.add (aFA);
    }
  return ret;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:26,代码来源:SVRLHelper.java

示例6: getAllSuccessfulReportsMoreOrEqualSevereThan

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
/**
 * Get a list of all successful reports in a given schematron output, with an
 * error level equally or more severe than the passed error level.
 *
 * @param aSchematronOutput
 *        The schematron output to be used. May not be <code>null</code>.
 * @param aErrorLevel
 *        Minimum error level to be queried
 * @return A non-<code>null</code> list with all successful reports.
 */
@Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLSuccessfulReport> getAllSuccessfulReportsMoreOrEqualSevereThan (@Nonnull final SchematronOutputType aSchematronOutput,
                                                                                                @Nonnull final IErrorLevel aErrorLevel)
{
  final ICommonsList <SVRLSuccessfulReport> ret = new CommonsArrayList <> ();
  for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
    if (aObj instanceof SuccessfulReport)
    {
      final SVRLSuccessfulReport aFA = new SVRLSuccessfulReport ((SuccessfulReport) aObj);
      if (aFA.getFlag ().isGE (aErrorLevel))
        ret.add (aFA);
    }
  return ret;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:26,代码来源:SVRLHelper.java

示例7: handleEvent

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
public final boolean handleEvent (@Nonnull final ValidationEvent aEvent)
{
  final IErrorLevel aErrorLevel = getErrorLevel (aEvent.getSeverity ());
  final SingleErrorBuilder aErrBuilder = SingleError.builder ().setErrorLevel (aErrorLevel);

  final ValidationEventLocator aLocator = aEvent.getLocator ();
  aErrBuilder.setErrorLocation (new SimpleLocation (getLocationResourceID (aLocator),
                                                   aLocator != null ? aLocator.getLineNumber ()
                                                                    : ILocation.ILLEGAL_NUMBER,
                                                   aLocator != null ? aLocator.getColumnNumber ()
                                                                    : ILocation.ILLEGAL_NUMBER))
             .setErrorFieldName (getErrorFieldName (aLocator));

  // Message may be null in some cases (e.g. when a linked exception is
  // present), but is not allowed to be null!
  String sMsg = aEvent.getMessage ();
  if (sMsg == null)
  {
    if (aEvent.getLinkedException () != null)
    {
      sMsg = aEvent.getLinkedException ().getMessage ();
      if (sMsg == null)
        sMsg = "Exception";
    }
    else
    {
      // Does this ever happen????
      sMsg = "Validation event";
    }
  }
  aErrBuilder.setErrorText (sMsg).setLinkedException (aEvent.getLinkedException ());

  // call our callback
  onEvent (aErrBuilder.build ());

  // Continue processing?
  return continueProcessing (aErrorLevel);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:39,代码来源:AbstractValidationEventHandler.java

示例8: _buildError

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Nonnull
private static IError _buildError (@Nonnull final TransformerException ex,
                                   @Nonnull final IErrorLevel aErrorLevel,
                                   @Nonnull final IMultilingualText aErrorMsg)
{
  final ILocation aLocation = SimpleLocation.create (ex.getLocator ());
  return SingleError.builder ()
                    .setErrorLevel (aErrorLevel)
                    .setErrorLocation (aLocation)
                    .setErrorText (aErrorMsg)
                    .setLinkedException (ex)
                    .build ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:AbstractTransformErrorListener.java

示例9: internalLog

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Override
protected void internalLog (@Nonnull final IError aResError)
{
  final IErrorLevel aErrorLevel = aResError.getErrorLevel ();
  final String sText = aResError.getAsString (m_aDisplayLocale);
  LogHelper.log (s_aLogger, aErrorLevel, sText);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:8,代码来源:LoggingTransformErrorListener.java

示例10: getSaxParseError

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
/**
 * Utility method to convert a {@link SAXParseException} into an
 * {@link IError}.
 *
 * @param aErrorLevel
 *        The occurred error level. May not be <code>null</code>.
 * @param ex
 *        The exception to convert. May not be <code>null</code>.
 * @return The {@link IError} representation. Never <code>null</code>.
 */
@Nonnull
public static IError getSaxParseError (@Nonnull final IErrorLevel aErrorLevel, @Nonnull final SAXParseException ex)
{
  return SingleError.builder ()
                    .setErrorLevel (aErrorLevel)
                    .setErrorLocation (SimpleLocation.create (ex))
                    .setErrorText ("[SAX] " + ex.getMessage ())
                    .setLinkedException (ex)
                    .build ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:AbstractSAXErrorHandler.java

示例11: getErrorMessage

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Nonnull
@Nonempty
@OverrideOnDemand
protected String getErrorMessage (@Nonnull final IErrorLevel aErrorLevel, final SAXParseException aException)
{
  // As the SAX error messages are not localized at the moment, we can use
  // a fixed locale here
  return getSaxParseError (aErrorLevel, aException).getAsString (CGlobal.DEFAULT_LOCALE);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:LoggingSAXErrorHandler.java

示例12: SingleError

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
public SingleError (@Nonnull final IErrorLevel aErrorLevel,
                    @Nullable final String sErrorID,
                    @Nullable final String sErrorFieldName,
                    @Nullable final ILocation aErrorLocation,
                    @Nullable final IHasErrorText aErrorText,
                    @Nullable final Throwable aLinkedException)
{
  m_aErrorLevel = ValueEnforcer.notNull (aErrorLevel, "ErrorLevel");
  m_sErrorID = sErrorID;
  m_sErrorFieldName = sErrorFieldName;
  m_aErrorLocation = aErrorLocation != null ? aErrorLocation : SimpleLocation.NO_LOCATION;
  m_aErrorText = aErrorText;
  m_aLinkedException = aLinkedException;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:15,代码来源:SingleError.java

示例13: setErrorLevel

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
@Nonnull
public final IMPLTYPE setErrorLevel (@Nonnull final IErrorLevel aErrorLevel)
{
  ValueEnforcer.notNull (aErrorLevel, "ErrorLevel");
  m_aErrorLevel = aErrorLevel;
  return thisAsT ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:8,代码来源:SingleError.java

示例14: LogMessage

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
public LogMessage (@Nonnull final LocalDateTime aIssueDT,
                   @Nonnull final IErrorLevel aErrorLevel,
                   @Nonnull final Serializable aMsg,
                   @Nullable final Throwable aThrowable)
{
  m_aIssueDT = ValueEnforcer.notNull (aIssueDT, "IssueDT");
  m_aErrorLevel = ValueEnforcer.notNull (aErrorLevel, "ErrorLevel");
  m_aMsg = ValueEnforcer.notNull (aMsg, "Message");
  m_aThrowable = aThrowable;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:11,代码来源:LogMessage.java

示例15: log

import com.helger.commons.error.level.IErrorLevel; //导入依赖的package包/类
public void log (@Nonnull final IErrorLevel eErrorLevel,
                 @Nonnull final Serializable aMsg,
                 @Nullable final Throwable t)
{
  final LogMessage aLogMessage = createLogMessage (eErrorLevel, aMsg, t);
  if (aLogMessage != null)
  {
    m_aMessages.add (aLogMessage);
    onAddLogMessage (aLogMessage);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:InMemoryLogger.java


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