Java Code Examples for com.fasterxml.jackson.databind.Module.SetupContext#setMixInAnnotations()

The following examples show how to use com.fasterxml.jackson.databind.Module.SetupContext#setMixInAnnotations() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YamlSetupContextInitializer.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
public void setupModule(final SetupContext context, final boolean includeStacktrace,
        final boolean stacktraceAsString) {
    // JRE classes: we cannot edit those with Jackson annotations
    context.setMixInAnnotations(StackTraceElement.class, StackTraceElementMixIn.class);
    // Log4j API classes: we do not want to edit those with Jackson annotations because the API module should not
    // depend on Jackson.
    context.setMixInAnnotations(Marker.class, MarkerMixIn.class);
    context.setMixInAnnotations(Level.class, LevelMixIn.class);
    context.setMixInAnnotations(Instant.class, InstantMixIn.class);
    context.setMixInAnnotations(LogEvent.class, LogEventJsonMixIn.class); // different ThreadContext handling
    // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
    context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementMixIn.class);
    context.setMixInAnnotations(ThrowableProxy.class, includeStacktrace
            ? (stacktraceAsString ? ThrowableProxyWithStacktraceAsStringMixIn.class : ThrowableProxyMixIn.class)
            : ThrowableProxyWithoutStacktraceMixIn.class);
}
 
Example 2
Source File: SetupContextInitializer.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
public void setupModule(final SetupContext context, final boolean includeStacktrace,
        final boolean stacktraceAsString) {
    // JRE classes: we cannot edit those with Jackson annotations
    context.setMixInAnnotations(StackTraceElement.class, StackTraceElementMixIn.class);
    // Log4j API classes: we do not want to edit those with Jackson annotations because the API module should not
    // depend on Jackson.
    context.setMixInAnnotations(Marker.class, MarkerMixIn.class);
    context.setMixInAnnotations(Level.class, LevelMixIn.class);
    context.setMixInAnnotations(Instant.class, InstantMixIn.class);
    context.setMixInAnnotations(LogEvent.class, LogEventWithContextListMixIn.class);
    // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
    context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementMixIn.class);
    context.setMixInAnnotations(ThrowableProxy.class, includeStacktrace
            ? (stacktraceAsString ? ThrowableProxyWithStacktraceAsStringMixIn.class : ThrowableProxyMixIn.class)
            : ThrowableProxyWithoutStacktraceMixIn.class);
}
 
Example 3
Source File: XmlSetupContextInitializer.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
public void setupModule(final SetupContext context, final boolean includeStacktrace,
        final boolean stacktraceAsString) {
    // JRE classes: we cannot edit those with Jackson annotations
    context.setMixInAnnotations(StackTraceElement.class, StackTraceElementXmlMixIn.class);
    // Log4j API classes: we do not want to edit those with Jackson annotations because the API module should not
    // depend on Jackson.
    context.setMixInAnnotations(Marker.class, MarkerXmlMixIn.class);
    context.setMixInAnnotations(Level.class, LevelMixIn.class);
    context.setMixInAnnotations(Instant.class, InstantXmlMixIn.class);
    context.setMixInAnnotations(LogEvent.class, LogEventWithContextListXmlMixIn.class);
    // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
    context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementXmlMixIn.class);
    context.setMixInAnnotations(ThrowableProxy.class, includeStacktrace
            ? (stacktraceAsString ? ThrowableProxyWithStacktraceAsStringXmlMixIn.class : ThrowableProxyXmlMixIn.class)
            : ThrowableProxyWithoutStacktraceXmlMixIn.class);
}
 
Example 4
Source File: JsonSetupContextInitializer.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
public void setupModule(final SetupContext context, final boolean includeStacktrace,
        final boolean stacktraceAsString) {
    // JRE classes: we cannot edit those with Jackson annotations
    context.setMixInAnnotations(StackTraceElement.class, StackTraceElementMixIn.class);
    // Log4j API classes: we do not want to edit those with Jackson annotations because the API module should not
    // depend on Jackson.
    context.setMixInAnnotations(Marker.class, MarkerMixIn.class);
    context.setMixInAnnotations(Level.class, LevelMixIn.class);
    context.setMixInAnnotations(Instant.class, InstantMixIn.class);
    context.setMixInAnnotations(LogEvent.class, LogEventJsonMixIn.class); // different ThreadContext handling
    // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
    context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementMixIn.class);
    context.setMixInAnnotations(ThrowableProxy.class, includeStacktrace
            ? (stacktraceAsString ? ThrowableProxyWithStacktraceAsStringMixIn.class : ThrowableProxyMixIn.class)
            : ThrowableProxyWithoutStacktraceMixIn.class);
}