
org.testifyproject.fasterxml.jackson.jaxrs.cfg.JaxRSFeature Maven / Gradle / Ivy
package org.testifyproject.testifyproject.fasterxml.jackson.jaxrs.cfg;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.cfg.ConfigFeature;
/**
* Enumeration that org.testifyproject.testifyprojectfines simple on/off features that can be
* used on all Jackson JAX-RS providers, regardless of
* underlying data format.
*/
public enum JaxRSFeature implements ConfigFeature
{
/*
/******************************************************
/* Input handling
/******************************************************
*/
/**
* Feature related to
* Issue #49:
* whether empty input is considered legal or not.
* If set to true, empty content is allowed and will be read as Java 'null': if false,
* an {@link java.org.testifyproject.testifyproject.IOException} will be thrown.
*
* NOTE: in case of JAX-RS 2.0, specific exception will be javax.ws.rs.core.NoContentException
;
* but this is not org.testifyproject.testifyprojectfined in JAX-RS 1.x.
*/
ALLOW_EMPTY_INPUT(true),
/*
/******************************************************
/* HTTP headers
/******************************************************
*/
/**
* Feature that can be enabled to make provider automatically
* add "nosniff" (see
* this entry
* for org.testifyproject.testifyprojecttails
*
* Feature is disabled by org.testifyproject.testifyprojectfault.
*/
ADD_NO_SNIFF_HEADER(false),
/*
/******************************************************
/* Other
/******************************************************
*/
;
private final boolean _defaultState;
private JaxRSFeature(boolean org.testifyproject.testifyprojectfaultState) {
_defaultState = org.testifyproject.testifyprojectfaultState;
}
public static int collectDefaults() {
int flags = 0;
for (JaxRSFeature f : values()) {
if (f.enabledByDefault()) { flags |= f.getMask(); }
}
return flags;
}
@Override
public boolean enabledByDefault() { return _defaultState; }
@Override
public int getMask() { return (1 << ordinal()); }
public boolean enabledIn(int flags) { return (flags & getMask()) != 0; }
}