本文整理汇总了Java中com.helger.commons.annotation.OverrideOnDemand类的典型用法代码示例。如果您正苦于以下问题:Java OverrideOnDemand类的具体用法?Java OverrideOnDemand怎么用?Java OverrideOnDemand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OverrideOnDemand类属于com.helger.commons.annotation包,在下文中一共展示了OverrideOnDemand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrorLevel
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的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;
}
}
示例2: getErrorFieldName
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@Nullable
@OverrideOnDemand
protected String getErrorFieldName (@Nullable final ValidationEventLocator aLocator)
{
if (aLocator != null)
{
// Source object found?
final Object aObj = aLocator.getObject ();
if (aObj != null)
return "obj: " + aObj.toString ();
// Source node found?
final Node aNode = aLocator.getNode ();
if (aNode != null)
return XMLWriter.getNodeAsString (aNode);
}
return null;
}
示例3: handleReadException
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@OverrideOnDemand
protected void handleReadException (@Nonnull final JAXBException ex)
{
if (ex instanceof UnmarshalException)
{
// The JAXB specification does not mandate how the JAXB provider
// must behave when attempting to unmarshal invalid XML data. In
// those cases, the JAXB provider is allowed to terminate the
// call to unmarshal with an UnmarshalException.
final Throwable aLinked = ((UnmarshalException) ex).getLinkedException ();
if (aLinked instanceof SAXParseException)
s_aLogger.error ("Failed to parse XML document: " + aLinked.getMessage ());
else
s_aLogger.error ("Unmarshal exception reading document", ex);
}
else
s_aLogger.warn ("JAXB Exception reading document", ex);
}
示例4: createMarshaller
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* 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;
}
示例5: modifyWriteData
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* 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);
}
示例6: initializeThread
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* Initializes the specified thread. This method is called by
* {@link #newThread(Runnable)} after a new thread has been obtained from the
* wrapped thread factory. It initializes the thread according to the options
* set for this factory.
*
* @param aThread
* the thread to be initialized
*/
@OverrideOnDemand
protected void initializeThread (@Nonnull final Thread aThread)
{
if (m_sNamingPattern != null)
{
final Long aCount = Long.valueOf (m_aThreadCounter.incrementAndGet ());
aThread.setName (String.format (CGlobal.DEFAULT_LOCALE, m_sNamingPattern, aCount));
}
if (m_aUncaughtExceptionHandler != null)
aThread.setUncaughtExceptionHandler (m_aUncaughtExceptionHandler);
if (m_aPriority != null)
aThread.setPriority (m_aPriority.intValue ());
if (m_eDaemon.isDefined ())
aThread.setDaemon (m_eDaemon.getAsBooleanValue ());
}
示例7: createPreprocessedSchema
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* Pre-process the read schema, using the determined query binding.
*
* @param aSchema
* The read schema. Never <code>null</code>.
* @param aQueryBinding
* The determined query binding. Never <code>null</code>.
* @return The pre-processed schema and never <code>null</code>.
* @throws SchematronException
* In case pre-processing fails
*/
@Nonnull
@OverrideOnDemand
public PSSchema createPreprocessedSchema (@Nonnull final PSSchema aSchema,
@Nonnull final IPSQueryBinding aQueryBinding) throws SchematronException
{
final PSPreprocessor aPreprocessor = createPreprocessor (aQueryBinding);
final PSSchema aPreprocessedSchema = aPreprocessor.getAsPreprocessedSchema (aSchema);
if (aPreprocessedSchema == null)
throw new SchematronPreprocessException ("Failed to preprocess schema " +
aSchema +
" with query binding " +
aQueryBinding);
if (SchematronDebug.isShowPreprocessedSchematron ())
s_aLogger.info ("Preprocessed Schematron:\n" +
MicroWriter.getNodeAsString (aPreprocessedSchema.getAsMicroElement ()));
return aPreprocessedSchema;
}
示例8: createMockHttpServletRequest
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@Override
@Nonnull
@OverrideOnDemand
protected MockHttpServletRequest createMockHttpServletRequest ()
{
return new OfflineHttpServletRequest (m_aSC, false);
}
示例9: getLocationResourceID
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@Nullable
@OverrideOnDemand
protected String getLocationResourceID (@Nullable final ValidationEventLocator aLocator)
{
if (aLocator != null)
{
// Source file found?
final URL aURL = aLocator.getURL ();
if (aURL != null)
return aURL.toString ();
}
return null;
}
示例10: handleWriteException
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@OverrideOnDemand
protected void handleWriteException (@Nonnull final JAXBException ex)
{
if (ex instanceof MarshalException)
s_aLogger.error ("Marshal exception writing object", ex);
else
s_aLogger.warn ("JAXB Exception writing object", ex);
}
示例11: getJAXBContext
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@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 ());
}
示例12: getWriteNamespaceURI
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* @return The namespace URI to be used for writing XML settings. Defaults to
* <code>null</code>.
*/
@Nullable
@OverrideOnDemand
protected String getWriteNamespaceURI ()
{
return null;
}
示例13: getWriteElementName
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
/**
* @return The document root element local name. May neither be
* <code>null</code> nor empty.
*/
@Nonnull
@Nonempty
@OverrideOnDemand
protected String getWriteElementName ()
{
return "settings";
}
示例14: createXMLEmitter
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@Nonnull
@OverrideOnDemand
protected XMLEmitter createXMLEmitter (@Nonnull @WillNotClose final Writer aWriter,
@Nonnull final IXMLWriterSettings aSettings)
{
return new XMLEmitter (aWriter, aSettings);
}
示例15: getLogMessage
import com.helger.commons.annotation.OverrideOnDemand; //导入依赖的package包/类
@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);
}