當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。