com.alibaba.fastjson2.adapter.jackson.databind.SerializationFeature Maven / Gradle / Ivy
package com.alibaba.fastjson2.adapter.jackson.databind;
import com.alibaba.fastjson2.adapter.jackson.databind.cfg.ConfigFeature;
public enum SerializationFeature
implements ConfigFeature {
WRAP_ROOT_VALUE(false),
INDENT_OUTPUT(false),
FAIL_ON_EMPTY_BEANS(true),
FAIL_ON_SELF_REFERENCES(true),
WRAP_EXCEPTIONS(true),
FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS(true),
WRITE_SELF_REFERENCES_AS_NULL(false),
CLOSE_CLOSEABLE(false),
FLUSH_AFTER_WRITE_VALUE(true),
WRITE_DATES_AS_TIMESTAMPS(true),
WRITE_DATE_KEYS_AS_TIMESTAMPS(false),
WRITE_DATES_WITH_ZONE_ID(false),
WRITE_DATES_WITH_CONTEXT_TIME_ZONE(true),
WRITE_DURATIONS_AS_TIMESTAMPS(true),
WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS(false),
WRITE_ENUMS_USING_TO_STRING(false),
WRITE_ENUMS_USING_INDEX(false),
WRITE_ENUM_KEYS_USING_INDEX(false),
@Deprecated
WRITE_NULL_MAP_VALUES(true),
@Deprecated
WRITE_EMPTY_JSON_ARRAYS(true),
WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED(false),
@Deprecated
WRITE_BIGDECIMAL_AS_PLAIN(false),
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS(true),
ORDER_MAP_ENTRIES_BY_KEYS(false),
EAGER_SERIALIZER_FETCH(true),
USE_EQUALITY_FOR_OBJECT_ID(false);
private final boolean defaultState;
private final int mask;
SerializationFeature(boolean defaultState) {
this.defaultState = defaultState;
mask = (1 << ordinal());
}
@Override
public boolean enabledByDefault() {
return defaultState;
}
@Override
public int getMask() {
return mask;
}
@Override
public boolean enabledIn(int flags) {
return (flags & mask) != 0;
}
}