javax.annotation.OverridingMethodsMustInvokeSuper#com.helger.commons.annotation.OverrideOnDemand源码实例Demo

下面列出了javax.annotation.OverridingMethodsMustInvokeSuper#com.helger.commons.annotation.OverrideOnDemand 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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:
      if (LOGGER.isWarnEnabled ())
        LOGGER.warn ("Unknown JAXB validation severity: " + nSeverity + "; defaulting to error");
      return EErrorLevel.ERROR;
  }
}
 
源代码2 项目: ph-commons   文件: AbstractWritingJAXBBuilder.java
/**
 * Create the main marshaller with the contained settings.
 *
 * @return The Marshaller and never <code>null</code>.
 * @throws JAXBException
 *         In case creation fails
 */
@Nonnull
@OverrideOnDemand
protected Marshaller createMarshaller () throws JAXBException
{
  final JAXBContext aJAXBContext = getJAXBContext ();

  // create a Marshaller
  final Marshaller aMarshaller = aJAXBContext.createMarshaller ();

  // Validating (if possible)
  final Schema aSchema = getSchema ();
  if (aSchema != null)
    aMarshaller.setSchema (aSchema);

  return aMarshaller;
}
 
源代码3 项目: ph-commons   文件: AbstractWALDAO.java
/**
 * Modify the created document by e.g. adding some comment or digital
 * signature or whatsoever.
 *
 * @param aDoc
 *        The created non-<code>null</code> document.
 */
@OverrideOnDemand
@MustBeLocked (ELockType.WRITE)
protected void modifyWriteData (@Nonnull final IMicroDocument aDoc)
{
  final IMicroComment aComment = new MicroComment ("This file was generated automatically - do NOT modify!\n" +
                                                   "Written at " +
                                                   PDTToString.getAsString (ZonedDateTime.now (Clock.systemUTC ()),
                                                                            Locale.US));
  final IMicroElement eRoot = aDoc.getDocumentElement ();
  // Add a small comment
  if (eRoot != null)
    aDoc.insertBefore (aComment, eRoot);
  else
    aDoc.appendChild (aComment);
}
 
源代码4 项目: ph-commons   文件: AbstractSimpleDAO.java
/**
 * Modify the created document by e.g. adding some comment or digital
 * signature or whatsoever.
 *
 * @param aDoc
 *        The created non-<code>null</code> document.
 */
@OverrideOnDemand
@MustBeLocked (ELockType.WRITE)
protected void modifyWriteData (@Nonnull final IMicroDocument aDoc)
{
  final IMicroComment aComment = new MicroComment ("This file was generated automatically - do NOT modify!\n" +
                                                   "Written at " +
                                                   PDTToString.getAsString (ZonedDateTime.now (Clock.systemUTC ()),
                                                                            Locale.US));
  final IMicroElement eRoot = aDoc.getDocumentElement ();
  // Add a small comment
  if (eRoot != null)
    aDoc.insertBefore (aComment, eRoot);
  else
    aDoc.appendChild (aComment);
}
 
源代码5 项目: ph-commons   文件: AbstractJAXBBuilder.java
@Nonnull
@OverrideOnDemand
protected JAXBContext getJAXBContext () throws JAXBException
{
  if (m_bUseJAXBContextCache)
  {
    // Since creating the JAXB context is quite cost intensive this is done
    // only once!
    return JAXBContextCache.getInstance ().getFromCache (m_aDocType.getImplementationClass (), getClassLoader ());
  }

  // Create a new JAXBContext - inefficient
  return JAXBContext.newInstance (m_aDocType.getImplementationClass ().getPackage ().getName (), getClassLoader ());
}
 
源代码6 项目: ph-commons   文件: SettingsPersistenceXML.java
/**
 * @return The document root element local name. May neither be
 *         <code>null</code> nor empty.
 */
@Nonnull
@Nonempty
@OverrideOnDemand
protected String getWriteElementName ()
{
  return "settings";
}
 
源代码7 项目: ph-commons   文件: SafeXMLStreamWriter.java
@OverrideOnDemand
protected void debug (@Nonnull final Supplier <String> aSupplier)
{
  if (m_bDebugMode)
    if (LOGGER.isInfoEnabled ())
      LOGGER.info (aSupplier.get ());
}
 
源代码8 项目: ph-commons   文件: XMLLoggingExceptionCallback.java
@Override
@Nonnull
@Nonempty
@OverrideOnDemand
protected String getLogMessage (@Nullable final Throwable t)
{
  if (t instanceof SAXParseException)
  {
    final SAXParseException ex = (SAXParseException) t;
    return AbstractSAXErrorHandler.getSaxParseError (EErrorLevel.ERROR, ex).getAsString (CGlobal.DEFAULT_LOCALE);
  }
  if (t instanceof SAXException)
  {
    return "Error parsing XML document";
  }
  if (t instanceof UnknownHostException)
  {
    // Must be checked before IOException because it is an IOException
    // Caught if entity resolver failed
    return "Failed to resolve entity host: " + t.getMessage ();
  }
  if (t instanceof IOException)
  {
    return "Error reading XML document: " + t.getMessage ();
  }
  return super.getLogMessage (t);
}
 
源代码9 项目: ph-commons   文件: LoggingSAXErrorHandler.java
@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);
}
 
源代码10 项目: ph-commons   文件: AbstractWALDAO.java
/**
 * This method is used upon recovery to convert a stored object to its native
 * representation. If you overwrite this method, you should consider
 * overriding {@link #convertNativeToWALString(Serializable)} as well.
 *
 * @param sElement
 *        The string representation to be converted. Never <code>null</code>.
 * @return The native representation of the object. If the return value is
 *         <code>null</code>, the recovery will fail with an exception!
 */
@Nullable
@OverrideOnDemand
@IsLocked (ELockType.WRITE)
protected DATATYPE convertWALStringToNative (@Nonnull final String sElement)
{
  final IMicroDocument aDoc = MicroReader.readMicroXML (sElement);
  if (aDoc == null || aDoc.getDocumentElement () == null)
    return null;
  return MicroTypeConverter.convertToNative (aDoc.getDocumentElement (), m_aDataTypeClass);
}
 
源代码11 项目: ph-commons   文件: AbstractWALDAO.java
/**
 * This method is called, when the conversion from the read XML string to the
 * native type failed. By default an error message is logged and processing
 * continues.
 *
 * @param eActionType
 *        The action type to recover. May not be <code>null</code>
 * @param i
 *        The index of the element to recover. Always &ge; 0.
 * @param sElement
 *        The string read from the WAL file that could not be recovered.
 * @since 9.1.6
 */
@OverrideOnDemand
protected void onRecoveryErrorConvertToNative (@Nonnull final EDAOActionType eActionType,
                                               @Nonnegative final int i,
                                               @Nonnull final String sElement)
{
  if (LOGGER.isErrorEnabled ())
    LOGGER.error ("Action [" +
                  eActionType +
                  "][" +
                  i +
                  "]: failed to convert the following element to native:\n" +
                  sElement);
}
 
源代码12 项目: ph-commons   文件: AbstractWALDAO.java
/**
 * @return The {@link IXMLWriterSettings} to be used to serialize the data.
 */
@Nonnull
@OverrideOnDemand
protected IXMLWriterSettings getXMLWriterSettings ()
{
  return WRITE_XWS;
}
 
源代码13 项目: ph-commons   文件: AbstractWALDAO.java
/**
 * @return The {@link IXMLWriterSettings} to be used to serialize the data.
 */
@Nonnull
@OverrideOnDemand
protected IXMLWriterSettings getWALXMLWriterSettings ()
{
  return WAL_XWS;
}
 
源代码14 项目: ph-commons   文件: AbstractWALDAO.java
@Nonnull
@OverrideOnDemand
protected String convertNativeToWALString (@Nonnull final DATATYPE aModifiedElement)
{
  final IMicroElement aElement = MicroTypeConverter.convertToMicroElement (aModifiedElement, "item");
  if (aElement == null)
    throw new IllegalStateException ("Failed to convert " +
                                     aModifiedElement +
                                     " of class " +
                                     aModifiedElement.getClass ().getName () +
                                     " to XML!");
  return MicroWriter.getNodeAsString (aElement, getWALXMLWriterSettings ());
}
 
源代码15 项目: ph-commons   文件: AbstractSimpleDAO.java
/**
 * @return The {@link IXMLWriterSettings} to be used to serialize the data.
 */
@Nonnull
@OverrideOnDemand
protected IXMLWriterSettings getXMLWriterSettings ()
{
  return XMLWriterSettings.DEFAULT_XML_SETTINGS;
}
 
源代码16 项目: ph-commons   文件: ReadableResourceProviderChain.java
@Nonnull
@OverrideOnDemand
public IReadableResource getReadableResource (@Nonnull final String sName)
{
  // Use the first resource provider that supports the name
  for (final IReadableResourceProvider aResProvider : m_aReadingResourceProviders)
    if (aResProvider.supportsReading (sName))
      return aResProvider.getReadableResource (sName);
  throw new IllegalArgumentException ("Cannot handle reading '" +
                                      sName +
                                      "' by any of " +
                                      m_aReadingResourceProviders);
}
 
源代码17 项目: ph-schematron   文件: Schematron.java
/**
 * Get the {@link URIResolver} to be used.
 *
 * @return Never <code>null</code>.
 */
@Nonnull
@OverrideOnDemand
protected URIResolver getURIResolver ()
{
  return m_aXmlCatalog;
}
 
源代码18 项目: ph-commons   文件: MappedCache.java
/**
 * Create a new cache map. This is the internal map that is used to store the
 * items.
 *
 * @return Never <code>null</code>.
 */
@Nonnull
@ReturnsMutableCopy
@OverrideOnDemand
@CodingStyleguideUnaware
protected ICommonsMap <KEYSTORETYPE, Wrapper <VALUETYPE>> createCache ()
{
  return hasMaxSize () ? new SoftLinkedHashMap <> (m_nMaxSize) : new SoftHashMap <> ();
}
 
源代码19 项目: ph-schematron   文件: Schematron.java
/**
 * Get the {@link EntityResolver} to be used.
 *
 * @return Never <code>null</code>.
 */
@Nonnull
@OverrideOnDemand
protected EntityResolver getEntityResolver ()
{
  return m_aXmlCatalog;
}
 
源代码20 项目: ph-schematron   文件: PSWriter.java
@Nonnull
@OverrideOnDemand
protected IMicroNode getAsDocument (@Nonnull final IMicroElement aElement)
{
  final IMicroDocument aDoc = new MicroDocument ();
  aDoc.appendChild (aElement);
  return aDoc;
}
 
源代码21 项目: ph-commons   文件: LoggingWriter.java
@OverrideOnDemand
protected void onClose (final long nTotalBytesWritten)
{
  if (LOGGER.isInfoEnabled ())
    LOGGER.info ("Close at " + nTotalBytesWritten);
}
 
源代码22 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onEndPageMarginBlock (@Nonnull final CSSPageMarginBlock aPageMarginBlock)
{}
 
源代码23 项目: ph-commons   文件: LoggingReader.java
@OverrideOnDemand
protected void onMark (final int nReadLimit, final long nCurrentPosition)
{
  if (LOGGER.isInfoEnabled ())
    LOGGER.info ("Marked at " + nCurrentPosition + " with read-limit of " + nReadLimit);
}
 
源代码24 项目: ph-commons   文件: ScopeTestRule.java
@Override
@OverrideOnDemand
public void after ()
{
  ScopeAwareTestSetup.shutdownScopeTests ();
}
 
源代码25 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onBeginSupportsRule (@Nonnull final CSSSupportsRule aSupportsRule)
{}
 
源代码26 项目: ph-css   文件: AbstractCSSProperty.java
@Nonnegative
@OverrideOnDemand
public int getMinimumArgumentCount ()
{
  return 1;
}
 
源代码27 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onEndKeyframesBlock (@Nonnull final CSSKeyframesBlock aKeyframesBlock)
{}
 
源代码28 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onEndPageRule (@Nonnull final CSSPageRule aPageRule)
{}
 
源代码29 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onUnknownRule (@Nonnull final CSSUnknownRule aUnknownRule)
{}
 
源代码30 项目: ph-css   文件: DefaultCSSVisitor.java
@OverrideOnDemand
public void onBeginKeyframesBlock (@Nonnull final CSSKeyframesBlock aKeyframesBlock)
{}