com.fasterxml.jackson.core.json.DupDetector Java Examples
The following examples show how to use
com.fasterxml.jackson.core.json.DupDetector.
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: GeneratorBase.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public JsonGenerator enable(Feature f) { final int mask = f.getMask(); _features |= mask; if ((mask & DERIVED_FEATURES_MASK) != 0) { // why not switch? Requires addition of a generated class, alas if (f == Feature.WRITE_NUMBERS_AS_STRINGS) { _cfgNumbersAsStrings = true; } else if (f == Feature.ESCAPE_NON_ASCII) { setHighestNonEscapedChar(127); } else if (f == Feature.STRICT_DUPLICATE_DETECTION) { if (_writeContext.getDupDetector() == null) { // but only if disabled currently _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); } } } return this; }
Example #2
Source File: GeneratorBase.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Helper method called to verify changes to standard features. * * @param newFeatureFlags Bitflag of standard features after they were changed * @param changedFeatures Bitflag of standard features for which setting * did change * * @since 2.7 */ protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures) { if ((changedFeatures & DERIVED_FEATURES_MASK) == 0) { return; } _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(newFeatureFlags); if (Feature.ESCAPE_NON_ASCII.enabledIn(changedFeatures)) { if (Feature.ESCAPE_NON_ASCII.enabledIn(newFeatureFlags)) { setHighestNonEscapedChar(127); } else { setHighestNonEscapedChar(0); } } if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(changedFeatures)) { if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(newFeatureFlags)) { // enabling if (_writeContext.getDupDetector() == null) { // but only if disabled currently _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); } } else { // disabling _writeContext = _writeContext.withDupDetector(null); } } }
Example #3
Source File: GeneratorBase.java From openbd-core with GNU General Public License v3.0 | 6 votes |
@Override public JsonGenerator enable(Feature f) { final int mask = f.getMask(); _features |= mask; if ((mask & DERIVED_FEATURES_MASK) != 0) { if (f == Feature.WRITE_NUMBERS_AS_STRINGS) { _cfgNumbersAsStrings = true; } else if (f == Feature.ESCAPE_NON_ASCII) { setHighestNonEscapedChar(127); } else if (f == Feature.STRICT_DUPLICATE_DETECTION) { if (_writeContext.getDupDetector() == null) { // but only if disabled currently _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); } } } return this; }
Example #4
Source File: GeneratorBase.java From openbd-core with GNU General Public License v3.0 | 6 votes |
@Override public JsonGenerator setFeatureMask(int newMask) { int changed = newMask ^ _features; _features = newMask; if ((changed & DERIVED_FEATURES_MASK) != 0) { _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(newMask); if (Feature.ESCAPE_NON_ASCII.enabledIn(changed)) { if (Feature.ESCAPE_NON_ASCII.enabledIn(newMask)) { setHighestNonEscapedChar(127); } else { setHighestNonEscapedChar(0); } } if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(changed)) { if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(newMask)) { // enabling if (_writeContext.getDupDetector() == null) { // but only if disabled currently _writeContext = _writeContext.withDupDetector(DupDetector.rootDetector(this)); } } else { // disabling _writeContext = _writeContext.withDupDetector(null); } } } return this; }
Example #5
Source File: GeneratorBase.java From lams with GNU General Public License v2.0 | 5 votes |
protected GeneratorBase(int features, ObjectCodec codec) { super(); _features = features; _objectCodec = codec; DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _writeContext = JsonWriteContext.createRootContext(dups); _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features); }
Example #6
Source File: ParserBase.java From lams with GNU General Public License v2.0 | 5 votes |
protected ParserBase(IOContext ctxt, int features) { super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
Example #7
Source File: ParserBase.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public JsonParser enable(Feature f) { _features |= f.getMask(); if (f == Feature.STRICT_DUPLICATE_DETECTION) { // enabling dup detection? if (_parsingContext.getDupDetector() == null) { // but only if disabled currently _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); } } return this; }
Example #8
Source File: ParserBase.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Helper method called to verify changes to standard features. * * @param newFeatureFlags Bitflag of standard features after they were changed * @param changedFeatures Bitflag of standard features for which setting * did change * * @since 2.7 */ protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures) { int f = Feature.STRICT_DUPLICATE_DETECTION.getMask(); if ((changedFeatures & f) != 0) { if ((newFeatureFlags & f) != 0) { if (_parsingContext.getDupDetector() == null) { _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); } else { // disabling _parsingContext = _parsingContext.withDupDetector(null); } } } }
Example #9
Source File: GeneratorBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
protected GeneratorBase(int features, ObjectCodec codec) { super(); _features = features; _objectCodec = codec; DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _writeContext = JsonWriteContext.createRootContext(dups); _cfgNumbersAsStrings = Feature.WRITE_NUMBERS_AS_STRINGS.enabledIn(features); }
Example #10
Source File: ParserBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
protected ParserBase(IOContext ctxt, int features) { super(features); _ioContext = ctxt; _textBuffer = ctxt.constructTextBuffer(); DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features) ? DupDetector.rootDetector(this) : null; _parsingContext = JsonReadContext.createRootContext(dups); }
Example #11
Source File: ParserBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
@Override public JsonParser enable(Feature f) { _features |= f.getMask(); if (f == Feature.STRICT_DUPLICATE_DETECTION) { // enabling dup detection? if (_parsingContext.getDupDetector() == null) { // but only if disabled currently _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); } } return this; }
Example #12
Source File: ParserBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
@Override public JsonParser setFeatureMask(int newMask) { int changes = (_features ^ newMask); if (changes != 0) { _features = newMask; if (Feature.STRICT_DUPLICATE_DETECTION.enabledIn(newMask)) { // enabling if (_parsingContext.getDupDetector() == null) { // but only if disabled currently _parsingContext = _parsingContext.withDupDetector(DupDetector.rootDetector(this)); } } else { // disabling _parsingContext = _parsingContext.withDupDetector(null); } } return this; }