testautoa 0.4.0.pre16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.calabash_settings +1 -0
- data/CHANGES.txt +254 -0
- data/Gemfile +4 -0
- data/LICENSE +8 -0
- data/Rakefile +51 -0
- data/bin/calabash-android +101 -0
- data/bin/calabash-android-build.rb +43 -0
- data/bin/calabash-android-console.rb +29 -0
- data/bin/calabash-android-generate.rb +20 -0
- data/bin/calabash-android-helpers.rb +46 -0
- data/bin/calabash-android-run.rb +41 -0
- data/bin/calabash-android-setup.rb +29 -0
- data/calabash-android.gemspec +25 -0
- data/doc/calabash-android-help.txt +25 -0
- data/epl-v10.html +261 -0
- data/features-skeleton/my_first.feature +5 -0
- data/features-skeleton/step_definitions/calabash_steps.rb +1 -0
- data/features-skeleton/support/app_installation_hooks.rb +36 -0
- data/features-skeleton/support/app_life_cycle_hooks.rb +14 -0
- data/features-skeleton/support/env.rb +1 -0
- data/features-skeleton/support/hooks.rb +0 -0
- data/irbrc +37 -0
- data/lib/calabash-android/calabash_steps.rb +19 -0
- data/lib/calabash-android/canned_steps.md +283 -0
- data/lib/calabash-android/color_helper.rb +13 -0
- data/lib/calabash-android/cucumber.rb +9 -0
- data/lib/calabash-android/helpers.rb +159 -0
- data/lib/calabash-android/lib/AXMLPrinter2.jar +0 -0
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/lib/manifest_extractor.jar +0 -0
- data/lib/calabash-android/lib/screenShotTaker.jar +0 -0
- data/lib/calabash-android/lib/unsign.jar +0 -0
- data/lib/calabash-android/management/adb.rb +0 -0
- data/lib/calabash-android/management/app_installation.rb +1 -0
- data/lib/calabash-android/operations.rb +611 -0
- data/lib/calabash-android/steps/additions_manual_steps.rb +11 -0
- data/lib/calabash-android/steps/app_steps.rb +10 -0
- data/lib/calabash-android/steps/assert_steps.rb +44 -0
- data/lib/calabash-android/steps/check_box_steps.rb +3 -0
- data/lib/calabash-android/steps/context_menu_steps.rb +12 -0
- data/lib/calabash-android/steps/date_picker_steps.rb +8 -0
- data/lib/calabash-android/steps/enter_text_steps.rb +27 -0
- data/lib/calabash-android/steps/l10n_steps.rb +19 -0
- data/lib/calabash-android/steps/list_steps.rb +40 -0
- data/lib/calabash-android/steps/location_steps.rb +19 -0
- data/lib/calabash-android/steps/map_steps.rb +61 -0
- data/lib/calabash-android/steps/navigation_steps.rb +46 -0
- data/lib/calabash-android/steps/press_button_steps.rb +35 -0
- data/lib/calabash-android/steps/progress_steps.rb +71 -0
- data/lib/calabash-android/steps/rotation_steps.rb +7 -0
- data/lib/calabash-android/steps/screenshot_steps.rb +11 -0
- data/lib/calabash-android/steps/search_steps.rb +7 -0
- data/lib/calabash-android/steps/spinner_steps.rb +3 -0
- data/lib/calabash-android/steps/time_picker_steps.rb +8 -0
- data/lib/calabash-android/version.rb +5 -0
- data/lib/calabash-android/wait_helpers.rb +93 -0
- data/lib/calabash-android.rb +2 -0
- data/test-server/AndroidManifest.xml +29 -0
- data/test-server/build.xml +144 -0
- data/test-server/calabash-js/src/calabash.js +125 -0
- data/test-server/calabash-js/src/set_text.js +133 -0
- data/test-server/instrumentation-backend/.classpath +10 -0
- data/test-server/instrumentation-backend/.gitignore +1 -0
- data/test-server/instrumentation-backend/.project +33 -0
- data/test-server/instrumentation-backend/.settings/org.eclipse.jdt.core.prefs +11 -0
- data/test-server/instrumentation-backend/AndroidManifest.xml +17 -0
- data/test-server/instrumentation-backend/antlr/UIQuery.g +113 -0
- data/test-server/instrumentation-backend/antlr/UIQuery.tokens +12 -0
- data/test-server/instrumentation-backend/antlr.sh +2 -0
- data/test-server/instrumentation-backend/assets/foo.bar +0 -0
- data/test-server/instrumentation-backend/build-libs/antlr-3.4-complete.jar +0 -0
- data/test-server/instrumentation-backend/build-libs/junit.jar +0 -0
- data/test-server/instrumentation-backend/build.xml +56 -0
- data/test-server/instrumentation-backend/libs/robotium-solo-3.6.jar +0 -0
- data/test-server/instrumentation-backend/project.properties +11 -0
- data/test-server/instrumentation-backend/res/drawable-hdpi/ic_launcher.png +0 -0
- data/test-server/instrumentation-backend/res/drawable-ldpi/ic_launcher.png +0 -0
- data/test-server/instrumentation-backend/res/drawable-mdpi/ic_launcher.png +0 -0
- data/test-server/instrumentation-backend/res/layout/main.xml +12 -0
- data/test-server/instrumentation-backend/res/values/strings.xml +7 -0
- data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/MapViewUtils.java +328 -0
- data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/PublicViewFetcher.java +11 -0
- data/test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/SoloEnhanced.java +97 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRFileStream.java +78 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRInputStream.java +70 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRReaderStream.java +95 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRStringStream.java +230 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/BaseRecognizer.java +894 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/BitSet.java +325 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/BufferedTokenStream.java +272 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/CharStream.java +57 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/CharStreamState.java +45 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ClassicToken.java +141 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/CommonToken.java +191 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/CommonTokenStream.java +153 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/DFA.java +250 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/EarlyExitException.java +41 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/FailedPredicateException.java +54 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/IntStream.java +122 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/LegacyCommonTokenStream.java +394 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/Lexer.java +340 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedNotSetException.java +41 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedRangeException.java +45 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedSetException.java +44 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTokenException.java +45 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTreeNodeException.java +49 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/MissingTokenException.java +56 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/NoViableAltException.java +57 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/Parser.java +98 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/ParserRuleReturnScope.java +52 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/RecognitionException.java +180 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/RecognizerSharedState.java +144 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/RuleReturnScope.java +42 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/SerializedGrammar.java +204 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/Token.java +92 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenRewriteStream.java +569 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenSource.java +54 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenStream.java +75 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/UnbufferedTokenStream.java +82 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/UnwantedTokenException.java +53 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/BlankDebugEventListener.java +77 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventHub.java +292 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventListener.java +323 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventRepeater.java +88 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventSocketProxy.java +358 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugParser.java +101 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTokenStream.java +156 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeAdaptor.java +250 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeNodeStream.java +155 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeParser.java +112 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/ParseTreeBuilder.java +109 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/Profiler.java +772 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/RemoteDebugEventSocketListener.java +541 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/TraceDebugEventListener.java +108 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/Tracer.java +69 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/DoubleKeyMap.java +62 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/FastQueue.java +100 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/IntArray.java +87 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/LookaheadStream.java +161 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/Stats.java +189 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTree.java +349 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTreeAdaptor.java +279 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BufferedTreeNodeStream.java +489 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonErrorNode.java +108 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTree.java +185 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeAdaptor.java +168 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeNodeStream.java +171 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/ParseTree.java +119 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteCardinalityException.java +47 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEarlyExitException.java +39 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEmptyStreamException.java +35 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleElementStream.java +210 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleNodeStream.java +70 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleSubtreeStream.java +86 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleTokenStream.java +76 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/Tree.java +127 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeAdaptor.java +263 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeFilter.java +135 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeIterator.java +132 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeNodeStream.java +106 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeParser.java +169 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternLexer.java +135 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternParser.java +154 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRewriter.java +124 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRuleReturnScope.java +41 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitor.java +69 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitorAction.java +47 -0
- data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeWizard.java +531 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearAppData.java +63 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Command.java +64 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/FranklyResult.java +95 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/InstrumentationBackend.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java +83 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/TestHelpers.java +130 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/WakeUp.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/Action.java +11 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/Actions.java +112 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java +222 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NanoHTTPD.java +1094 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NullAction.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/FinishOpenedActivities.java +19 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/GetOpenedActivities.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/GoBackToActivity.java +67 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/SetActivityOrientation.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonNumber.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonText.java +27 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonNumber.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/WaitForButton.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/checkbox/ToggleCheckboxNumber.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressText.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuById.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByIndex.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByText.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/ClickOnScreen.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Drag.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/DragCoordinates.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Swipe.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/TouchCoordinates.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/helpers/InspectCurrentDialog.java +76 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/helpers/ListActions.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/l10n/L10nHelper.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/l10n/PressElement.java +48 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/l10n/WaitForElement.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListData.java +85 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListItemProperties.java +194 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListItemText.java +136 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/LongPressListItems.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/PressListItems.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/location/FakeGPSLocation.java +138 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapBounds.java +27 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapCenter.java +27 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarker.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java +48 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapZoom.java +19 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/PanMapTo.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/SetMapCenter.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/SetMapZoom.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/TapAwayFromMarkers.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/TapMapMarker.java +29 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollDown.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollUp.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/search/EnterQueryByIndex.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/DownKey.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/EnterKey.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/GoBack.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/LeftKey.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/PressMenu.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/RightKey.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/SelectFromMenuByText.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/UpKey.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java +36 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/SelectSpinnerItemByContentDescription.java +43 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertGridViewContainsNoDuplicates.java +72 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertText.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertTextOfSpecificTextViewByContentDescription.java +32 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextById.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextByIndex.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextFieldByContentDescription.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClickOnText.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextByContentDescription.java +32 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextById.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextByIndex.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/GetTextById.java +42 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetDateByContentDescription.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetDateByIndex.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByContentDescription.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByIndex.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/version/Version.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/AssertViewProperty.java +141 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewByDescription.java +46 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewById.java +56 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetActivityName.java +32 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetViewProperty.java +101 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/HasView.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/IsCurrentActivityFocused.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/IsEnabled.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/LongPressOnViewById.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/Press.java +89 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/SelectTab.java +110 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/Wait.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForDialogClose.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForProgress.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForScreen.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForTab.java +108 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForView.java +43 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForViewById.java +51 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/CalabashChromeClient.java +180 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/DumpBodyHtml.java +53 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/DumpHtml.java +55 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/EnterTextByCssSelector.java +121 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/ExecuteAsyncJavascript.java +77 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/ExecuteJavascript.java +75 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/GetLoadProgress.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/GetUrl.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/JavaScriptOperation.java +44 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/PressByCssSelector.java +70 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/QueryHelper.java +104 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/ScrollTo.java +87 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/SetPropertyByCssSelector.java +69 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/SetText.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/CompletedFuture.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/InvocationOperation.java +222 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/Operation.java +7 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/PropertyOperation.java +56 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/Query.java +181 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java +27 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQuery.tokens +19 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQueryResultVoid.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ViewMapper.java +93 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryLexer.java +1713 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryParser.java +771 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/BeginsWithRelation.java +45 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ComparisonOperator.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ContainsRelation.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/EndsWithRelation.java +42 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java +10 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/LikeRelation.java +79 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/PartialFutureList.java +100 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryAST.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTClassName.java +142 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicate.java +147 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicateRelation.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTWith.java +202 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryDirection.java +15 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryEvaluator.java +99 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryUtils.java +271 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryVisibility.java +32 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Base64Variant.java +413 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Base64Variants.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/FormatSchema.java +29 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonEncoding.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonFactory.java +937 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonGenerationException.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonGenerator.java +1197 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonLocation.java +141 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonNode.java +879 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonParseException.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonParser.java +1434 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonProcessingException.java +80 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonStreamContext.java +122 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/JsonToken.java +161 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/ObjectCodec.java +157 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/PrettyPrinter.java +166 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/SerializableString.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Version.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Versioned.java +20 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JacksonAnnotation.java +20 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonAnyGetter.java +25 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonAnySetter.java +24 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonAutoDetect.java +148 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonBackReference.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonCreator.java +19 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonGetter.java +35 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonIgnore.java +57 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonIgnoreProperties.java +48 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonIgnoreType.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonManagedReference.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonMethod.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonProperty.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonPropertyOrder.java +46 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonRawValue.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonSetter.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonSubTypes.java +44 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonTypeInfo.java +236 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonTypeName.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonUnwrapped.java +76 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonValue.java +46 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/JsonWriteNullProperties.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/annotate/package-info.java +16 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/format/DataFormatDetector.java +176 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/format/DataFormatMatcher.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/format/InputAccessor.java +130 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/format/MatchStrength.java +64 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/format/package-info.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/ByteSourceBootstrapper.java +518 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/DefaultPrettyPrinter.java +13 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/Indenter.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonGeneratorBase.java +570 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonNumericParserBase.java +20 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonParserBase.java +1067 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonParserMinimalBase.java +539 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonReadContext.java +188 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/JsonWriteContext.java +178 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/ReaderBasedParser.java +1815 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/ReaderBasedParserBase.java +228 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/StreamBasedParserBase.java +197 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/Utf8Generator.java +1757 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/Utf8StreamParser.java +2966 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/WriterBasedGenerator.java +1815 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/impl/package-info.java +6 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/BaseReader.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/CharacterEscapes.java +73 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/IOContext.java +239 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/InputDecorator.java +67 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/JsonStringEncoder.java +408 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/MergedStream.java +145 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/NumberInput.java +303 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/NumberOutput.java +398 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/OutputDecorator.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/SegmentedStringWriter.java +104 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/SerializedString.java +114 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/UTF32Reader.java +214 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/UTF8Writer.java +387 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/io/package.html +4 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/AbstractTypeResolver.java +63 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/AnnotationIntrospector.java +1485 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/BeanDescription.java +171 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/BeanProperty.java +123 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/BeanPropertyDefinition.java +66 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ClassIntrospector.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ContextualDeserializer.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ContextualKeyDeserializer.java +33 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ContextualSerializer.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/DeserializationConfig.java +926 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/DeserializationContext.java +262 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/DeserializationProblemHandler.java +56 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/DeserializerFactory.java +356 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/DeserializerProvider.java +185 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/Deserializers.java +339 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/HandlerInstantiator.java +115 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/InjectableValues.java +85 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/JsonDeserializer.java +166 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/JsonMappingException.java +335 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/JsonSerializable.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/JsonSerializableWithType.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/JsonSerializer.java +138 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/KeyDeserializer.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/KeyDeserializers.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/MapperConfig.java +1154 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/MappingIterator.java +190 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/MappingJsonFactory.java +81 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/Module.java +255 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ObjectMapper.java +2885 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ObjectReader.java +958 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ObjectWriter.java +554 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/PropertyNamingStrategy.java +258 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ResolvableDeserializer.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ResolvableSerializer.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/RuntimeJsonMappingException.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/SerializationConfig.java +1041 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/SerializerFactory.java +198 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/SerializerProvider.java +552 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/Serializers.java +137 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/TypeDeserializer.java +118 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/TypeSerializer.java +164 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JacksonInject.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JacksonStdImpl.java +25 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonCachable.java +32 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonDeserialize.java +109 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonFilter.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonRootName.java +29 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonSerialize.java +216 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonTypeIdResolver.java +35 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonTypeResolver.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonValueInstantiator.java +26 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/JsonView.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/NoClass.java +19 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/annotate/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/AbstractDeserializer.java +102 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ArrayDeserializer.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ArrayDeserializers.java +11 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/BasicDeserializerFactory.java +894 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/BeanDeserializer.java +1537 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/BeanDeserializerBuilder.java +277 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/BeanDeserializerFactory.java +1474 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/BeanDeserializerModifier.java +58 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/CollectionDeserializer.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ContainerDeserializer.java +14 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/CustomDeserializerFactory.java +227 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/DateDeserializer.java +9 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/EnumDeserializer.java +15 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/EnumResolver.java +17 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/FromStringDeserializer.java +13 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/JsonNodeDeserializer.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/MapDeserializer.java +44 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/SettableAnyProperty.java +177 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/SettableBeanProperty.java +827 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdDeserializationContext.java +326 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdDeserializer.java +94 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdDeserializerProvider.java +494 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdDeserializers.java +119 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdKeyDeserializer.java +12 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdKeyDeserializers.java +11 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/StdScalarDeserializer.java +13 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ThrowableDeserializer.java +13 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/UntypedObjectDeserializer.java +9 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ValueInstantiator.java +280 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/ValueInstantiators.java +52 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/BeanPropertyMap.java +257 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/CreatorCollector.java +141 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/CreatorProperty.java +152 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/ExternalTypeHandler.java +173 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/PropertyBasedCreator.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/PropertyValue.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/PropertyValueBuffer.java +102 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/UnwrappedPropertyHandler.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/ValueInjector.java +45 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/impl/package-info.java +9 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/AtomicBooleanDeserializer.java +22 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/AtomicReferenceDeserializer.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/CalendarDeserializer.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ClassDeserializer.java +49 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/CollectionDeserializer.java +265 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ContainerDeserializerBase.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/DateDeserializer.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/EnumDeserializer.java +139 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/EnumMapDeserializer.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/EnumSetDeserializer.java +89 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/FromStringDeserializer.java +265 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/JavaTypeDeserializer.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/JsonNodeDeserializer.java +314 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/MapDeserializer.java +412 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ObjectArrayDeserializer.java +201 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/PrimitiveArrayDeserializers.java +583 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StdDeserializer.java +1136 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StdKeyDeserializer.java +340 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StdKeyDeserializers.java +108 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StdScalarDeserializer.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StdValueInstantiator.java +392 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StringCollectionDeserializer.java +227 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/StringDeserializer.java +55 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/ThrowableDeserializer.java +164 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/TimestampDeserializer.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/TokenBufferDeserializer.java +36 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/UntypedObjectDeserializer.java +248 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/deser/std/package-info.java +15 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/exc/UnrecognizedPropertyException.java +75 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ext/DOMDeserializer.java +65 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ext/OptionalHandlerFactory.java +217 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ext/package-info.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/Annotated.java +85 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedClass.java +980 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedConstructor.java +143 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedField.java +119 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedMember.java +56 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedMethod.java +188 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedMethodMap.java +85 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedParameter.java +191 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotatedWithParams.java +195 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/AnnotationMap.java +101 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/BasicBeanDescription.java +615 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/BasicClassIntrospector.java +364 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/JacksonAnnotationIntrospector.java +813 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/MemberKey.java +83 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/MethodFilter.java +12 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/NopAnnotationIntrospector.java +209 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/POJOPropertiesCollector.java +713 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/POJOPropertyBuilder.java +648 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/VisibilityChecker.java +424 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/introspect/package-info.java +12 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/NamedType.java +53 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/SubtypeResolver.java +39 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/TypeIdResolver.java +74 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/TypeResolverBuilder.java +151 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsArrayTypeDeserializer.java +126 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsArrayTypeSerializer.java +110 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsExternalTypeDeserializer.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsExternalTypeSerializer.java +129 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsPropertyTypeDeserializer.java +191 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsPropertyTypeSerializer.java +69 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsWrapperTypeDeserializer.java +103 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/AsWrapperTypeSerializer.java +121 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/ClassNameIdResolver.java +138 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/MinimalClassNameIdResolver.java +66 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/StdSubtypeResolver.java +151 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/StdTypeResolverBuilder.java +202 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeDeserializerBase.java +154 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeIdResolverBase.java +37 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeNameIdResolver.java +154 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeSerializerBase.java +31 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/impl/package-info.java +9 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/jsontype/package-info.java +10 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleAbstractTypeResolver.java +86 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleDeserializers.java +130 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleKeyDeserializers.java +59 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleModule.java +265 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleSerializers.java +206 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/SimpleValueInstantiators.java +45 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/module/package-info.java +16 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/package-info.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/AnyGetterWriter.java +48 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/ArraySerializers.java +7 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BasicSerializerFactory.java +806 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanPropertyFilter.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanPropertyWriter.java +512 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanSerializer.java +126 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanSerializerBuilder.java +140 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanSerializerFactory.java +780 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/BeanSerializerModifier.java +95 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/ContainerSerializers.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/CustomSerializerFactory.java +293 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/EnumSerializer.java +17 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/FilterProvider.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/FilteredBeanPropertyWriter.java +96 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/JdkSerializers.java +11 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/MapSerializer.java +58 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/PropertyBuilder.java +372 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/ScalarSerializerBase.java +18 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/SerializerBase.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/StdKeySerializer.java +10 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/StdSerializerProvider.java +852 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/StdSerializers.java +372 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/ToStringSerializer.java +14 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/FailingSerializer.java +43 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/JsonSerializerMap.java +93 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/PropertySerializerMap.java +231 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/ReadOnlyClassToSerializerMap.java +73 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/SerializerCache.java +304 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/SimpleBeanPropertyFilter.java +109 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/SimpleFilterProvider.java +114 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/UnknownSerializer.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/UnwrappingBeanPropertyWriter.java +99 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/UnwrappingBeanSerializer.java +76 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/impl/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/AsArraySerializerBase.java +185 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/BeanSerializerBase.java +340 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/CalendarSerializer.java +43 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/CollectionSerializer.java +113 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/ContainerSerializerBase.java +51 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/DateSerializer.java +42 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/EnumMapSerializer.java +218 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/EnumSerializer.java +84 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/EnumSetSerializer.java +47 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/IndexedStringListSerializer.java +116 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/InetAddressSerializer.java +51 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/IterableSerializer.java +63 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/JsonValueSerializer.java +233 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/MapSerializer.java +422 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/NonTypedScalarSerializerBase.java +34 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/NullSerializer.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/ObjectArraySerializer.java +281 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/RawSerializer.java +52 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/ScalarSerializerBase.java +52 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/SerializableSerializer.java +99 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/SerializableWithTypeSerializer.java +90 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/SerializerBase.java +184 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StaticListSerializerBase.java +46 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StdArraySerializers.java +476 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StdContainerSerializers.java +249 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StdJdkSerializers.java +195 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StdKeySerializer.java +43 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StdKeySerializers.java +95 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StringCollectionSerializer.java +119 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/StringSerializer.java +36 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/TimeZoneSerializer.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/ToStringSerializer.java +73 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ser/std/TokenBufferSerializer.java +66 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/ArrayType.java +260 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/ClassKey.java +94 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/CollectionLikeType.java +204 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/CollectionType.java +94 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/HierarchicType.java +88 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/MapLikeType.java +265 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/MapType.java +146 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/SimpleType.java +250 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/TypeBase.java +148 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/TypeBindings.java +351 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/TypeFactory.java +1165 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/TypeModifier.java +38 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/TypeParser.java +134 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/type/package-info.java +10 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/Annotations.java +23 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/ArrayBuilders.java +293 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/BeanUtil.java +260 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/ClassUtil.java +645 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/Comparators.java +48 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/EnumResolver.java +108 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/EnumValues.java +82 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/ISO8601DateFormat.java +52 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/ISO8601Utils.java +230 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/JSONPObject.java +105 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/JSONWrappedObject.java +117 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/LRUMap.java +28 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/LinkedNode.java +45 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/Named.java +10 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/ObjectBuffer.java +257 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/PrimitiveArrayBuilder.java +180 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/Provider.java +21 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/RootNameLookup.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/StdDateFormat.java +348 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/util/package-info.java +4 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/ArrayNode.java +758 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/BaseJsonNode.java +122 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/BigIntegerNode.java +104 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/BinaryNode.java +136 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/BooleanNode.java +84 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/ContainerNode.java +185 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/DecimalNode.java +96 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/DoubleNode.java +106 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/IntNode.java +122 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/JsonNodeFactory.java +222 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/LongNode.java +99 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/MissingNode.java +97 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/NodeCursor.java +222 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/NullNode.java +58 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/NumericNode.java +72 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/ObjectNode.java +696 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/POJONode.java +145 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/TextNode.java +299 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/TreeTraversingParser.java +383 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/ValueNode.java +58 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/node/package-info.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/package-info.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/schema/JsonSchema.java +82 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/schema/JsonSerializableSchema.java +46 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/schema/SchemaAware.java +25 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/schema/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/BytesToNameCanonicalizer.java +969 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/CharsToNameCanonicalizer.java +578 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/Name.java +50 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/Name1.java +44 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/Name2.java +40 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/Name3.java +39 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/NameN.java +68 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/sym/package-info.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/type/JavaType.java +503 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/type/TypeReference.java +60 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/type/package-info.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/BufferRecycler.java +109 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/ByteArrayBuilder.java +294 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/CharTypes.java +237 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/DefaultPrettyPrinter.java +282 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/InternCache.java +49 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/JsonGeneratorDelegate.java +273 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/JsonParserDelegate.java +251 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/JsonParserSequence.java +150 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/MinimalPrettyPrinter.java +152 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/TextBuffer.java +707 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/TokenBuffer.java +1233 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/VersionUtil.java +79 -0
- data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/package-info.java +4 -0
- metadata +868 -0
data/test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/map/ObjectMapper.java
ADDED
|
@@ -0,0 +1,2885 @@
|
|
|
1
|
+
package sh.calaba.org.codehaus.jackson.map;
|
|
2
|
+
|
|
3
|
+
import java.io.Closeable;
|
|
4
|
+
import java.io.EOFException;
|
|
5
|
+
import java.io.File;
|
|
6
|
+
import java.io.IOException;
|
|
7
|
+
import java.io.InputStream;
|
|
8
|
+
import java.io.OutputStream;
|
|
9
|
+
import java.io.Reader;
|
|
10
|
+
import java.io.Writer;
|
|
11
|
+
import java.lang.reflect.Type;
|
|
12
|
+
import java.net.URL;
|
|
13
|
+
import java.text.DateFormat;
|
|
14
|
+
import java.util.Collection;
|
|
15
|
+
import java.util.concurrent.ConcurrentHashMap;
|
|
16
|
+
|
|
17
|
+
import sh.calaba.org.codehaus.jackson.FormatSchema;
|
|
18
|
+
import sh.calaba.org.codehaus.jackson.JsonEncoding;
|
|
19
|
+
import sh.calaba.org.codehaus.jackson.JsonFactory;
|
|
20
|
+
import sh.calaba.org.codehaus.jackson.JsonGenerationException;
|
|
21
|
+
import sh.calaba.org.codehaus.jackson.JsonGenerator;
|
|
22
|
+
import sh.calaba.org.codehaus.jackson.JsonNode;
|
|
23
|
+
import sh.calaba.org.codehaus.jackson.JsonParseException;
|
|
24
|
+
import sh.calaba.org.codehaus.jackson.JsonParser;
|
|
25
|
+
import sh.calaba.org.codehaus.jackson.JsonProcessingException;
|
|
26
|
+
import sh.calaba.org.codehaus.jackson.JsonToken;
|
|
27
|
+
import sh.calaba.org.codehaus.jackson.ObjectCodec;
|
|
28
|
+
import sh.calaba.org.codehaus.jackson.PrettyPrinter;
|
|
29
|
+
import sh.calaba.org.codehaus.jackson.Version;
|
|
30
|
+
import sh.calaba.org.codehaus.jackson.Versioned;
|
|
31
|
+
import sh.calaba.org.codehaus.jackson.annotate.JsonAutoDetect;
|
|
32
|
+
import sh.calaba.org.codehaus.jackson.annotate.JsonMethod;
|
|
33
|
+
import sh.calaba.org.codehaus.jackson.annotate.JsonTypeInfo;
|
|
34
|
+
import sh.calaba.org.codehaus.jackson.io.SegmentedStringWriter;
|
|
35
|
+
import sh.calaba.org.codehaus.jackson.io.SerializedString;
|
|
36
|
+
import sh.calaba.org.codehaus.jackson.map.annotate.JsonSerialize;
|
|
37
|
+
import sh.calaba.org.codehaus.jackson.map.deser.BeanDeserializerModifier;
|
|
38
|
+
import sh.calaba.org.codehaus.jackson.map.deser.StdDeserializationContext;
|
|
39
|
+
import sh.calaba.org.codehaus.jackson.map.deser.StdDeserializerProvider;
|
|
40
|
+
import sh.calaba.org.codehaus.jackson.map.deser.ValueInstantiators;
|
|
41
|
+
import sh.calaba.org.codehaus.jackson.map.introspect.BasicClassIntrospector;
|
|
42
|
+
import sh.calaba.org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector;
|
|
43
|
+
import sh.calaba.org.codehaus.jackson.map.introspect.VisibilityChecker;
|
|
44
|
+
import sh.calaba.org.codehaus.jackson.map.jsontype.NamedType;
|
|
45
|
+
import sh.calaba.org.codehaus.jackson.map.jsontype.SubtypeResolver;
|
|
46
|
+
import sh.calaba.org.codehaus.jackson.map.jsontype.TypeResolverBuilder;
|
|
47
|
+
import sh.calaba.org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver;
|
|
48
|
+
import sh.calaba.org.codehaus.jackson.map.jsontype.impl.StdTypeResolverBuilder;
|
|
49
|
+
import sh.calaba.org.codehaus.jackson.map.ser.BeanSerializerFactory;
|
|
50
|
+
import sh.calaba.org.codehaus.jackson.map.ser.BeanSerializerModifier;
|
|
51
|
+
import sh.calaba.org.codehaus.jackson.map.ser.FilterProvider;
|
|
52
|
+
import sh.calaba.org.codehaus.jackson.map.ser.StdSerializerProvider;
|
|
53
|
+
import sh.calaba.org.codehaus.jackson.map.type.SimpleType;
|
|
54
|
+
import sh.calaba.org.codehaus.jackson.map.type.TypeFactory;
|
|
55
|
+
import sh.calaba.org.codehaus.jackson.map.type.TypeModifier;
|
|
56
|
+
import sh.calaba.org.codehaus.jackson.node.ArrayNode;
|
|
57
|
+
import sh.calaba.org.codehaus.jackson.node.JsonNodeFactory;
|
|
58
|
+
import sh.calaba.org.codehaus.jackson.node.NullNode;
|
|
59
|
+
import sh.calaba.org.codehaus.jackson.node.ObjectNode;
|
|
60
|
+
import sh.calaba.org.codehaus.jackson.node.TreeTraversingParser;
|
|
61
|
+
import sh.calaba.org.codehaus.jackson.schema.JsonSchema;
|
|
62
|
+
import sh.calaba.org.codehaus.jackson.type.JavaType;
|
|
63
|
+
import sh.calaba.org.codehaus.jackson.type.TypeReference;
|
|
64
|
+
import sh.calaba.org.codehaus.jackson.util.ByteArrayBuilder;
|
|
65
|
+
import sh.calaba.org.codehaus.jackson.util.DefaultPrettyPrinter;
|
|
66
|
+
import sh.calaba.org.codehaus.jackson.util.TokenBuffer;
|
|
67
|
+
import sh.calaba.org.codehaus.jackson.util.VersionUtil;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* This mapper (or, data binder, or codec) provides functionality for
|
|
71
|
+
* converting between Java objects (instances of JDK provided core classes,
|
|
72
|
+
* beans), and matching JSON constructs.
|
|
73
|
+
* It will use instances of {@link JsonParser} and {@link JsonGenerator}
|
|
74
|
+
* for implementing actual reading/writing of JSON.
|
|
75
|
+
*<p>
|
|
76
|
+
* The main conversion API is defined in {@link ObjectCodec}, so that
|
|
77
|
+
* implementation details of this class need not be exposed to
|
|
78
|
+
* streaming parser and generator classes.
|
|
79
|
+
*<p>
|
|
80
|
+
* Note on caching: root-level deserializers are always cached, and accessed
|
|
81
|
+
* using full (generics-aware) type information. This is different from
|
|
82
|
+
* caching of referenced types, which is more limited and is done only
|
|
83
|
+
* for a subset of all deserializer types. The main reason for difference
|
|
84
|
+
* is that at root-level there is no incoming reference (and hence no
|
|
85
|
+
* referencing property, no referral information or annotations to
|
|
86
|
+
* produce differing deserializers), and that the performance impact
|
|
87
|
+
* greatest at root level (since it'll essentially cache the full
|
|
88
|
+
* graph of deserializers involved).
|
|
89
|
+
*/
|
|
90
|
+
public class ObjectMapper
|
|
91
|
+
extends ObjectCodec
|
|
92
|
+
implements Versioned
|
|
93
|
+
{
|
|
94
|
+
/*
|
|
95
|
+
/**********************************************************
|
|
96
|
+
/* Helper classes, enums
|
|
97
|
+
/**********************************************************
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Enumeration used with {@link ObjectMapper#enableDefaultTyping()}
|
|
102
|
+
* to specify what kind of types (classes) default typing should
|
|
103
|
+
* be used for. It will only be used if no explicit type information
|
|
104
|
+
* is found, but this enumeration further limits subset of those
|
|
105
|
+
* types.
|
|
106
|
+
*
|
|
107
|
+
* @since 1.5
|
|
108
|
+
*/
|
|
109
|
+
public enum DefaultTyping {
|
|
110
|
+
/**
|
|
111
|
+
* This value means that only properties that have
|
|
112
|
+
* {@link java.lang.Object} as declared type (including
|
|
113
|
+
* generic types without explicit type) will use default
|
|
114
|
+
* typing.
|
|
115
|
+
*/
|
|
116
|
+
JAVA_LANG_OBJECT,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Value that means that default typing will be used for
|
|
120
|
+
* properties with declared type of {@link java.lang.Object}
|
|
121
|
+
* or an abstract type (abstract class or interface).
|
|
122
|
+
* Note that this does <b>not</b> include array types.
|
|
123
|
+
*/
|
|
124
|
+
OBJECT_AND_NON_CONCRETE,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Value that means that default typing will be used for
|
|
128
|
+
* all types covered by {@link #OBJECT_AND_NON_CONCRETE}
|
|
129
|
+
* plus all array types for them.
|
|
130
|
+
*/
|
|
131
|
+
NON_CONCRETE_AND_ARRAYS,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Value that means that default typing will be used for
|
|
135
|
+
* all non-final types, with exception of small number of
|
|
136
|
+
* "natural" types (String, Boolean, Integer, Double), which
|
|
137
|
+
* can be correctly inferred from JSON; as well as for
|
|
138
|
+
* all arrays of non-final types.
|
|
139
|
+
*/
|
|
140
|
+
NON_FINAL
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Customized {@link TypeResolverBuilder} that provides type resolver builders
|
|
145
|
+
* used with so-called "default typing"
|
|
146
|
+
* (see {@link ObjectMapper#enableDefaultTyping()} for details).
|
|
147
|
+
*<p>
|
|
148
|
+
* Type resolver construction is based on configuration: implementation takes care
|
|
149
|
+
* of only providing builders in cases where type information should be applied.
|
|
150
|
+
* This is important since build calls may be sent for any and all types, and
|
|
151
|
+
* type information should NOT be applied to all of them.
|
|
152
|
+
*/
|
|
153
|
+
public static class DefaultTypeResolverBuilder
|
|
154
|
+
extends StdTypeResolverBuilder
|
|
155
|
+
{
|
|
156
|
+
/**
|
|
157
|
+
* Definition of what types is this default typer valid for.
|
|
158
|
+
*/
|
|
159
|
+
protected final DefaultTyping _appliesFor;
|
|
160
|
+
|
|
161
|
+
public DefaultTypeResolverBuilder(DefaultTyping t) {
|
|
162
|
+
_appliesFor = t;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@Override
|
|
166
|
+
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config,
|
|
167
|
+
JavaType baseType, Collection<NamedType> subtypes, BeanProperty property)
|
|
168
|
+
{
|
|
169
|
+
return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes, property) : null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@Override
|
|
173
|
+
public TypeSerializer buildTypeSerializer(SerializationConfig config,
|
|
174
|
+
JavaType baseType, Collection<NamedType> subtypes, BeanProperty property)
|
|
175
|
+
{
|
|
176
|
+
return useForType(baseType) ? super.buildTypeSerializer(config, baseType, subtypes, property) : null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Method called to check if the default type handler should be
|
|
181
|
+
* used for given type.
|
|
182
|
+
* Note: "natural types" (String, Boolean, Integer, Double) will never
|
|
183
|
+
* use typing; that is both due to them being concrete and final,
|
|
184
|
+
* and since actual serializers and deserializers will also ignore any
|
|
185
|
+
* attempts to enforce typing.
|
|
186
|
+
*/
|
|
187
|
+
public boolean useForType(JavaType t)
|
|
188
|
+
{
|
|
189
|
+
switch (_appliesFor) {
|
|
190
|
+
case NON_CONCRETE_AND_ARRAYS:
|
|
191
|
+
if (t.isArrayType()) {
|
|
192
|
+
t = t.getContentType();
|
|
193
|
+
}
|
|
194
|
+
// fall through
|
|
195
|
+
case OBJECT_AND_NON_CONCRETE:
|
|
196
|
+
return (t.getRawClass() == Object.class) || !t.isConcrete();
|
|
197
|
+
case NON_FINAL:
|
|
198
|
+
if (t.isArrayType()) {
|
|
199
|
+
t = t.getContentType();
|
|
200
|
+
}
|
|
201
|
+
return !t.isFinal(); // includes Object.class
|
|
202
|
+
default:
|
|
203
|
+
//case JAVA_LANG_OBJECT:
|
|
204
|
+
return (t.getRawClass() == Object.class);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/*
|
|
210
|
+
/**********************************************************
|
|
211
|
+
/* Internal constants, singletons
|
|
212
|
+
/**********************************************************
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
// Quick little shortcut, to avoid having to use global TypeFactory instance...
|
|
216
|
+
private final static JavaType JSON_NODE_TYPE = SimpleType.constructUnsafe(JsonNode.class);
|
|
217
|
+
|
|
218
|
+
/* !!! 03-Apr-2009, tatu: Should try to avoid direct reference... but not
|
|
219
|
+
* sure what'd be simple and elegant way. So until then:
|
|
220
|
+
*/
|
|
221
|
+
protected final static ClassIntrospector<? extends BeanDescription> DEFAULT_INTROSPECTOR = BasicClassIntrospector.instance;
|
|
222
|
+
|
|
223
|
+
// 16-May-2009, tatu: Ditto ^^^
|
|
224
|
+
protected final static AnnotationIntrospector DEFAULT_ANNOTATION_INTROSPECTOR = new JacksonAnnotationIntrospector();
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @since 1.5
|
|
228
|
+
*/
|
|
229
|
+
protected final static VisibilityChecker<?> STD_VISIBILITY_CHECKER = VisibilityChecker.Std.defaultInstance();
|
|
230
|
+
|
|
231
|
+
/*
|
|
232
|
+
/**********************************************************
|
|
233
|
+
/* Configuration settings, shared
|
|
234
|
+
/**********************************************************
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Factory used to create {@link JsonParser} and {@link JsonGenerator}
|
|
239
|
+
* instances as necessary.
|
|
240
|
+
*/
|
|
241
|
+
protected final JsonFactory _jsonFactory;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Registered concrete subtypes that can be used instead of (or
|
|
245
|
+
* in addition to) ones declared using annotations.
|
|
246
|
+
*
|
|
247
|
+
* @since 1.6
|
|
248
|
+
*/
|
|
249
|
+
protected SubtypeResolver _subtypeResolver;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Specific factory used for creating {@link JavaType} instances;
|
|
253
|
+
* needed to allow modules to add more custom type handling
|
|
254
|
+
* (mostly to support types of non-Java JVM languages)
|
|
255
|
+
*/
|
|
256
|
+
protected TypeFactory _typeFactory;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Provider for values to inject in deserialized POJOs.
|
|
260
|
+
*
|
|
261
|
+
* @since 1.9
|
|
262
|
+
*/
|
|
263
|
+
protected InjectableValues _injectableValues;
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
/**********************************************************
|
|
267
|
+
/* Configuration settings, serialization
|
|
268
|
+
/**********************************************************
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Configuration object that defines basic global
|
|
273
|
+
* settings for the serialization process
|
|
274
|
+
*/
|
|
275
|
+
protected SerializationConfig _serializationConfig;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Object that manages access to serializers used for serialization,
|
|
279
|
+
* including caching.
|
|
280
|
+
* It is configured with {@link #_serializerFactory} to allow
|
|
281
|
+
* for constructing custom serializers.
|
|
282
|
+
*/
|
|
283
|
+
protected SerializerProvider _serializerProvider;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Serializer factory used for constructing serializers.
|
|
287
|
+
*/
|
|
288
|
+
protected SerializerFactory _serializerFactory;
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
/**********************************************************
|
|
292
|
+
/* Configuration settings, deserialization
|
|
293
|
+
/**********************************************************
|
|
294
|
+
*/
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Configuration object that defines basic global
|
|
298
|
+
* settings for the serialization process
|
|
299
|
+
*/
|
|
300
|
+
protected DeserializationConfig _deserializationConfig;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Object that manages access to deserializers used for deserializing
|
|
304
|
+
* JSON content into Java objects, including possible caching
|
|
305
|
+
* of the deserializers. It contains a reference to
|
|
306
|
+
* {@link DeserializerFactory} to use for constructing acutal deserializers.
|
|
307
|
+
*/
|
|
308
|
+
protected DeserializerProvider _deserializerProvider;
|
|
309
|
+
|
|
310
|
+
/*
|
|
311
|
+
/**********************************************************
|
|
312
|
+
/* Caching
|
|
313
|
+
/**********************************************************
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/* Note: handling of serializers and deserializers is not symmetric;
|
|
317
|
+
* and as a result, only root-level deserializers can be cached here.
|
|
318
|
+
* This is mostly because typing and resolution for deserializers is
|
|
319
|
+
* fully static; whereas it is quite dynamic for serialization.
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* We will use a separate main-level Map for keeping track
|
|
324
|
+
* of root-level deserializers. This is where most succesful
|
|
325
|
+
* cache lookups get resolved.
|
|
326
|
+
* Map will contain resolvers for all kinds of types, including
|
|
327
|
+
* container types: this is different from the component cache
|
|
328
|
+
* which will only cache bean deserializers.
|
|
329
|
+
*<p>
|
|
330
|
+
* Given that we don't expect much concurrency for additions
|
|
331
|
+
* (should very quickly converge to zero after startup), let's
|
|
332
|
+
* explicitly define a low concurrency setting.
|
|
333
|
+
*<p>
|
|
334
|
+
* Since version 1.5, these may are either "raw" deserializers (when
|
|
335
|
+
* no type information is needed for base type), or type-wrapped
|
|
336
|
+
* deserializers (if it is needed)
|
|
337
|
+
*/
|
|
338
|
+
final protected ConcurrentHashMap<JavaType, JsonDeserializer<Object>> _rootDeserializers
|
|
339
|
+
= new ConcurrentHashMap<JavaType, JsonDeserializer<Object>>(64, 0.6f, 2);
|
|
340
|
+
|
|
341
|
+
/*
|
|
342
|
+
/**********************************************************
|
|
343
|
+
/* Life-cycle: constructing instance
|
|
344
|
+
/**********************************************************
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Default constructor, which will construct the default
|
|
349
|
+
* {@link JsonFactory} as necessary, use
|
|
350
|
+
* {@link StdSerializerProvider} as its
|
|
351
|
+
* {@link SerializerProvider}, and
|
|
352
|
+
* {@link BeanSerializerFactory} as its
|
|
353
|
+
* {@link SerializerFactory}.
|
|
354
|
+
* This means that it
|
|
355
|
+
* can serialize all standard JDK types, as well as regular
|
|
356
|
+
* Java Beans (based on method names and Jackson-specific annotations),
|
|
357
|
+
* but does not support JAXB annotations.
|
|
358
|
+
*/
|
|
359
|
+
public ObjectMapper()
|
|
360
|
+
{
|
|
361
|
+
this(null, null, null);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Construct mapper that uses specified {@link JsonFactory}
|
|
366
|
+
* for constructing necessary {@link JsonParser}s and/or
|
|
367
|
+
* {@link JsonGenerator}s.
|
|
368
|
+
*/
|
|
369
|
+
public ObjectMapper(JsonFactory jf)
|
|
370
|
+
{
|
|
371
|
+
this(jf, null, null);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Construct mapper that uses specified {@link SerializerFactory}
|
|
376
|
+
* for constructing necessary serializers.
|
|
377
|
+
*
|
|
378
|
+
* @deprecated Use other constructors instead; note that
|
|
379
|
+
* you can just set serializer factory with {@link #setSerializerFactory}
|
|
380
|
+
*/
|
|
381
|
+
@Deprecated
|
|
382
|
+
public ObjectMapper(SerializerFactory sf)
|
|
383
|
+
{
|
|
384
|
+
this(null, null, null);
|
|
385
|
+
setSerializerFactory(sf);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
public ObjectMapper(JsonFactory jf,
|
|
389
|
+
SerializerProvider sp, DeserializerProvider dp)
|
|
390
|
+
{
|
|
391
|
+
this(jf, sp, dp, null, null);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
*
|
|
396
|
+
* @param jf JsonFactory to use: if null, a new {@link MappingJsonFactory} will be constructed
|
|
397
|
+
* @param sp SerializerProvider to use: if null, a {@link StdSerializerProvider} will be constructed
|
|
398
|
+
* @param dp DeserializerProvider to use: if null, a {@link StdDeserializerProvider} will be constructed
|
|
399
|
+
* @param sconfig Serialization configuration to use; if null, basic {@link SerializationConfig}
|
|
400
|
+
* will be constructed
|
|
401
|
+
* @param dconfig Deserialization configuration to use; if null, basic {@link DeserializationConfig}
|
|
402
|
+
* will be constructed
|
|
403
|
+
*/
|
|
404
|
+
public ObjectMapper(JsonFactory jf,
|
|
405
|
+
SerializerProvider sp, DeserializerProvider dp,
|
|
406
|
+
SerializationConfig sconfig, DeserializationConfig dconfig)
|
|
407
|
+
{
|
|
408
|
+
/* 02-Mar-2009, tatu: Important: we MUST default to using
|
|
409
|
+
* the mapping factory, otherwise tree serialization will
|
|
410
|
+
* have problems with POJONodes.
|
|
411
|
+
* 03-Jan-2010, tatu: and obviously we also must pass 'this',
|
|
412
|
+
* to create actual linking.
|
|
413
|
+
*/
|
|
414
|
+
if (jf == null) {
|
|
415
|
+
_jsonFactory = new MappingJsonFactory(this);
|
|
416
|
+
} else {
|
|
417
|
+
_jsonFactory = jf;
|
|
418
|
+
if (jf.getCodec() == null) { // as per [JACKSON-741]
|
|
419
|
+
_jsonFactory.setCodec(this);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// and default type factory is shared one
|
|
423
|
+
_typeFactory = TypeFactory.defaultInstance();
|
|
424
|
+
_serializationConfig = (sconfig != null) ? sconfig :
|
|
425
|
+
new SerializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER,
|
|
426
|
+
null, null, _typeFactory, null);
|
|
427
|
+
_deserializationConfig = (dconfig != null) ? dconfig :
|
|
428
|
+
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, STD_VISIBILITY_CHECKER,
|
|
429
|
+
null, null, _typeFactory, null);
|
|
430
|
+
_serializerProvider = (sp == null) ? new StdSerializerProvider() : sp;
|
|
431
|
+
_deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
|
|
432
|
+
|
|
433
|
+
// Default serializer factory is stateless, can just assign
|
|
434
|
+
_serializerFactory = BeanSerializerFactory.instance;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/*
|
|
438
|
+
/**********************************************************
|
|
439
|
+
/* Versioned impl
|
|
440
|
+
/**********************************************************
|
|
441
|
+
*/
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Method that will return version information stored in and read from jar
|
|
445
|
+
* that contains this class.
|
|
446
|
+
*
|
|
447
|
+
* @since 1.6
|
|
448
|
+
*/
|
|
449
|
+
@Override
|
|
450
|
+
public Version version() {
|
|
451
|
+
return VersionUtil.versionFor(getClass());
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/*
|
|
455
|
+
/**********************************************************
|
|
456
|
+
/* Module registration
|
|
457
|
+
/**********************************************************
|
|
458
|
+
*/
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Method for registering a module that can extend functionality
|
|
462
|
+
* provided by this mapper; for example, by adding providers for
|
|
463
|
+
* custom serializers and deserializers.
|
|
464
|
+
*
|
|
465
|
+
* @param module Module to register
|
|
466
|
+
*
|
|
467
|
+
* @since 1.7
|
|
468
|
+
*/
|
|
469
|
+
public void registerModule(Module module)
|
|
470
|
+
{
|
|
471
|
+
/* Let's ensure we have access to name and version information,
|
|
472
|
+
* even if we do not have immediate use for either. This way we know
|
|
473
|
+
* that they will be available from beginning
|
|
474
|
+
*/
|
|
475
|
+
String name = module.getModuleName();
|
|
476
|
+
if (name == null) {
|
|
477
|
+
throw new IllegalArgumentException("Module without defined name");
|
|
478
|
+
}
|
|
479
|
+
Version version = module.version();
|
|
480
|
+
if (version == null) {
|
|
481
|
+
throw new IllegalArgumentException("Module without defined version");
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
final ObjectMapper mapper = this;
|
|
485
|
+
|
|
486
|
+
// And then call registration
|
|
487
|
+
module.setupModule(new Module.SetupContext()
|
|
488
|
+
{
|
|
489
|
+
// // // Accessors
|
|
490
|
+
|
|
491
|
+
@Override
|
|
492
|
+
public Version getMapperVersion() {
|
|
493
|
+
return version();
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
@Override
|
|
497
|
+
public DeserializationConfig getDeserializationConfig() {
|
|
498
|
+
return mapper.getDeserializationConfig();
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@Override
|
|
502
|
+
public SerializationConfig getSerializationConfig() {
|
|
503
|
+
return mapper.getSerializationConfig();
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
@Override
|
|
507
|
+
public boolean isEnabled(DeserializationConfig.Feature f) {
|
|
508
|
+
return mapper.isEnabled(f);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
@Override
|
|
512
|
+
public boolean isEnabled(SerializationConfig.Feature f) {
|
|
513
|
+
return mapper.isEnabled(f);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
@Override
|
|
517
|
+
public boolean isEnabled(JsonParser.Feature f) {
|
|
518
|
+
return mapper.isEnabled(f);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
@Override
|
|
522
|
+
public boolean isEnabled(JsonGenerator.Feature f) {
|
|
523
|
+
return mapper.isEnabled(f);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// // // Methods for registering handlers: deserializers, serializers
|
|
527
|
+
|
|
528
|
+
@Override
|
|
529
|
+
public void addDeserializers(Deserializers d) {
|
|
530
|
+
mapper._deserializerProvider = mapper._deserializerProvider.withAdditionalDeserializers(d);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
@Override
|
|
534
|
+
public void addKeyDeserializers(KeyDeserializers d) {
|
|
535
|
+
mapper._deserializerProvider = mapper._deserializerProvider.withAdditionalKeyDeserializers(d);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@Override
|
|
539
|
+
public void addSerializers(Serializers s) {
|
|
540
|
+
mapper._serializerFactory = mapper._serializerFactory.withAdditionalSerializers(s);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
@Override
|
|
544
|
+
public void addKeySerializers(Serializers s) {
|
|
545
|
+
mapper._serializerFactory = mapper._serializerFactory.withAdditionalKeySerializers(s);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
@Override
|
|
549
|
+
public void addBeanSerializerModifier(BeanSerializerModifier modifier) {
|
|
550
|
+
mapper._serializerFactory = mapper._serializerFactory.withSerializerModifier(modifier);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
@Override
|
|
554
|
+
public void addBeanDeserializerModifier(BeanDeserializerModifier modifier) {
|
|
555
|
+
mapper._deserializerProvider = mapper._deserializerProvider.withDeserializerModifier(modifier);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// // // Methods for registering handlers: other
|
|
559
|
+
|
|
560
|
+
@Override
|
|
561
|
+
public void addAbstractTypeResolver(AbstractTypeResolver resolver) {
|
|
562
|
+
mapper._deserializerProvider = mapper._deserializerProvider.withAbstractTypeResolver(resolver);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
@Override
|
|
566
|
+
public void addTypeModifier(TypeModifier modifier) {
|
|
567
|
+
TypeFactory f = mapper._typeFactory;
|
|
568
|
+
f = f.withModifier(modifier);
|
|
569
|
+
mapper.setTypeFactory(f);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
@Override
|
|
573
|
+
public void addValueInstantiators(ValueInstantiators instantiators) {
|
|
574
|
+
mapper._deserializerProvider = mapper._deserializerProvider.withValueInstantiators(instantiators);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
@Override
|
|
578
|
+
public void insertAnnotationIntrospector(AnnotationIntrospector ai) {
|
|
579
|
+
mapper._deserializationConfig = mapper._deserializationConfig.withInsertedAnnotationIntrospector(ai);
|
|
580
|
+
mapper._serializationConfig = mapper._serializationConfig.withInsertedAnnotationIntrospector(ai);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
@Override
|
|
584
|
+
public void appendAnnotationIntrospector(AnnotationIntrospector ai) {
|
|
585
|
+
mapper._deserializationConfig = mapper._deserializationConfig.withAppendedAnnotationIntrospector(ai);
|
|
586
|
+
mapper._serializationConfig = mapper._serializationConfig.withAppendedAnnotationIntrospector(ai);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
@Override
|
|
590
|
+
public void setMixInAnnotations(Class<?> target, Class<?> mixinSource) {
|
|
591
|
+
mapper._deserializationConfig.addMixInAnnotations(target, mixinSource);
|
|
592
|
+
mapper._serializationConfig.addMixInAnnotations(target, mixinSource);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Fluent-style alternative to {@link #registerModule}; functionally equivalent to:
|
|
599
|
+
*<pre>
|
|
600
|
+
* mapper.registerModule(module);
|
|
601
|
+
* return mapper;
|
|
602
|
+
*</pre>
|
|
603
|
+
* NOTE: name is unfortunately misleading in suggesting that a new instance
|
|
604
|
+
* might be created (as is the case with most other 'withXxx()' methods
|
|
605
|
+
* for Jackson core objects) -- this is not the case; rather, this is just
|
|
606
|
+
* a variant of {@link #registerModule} but one that returns 'this'
|
|
607
|
+
* (like it should return, but does not for historical reasons).
|
|
608
|
+
*
|
|
609
|
+
* @since 1.8
|
|
610
|
+
*/
|
|
611
|
+
public ObjectMapper withModule(Module module)
|
|
612
|
+
{
|
|
613
|
+
registerModule(module);
|
|
614
|
+
return this;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/*
|
|
618
|
+
/**********************************************************
|
|
619
|
+
/* Configuration: main config object access
|
|
620
|
+
/**********************************************************
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Method that returns the shared default {@link SerializationConfig}
|
|
625
|
+
* object that defines configuration settings for serialization.
|
|
626
|
+
* Returned object is "live" meaning that changes will be used
|
|
627
|
+
* for future serialization operations for this mapper when using
|
|
628
|
+
* mapper's default configuration
|
|
629
|
+
*/
|
|
630
|
+
public SerializationConfig getSerializationConfig() {
|
|
631
|
+
return _serializationConfig;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Method that creates a copy of
|
|
636
|
+
* the shared default {@link SerializationConfig} object
|
|
637
|
+
* that defines configuration settings for serialization.
|
|
638
|
+
* Since it is a copy, any changes made to the configuration
|
|
639
|
+
* object will NOT directly affect serialization done using
|
|
640
|
+
* basic serialization methods that use the shared object (that is,
|
|
641
|
+
* ones that do not take separate {@link SerializationConfig}
|
|
642
|
+
* argument.
|
|
643
|
+
*<p>
|
|
644
|
+
* The use case is that of changing object settings of the configuration
|
|
645
|
+
* (like date format being used, see {@link SerializationConfig#setDateFormat}).
|
|
646
|
+
*/
|
|
647
|
+
public SerializationConfig copySerializationConfig() {
|
|
648
|
+
return _serializationConfig.createUnshared(_subtypeResolver);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Method for replacing the shared default serialization configuration
|
|
653
|
+
* object.
|
|
654
|
+
*/
|
|
655
|
+
public ObjectMapper setSerializationConfig(SerializationConfig cfg) {
|
|
656
|
+
_serializationConfig = cfg;
|
|
657
|
+
return this;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Method that returns
|
|
662
|
+
* the shared default {@link DeserializationConfig} object
|
|
663
|
+
* that defines configuration settings for deserialization.
|
|
664
|
+
* Returned object is "live" meaning that changes will be used
|
|
665
|
+
* for future deserialization operations for this mapper when using
|
|
666
|
+
* mapper's default configuration
|
|
667
|
+
*/
|
|
668
|
+
public DeserializationConfig getDeserializationConfig() {
|
|
669
|
+
return _deserializationConfig;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Method that creates a copy of
|
|
674
|
+
* the shared default {@link DeserializationConfig} object
|
|
675
|
+
* that defines configuration settings for deserialization.
|
|
676
|
+
* Since it is a copy, any changes made to the configuration
|
|
677
|
+
* object will NOT directly affect deserialization done using
|
|
678
|
+
* basic deserialization methods that use the shared object (that is,
|
|
679
|
+
* ones that do not take separate {@link DeserializationConfig}
|
|
680
|
+
* argument.
|
|
681
|
+
*<p>
|
|
682
|
+
* The use case is that of changing object settings of the configuration
|
|
683
|
+
* (like deserialization problem handler,
|
|
684
|
+
* see {@link DeserializationConfig#addHandler})
|
|
685
|
+
*/
|
|
686
|
+
public DeserializationConfig copyDeserializationConfig() {
|
|
687
|
+
return _deserializationConfig.createUnshared(_subtypeResolver)
|
|
688
|
+
.passSerializationFeatures(_serializationConfig._featureFlags);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Method for replacing the shared default deserialization configuration
|
|
693
|
+
* object.
|
|
694
|
+
*/
|
|
695
|
+
public ObjectMapper setDeserializationConfig(DeserializationConfig cfg) {
|
|
696
|
+
_deserializationConfig = cfg;
|
|
697
|
+
return this;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/*
|
|
701
|
+
/**********************************************************
|
|
702
|
+
/* Configuration: ser/deser factory, provider access
|
|
703
|
+
/**********************************************************
|
|
704
|
+
*/
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Method for setting specific {@link SerializerFactory} to use
|
|
708
|
+
* for constructing (bean) serializers.
|
|
709
|
+
*/
|
|
710
|
+
public ObjectMapper setSerializerFactory(SerializerFactory f) {
|
|
711
|
+
_serializerFactory = f;
|
|
712
|
+
return this;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Method for setting specific {@link SerializerProvider} to use
|
|
717
|
+
* for handling caching of {@link JsonSerializer} instances.
|
|
718
|
+
*/
|
|
719
|
+
public ObjectMapper setSerializerProvider(SerializerProvider p) {
|
|
720
|
+
_serializerProvider = p;
|
|
721
|
+
return this;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @since 1.4
|
|
726
|
+
*/
|
|
727
|
+
public SerializerProvider getSerializerProvider() {
|
|
728
|
+
return _serializerProvider;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Method for setting specific {@link DeserializerProvider} to use
|
|
733
|
+
* for handling caching of {@link JsonDeserializer} instances.
|
|
734
|
+
*/
|
|
735
|
+
public ObjectMapper setDeserializerProvider(DeserializerProvider p) {
|
|
736
|
+
_deserializerProvider = p;
|
|
737
|
+
return this;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @since 1.4
|
|
742
|
+
*/
|
|
743
|
+
public DeserializerProvider getDeserializerProvider() {
|
|
744
|
+
return _deserializerProvider;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/*
|
|
748
|
+
/**********************************************************
|
|
749
|
+
/* Configuration, introspection
|
|
750
|
+
/**********************************************************
|
|
751
|
+
*/
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Method for accessing currently configured visibility checker;
|
|
755
|
+
* object used for determining whether given property element
|
|
756
|
+
* (method, field, constructor) can be auto-detected or not.
|
|
757
|
+
*
|
|
758
|
+
* @since 1.5
|
|
759
|
+
*/
|
|
760
|
+
public VisibilityChecker<?> getVisibilityChecker() {
|
|
761
|
+
return _serializationConfig.getDefaultVisibilityChecker();
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Method for setting currently configured visibility checker;
|
|
766
|
+
* object used for determining whether given property element
|
|
767
|
+
* (method, field, constructor) can be auto-detected or not.
|
|
768
|
+
* This default checker is used if no per-class overrides
|
|
769
|
+
* are defined.
|
|
770
|
+
*
|
|
771
|
+
* @since 1.5
|
|
772
|
+
*/
|
|
773
|
+
public void setVisibilityChecker(VisibilityChecker<?> vc) {
|
|
774
|
+
_deserializationConfig = _deserializationConfig.withVisibilityChecker(vc);
|
|
775
|
+
_serializationConfig = _serializationConfig.withVisibilityChecker(vc);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Convenience method that allows changing configuration for
|
|
780
|
+
* underlying {@link VisibilityChecker}s, to change details of what kinds of
|
|
781
|
+
* properties are auto-detected.
|
|
782
|
+
* Basically short cut for doing:
|
|
783
|
+
*<pre>
|
|
784
|
+
* mapper.setVisibilityChecker(
|
|
785
|
+
* mapper.getVisibilityChecker().withVisibility(forMethod, visibility)
|
|
786
|
+
* );
|
|
787
|
+
*</pre>
|
|
788
|
+
* one common use case would be to do:
|
|
789
|
+
*<pre>
|
|
790
|
+
* mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
|
|
791
|
+
*</pre>
|
|
792
|
+
* which would make all member fields serializable without further annotations,
|
|
793
|
+
* instead of just public fields (default setting).
|
|
794
|
+
*
|
|
795
|
+
* @param forMethod Type of property descriptor affected (field, getter/isGetter,
|
|
796
|
+
* setter, creator)
|
|
797
|
+
* @param visibility Minimum visibility to require for the property descriptors of type
|
|
798
|
+
*
|
|
799
|
+
* @return Modified mapper instance (that is, "this"), to allow chaining
|
|
800
|
+
* of configuration calls
|
|
801
|
+
*
|
|
802
|
+
* @since 1.9
|
|
803
|
+
*/
|
|
804
|
+
public ObjectMapper setVisibility(JsonMethod forMethod, JsonAutoDetect.Visibility visibility)
|
|
805
|
+
{
|
|
806
|
+
_deserializationConfig = _deserializationConfig.withVisibility(forMethod, visibility);
|
|
807
|
+
_serializationConfig = _serializationConfig.withVisibility(forMethod, visibility);
|
|
808
|
+
return this;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Method for accessing subtype resolver in use.
|
|
813
|
+
*
|
|
814
|
+
* @since 1.6
|
|
815
|
+
*/
|
|
816
|
+
public SubtypeResolver getSubtypeResolver() {
|
|
817
|
+
if (_subtypeResolver == null) {
|
|
818
|
+
_subtypeResolver = new StdSubtypeResolver();
|
|
819
|
+
}
|
|
820
|
+
return _subtypeResolver;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Method for setting custom subtype resolver to use.
|
|
825
|
+
*
|
|
826
|
+
* @since 1.6
|
|
827
|
+
*/
|
|
828
|
+
public void setSubtypeResolver(SubtypeResolver r) {
|
|
829
|
+
_subtypeResolver = r;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Method for changing {@link AnnotationIntrospector} used by this
|
|
834
|
+
* mapper instance for both serialization and deserialization
|
|
835
|
+
*
|
|
836
|
+
* @since 1.8
|
|
837
|
+
*/
|
|
838
|
+
public ObjectMapper setAnnotationIntrospector(AnnotationIntrospector ai) {
|
|
839
|
+
_serializationConfig = _serializationConfig.withAnnotationIntrospector(ai);
|
|
840
|
+
_deserializationConfig = _deserializationConfig.withAnnotationIntrospector(ai);
|
|
841
|
+
return this;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Method for setting custom property naming strategy to use.
|
|
846
|
+
*
|
|
847
|
+
* @since 1.8
|
|
848
|
+
*/
|
|
849
|
+
public ObjectMapper setPropertyNamingStrategy(PropertyNamingStrategy s) {
|
|
850
|
+
_serializationConfig = _serializationConfig.withPropertyNamingStrategy(s);
|
|
851
|
+
_deserializationConfig = _deserializationConfig.withPropertyNamingStrategy(s);
|
|
852
|
+
return this;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Method for setting defalt POJO property inclusion strategy for serialization.
|
|
857
|
+
* Equivalent to:
|
|
858
|
+
*<pre>
|
|
859
|
+
* mapper.setSerializationConfig(mapper.getSerializationConfig().withSerializationInclusion(incl));
|
|
860
|
+
*</pre>
|
|
861
|
+
*
|
|
862
|
+
* @since 1.9
|
|
863
|
+
*/
|
|
864
|
+
public ObjectMapper setSerializationInclusion(JsonSerialize.Inclusion incl) {
|
|
865
|
+
_serializationConfig = _serializationConfig.withSerializationInclusion(incl);
|
|
866
|
+
return this;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/*
|
|
870
|
+
/**********************************************************
|
|
871
|
+
/* Type information configuration (1.5+)
|
|
872
|
+
/**********************************************************
|
|
873
|
+
*/
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Convenience method that is equivalent to calling
|
|
877
|
+
*<pre>
|
|
878
|
+
* enableObjectTyping(DefaultTyping.OBJECT_AND_NON_CONCRETE);
|
|
879
|
+
*</pre>
|
|
880
|
+
*/
|
|
881
|
+
public ObjectMapper enableDefaultTyping() {
|
|
882
|
+
return enableDefaultTyping(DefaultTyping.OBJECT_AND_NON_CONCRETE);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Convenience method that is equivalent to calling
|
|
887
|
+
*<pre>
|
|
888
|
+
* enableObjectTyping(dti, JsonTypeInfo.As.WRAPPER_ARRAY);
|
|
889
|
+
*</pre>
|
|
890
|
+
*/
|
|
891
|
+
public ObjectMapper enableDefaultTyping(DefaultTyping dti) {
|
|
892
|
+
return enableDefaultTyping(dti, JsonTypeInfo.As.WRAPPER_ARRAY);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Method for enabling automatic inclusion of type information, needed
|
|
897
|
+
* for proper deserialization of polymorphic types (unless types
|
|
898
|
+
* have been annotated with {@link sh.calaba.org.codehaus.jackson.annotate.JsonTypeInfo}).
|
|
899
|
+
*
|
|
900
|
+
* @param applicability Defines kinds of types for which additional type information
|
|
901
|
+
* is added; see {@link DefaultTyping} for more information.
|
|
902
|
+
*/
|
|
903
|
+
public ObjectMapper enableDefaultTyping(DefaultTyping applicability, JsonTypeInfo.As includeAs)
|
|
904
|
+
{
|
|
905
|
+
TypeResolverBuilder<?> typer = new DefaultTypeResolverBuilder(applicability);
|
|
906
|
+
// we'll always use full class name, when using defaulting
|
|
907
|
+
typer = typer.init(JsonTypeInfo.Id.CLASS, null);
|
|
908
|
+
typer = typer.inclusion(includeAs);
|
|
909
|
+
return setDefaultTyping(typer);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Method for enabling automatic inclusion of type information -- needed
|
|
914
|
+
* for proper deserialization of polymorphic types (unless types
|
|
915
|
+
* have been annotated with {@link sh.calaba.org.codehaus.jackson.annotate.JsonTypeInfo}) --
|
|
916
|
+
* using "As.PROPERTY" inclusion mechanism and specified property name
|
|
917
|
+
* to use for inclusion (default being "@class" since default type information
|
|
918
|
+
* always uses class name as type identifier)
|
|
919
|
+
*
|
|
920
|
+
* @since 1.7
|
|
921
|
+
*/
|
|
922
|
+
public ObjectMapper enableDefaultTypingAsProperty(DefaultTyping applicability, String propertyName)
|
|
923
|
+
{
|
|
924
|
+
TypeResolverBuilder<?> typer = new DefaultTypeResolverBuilder(applicability);
|
|
925
|
+
// we'll always use full class name, when using defaulting
|
|
926
|
+
typer = typer.init(JsonTypeInfo.Id.CLASS, null);
|
|
927
|
+
typer = typer.inclusion(JsonTypeInfo.As.PROPERTY);
|
|
928
|
+
typer = typer.typeProperty(propertyName);
|
|
929
|
+
return setDefaultTyping(typer);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Method for disabling automatic inclusion of type information; if so, only
|
|
934
|
+
* explicitly annotated types (ones with
|
|
935
|
+
* {@link sh.calaba.org.codehaus.jackson.annotate.JsonTypeInfo}) will have
|
|
936
|
+
* additional embedded type information.
|
|
937
|
+
*/
|
|
938
|
+
public ObjectMapper disableDefaultTyping() {
|
|
939
|
+
return setDefaultTyping(null);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Method for enabling automatic inclusion of type information, using
|
|
944
|
+
* specified handler object for determining which types this affects,
|
|
945
|
+
* as well as details of how information is embedded.
|
|
946
|
+
*
|
|
947
|
+
* @param typer Type information inclusion handler
|
|
948
|
+
*
|
|
949
|
+
*
|
|
950
|
+
*/
|
|
951
|
+
public ObjectMapper setDefaultTyping(TypeResolverBuilder<?> typer) {
|
|
952
|
+
_deserializationConfig = _deserializationConfig.withTypeResolverBuilder(typer);
|
|
953
|
+
_serializationConfig = _serializationConfig.withTypeResolverBuilder(typer);
|
|
954
|
+
return this;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Method for registering specified class as a subtype, so that
|
|
959
|
+
* typename-based resolution can link supertypes to subtypes
|
|
960
|
+
* (as an alternative to using annotations).
|
|
961
|
+
* Type for given class is determined from appropriate annotation;
|
|
962
|
+
* or if missing, default name (unqualified class name)
|
|
963
|
+
*
|
|
964
|
+
* @since 1.6
|
|
965
|
+
*/
|
|
966
|
+
public void registerSubtypes(Class<?>... classes) {
|
|
967
|
+
getSubtypeResolver().registerSubtypes(classes);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Method for registering specified class as a subtype, so that
|
|
972
|
+
* typename-based resolution can link supertypes to subtypes
|
|
973
|
+
* (as an alternative to using annotations).
|
|
974
|
+
* Name may be provided as part of argument, but if not will
|
|
975
|
+
* be based on annotations or use default name (unqualified
|
|
976
|
+
* class name).
|
|
977
|
+
*
|
|
978
|
+
* @since 1.6
|
|
979
|
+
*/
|
|
980
|
+
public void registerSubtypes(NamedType... types) {
|
|
981
|
+
getSubtypeResolver().registerSubtypes(types);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/*
|
|
985
|
+
/**********************************************************
|
|
986
|
+
/* Configuration, basic type handling
|
|
987
|
+
/**********************************************************
|
|
988
|
+
*/
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Accessor for getting currently configured {@link TypeFactory} instance.
|
|
992
|
+
*
|
|
993
|
+
* @since 1.8
|
|
994
|
+
*/
|
|
995
|
+
public TypeFactory getTypeFactory() {
|
|
996
|
+
return _typeFactory;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Method that can be used to override {@link TypeFactory} instance
|
|
1001
|
+
* used by this mapper.
|
|
1002
|
+
*<p>
|
|
1003
|
+
* Note: will also set {@link TypeFactory} that deserialization and
|
|
1004
|
+
* serialization config objects use.
|
|
1005
|
+
*/
|
|
1006
|
+
public ObjectMapper setTypeFactory(TypeFactory f)
|
|
1007
|
+
{
|
|
1008
|
+
_typeFactory = f;
|
|
1009
|
+
_deserializationConfig = _deserializationConfig.withTypeFactory(f);
|
|
1010
|
+
_serializationConfig = _serializationConfig.withTypeFactory(f);
|
|
1011
|
+
return this;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Convenience method for constructing {@link JavaType} out of given
|
|
1016
|
+
* type (typically <code>java.lang.Class</code>), but without explicit
|
|
1017
|
+
* context.
|
|
1018
|
+
*
|
|
1019
|
+
* @since 1.8
|
|
1020
|
+
*/
|
|
1021
|
+
public JavaType constructType(Type t) {
|
|
1022
|
+
return _typeFactory.constructType(t);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/*
|
|
1026
|
+
/**********************************************************
|
|
1027
|
+
/* Configuration, deserialization
|
|
1028
|
+
/**********************************************************
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Method for specifying {@link JsonNodeFactory} to use for
|
|
1033
|
+
* constructing root level tree nodes (via method
|
|
1034
|
+
* {@link #createObjectNode}
|
|
1035
|
+
*
|
|
1036
|
+
* @since 1.2
|
|
1037
|
+
*/
|
|
1038
|
+
public ObjectMapper setNodeFactory(JsonNodeFactory f) {
|
|
1039
|
+
_deserializationConfig = _deserializationConfig.withNodeFactory(f);
|
|
1040
|
+
return this;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/*
|
|
1044
|
+
/**********************************************************
|
|
1045
|
+
/* Configuration, serialization
|
|
1046
|
+
/**********************************************************
|
|
1047
|
+
*/
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Convenience method that is equivalent to:
|
|
1051
|
+
*<pre>
|
|
1052
|
+
* mapper.setFilters(mapper.getSerializationConfig().withFilters(filterProvider));
|
|
1053
|
+
*</pre>
|
|
1054
|
+
*<p>
|
|
1055
|
+
* Note that usually it is better to use method {@link #filteredWriter}; however, sometimes
|
|
1056
|
+
* this method is more convenient. For example, some frameworks only allow configuring
|
|
1057
|
+
* of ObjectMapper instances and not ObjectWriters.
|
|
1058
|
+
*
|
|
1059
|
+
* @since 1.8
|
|
1060
|
+
*/
|
|
1061
|
+
public void setFilters(FilterProvider filterProvider) {
|
|
1062
|
+
_serializationConfig = _serializationConfig.withFilters(filterProvider);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/*
|
|
1066
|
+
/**********************************************************
|
|
1067
|
+
/* Configuration, other
|
|
1068
|
+
/**********************************************************
|
|
1069
|
+
*/
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Method that can be used to get hold of {@link JsonFactory} that this
|
|
1073
|
+
* mapper uses if it needs to construct {@link JsonParser}s
|
|
1074
|
+
* and/or {@link JsonGenerator}s.
|
|
1075
|
+
*
|
|
1076
|
+
* @return {@link JsonFactory} that this mapper uses when it needs to
|
|
1077
|
+
* construct Json parser and generators
|
|
1078
|
+
*/
|
|
1079
|
+
public JsonFactory getJsonFactory() { return _jsonFactory; }
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Method for configuring the default {@link DateFormat} to use when serializing time
|
|
1083
|
+
* values as Strings, and deserializing from JSON Strings.
|
|
1084
|
+
* This is preferably to directly modifying {@link SerializationConfig} and
|
|
1085
|
+
* {@link DeserializationConfig} instances.
|
|
1086
|
+
* If you need per-request configuration, use {@link #writer(DateFormat)} to
|
|
1087
|
+
* create properly configured {@link ObjectWriter} and use that; this because
|
|
1088
|
+
* {@link ObjectWriter}s are thread-safe whereas ObjectMapper itself is only
|
|
1089
|
+
* thread-safe when configuring methods (such as this one) are NOT called.
|
|
1090
|
+
*
|
|
1091
|
+
* @since 1.8
|
|
1092
|
+
*/
|
|
1093
|
+
public void setDateFormat(DateFormat dateFormat)
|
|
1094
|
+
{
|
|
1095
|
+
_deserializationConfig = _deserializationConfig.withDateFormat(dateFormat);
|
|
1096
|
+
_serializationConfig = _serializationConfig.withDateFormat(dateFormat);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Method for configuring {@link HandlerInstantiator} to use for creating
|
|
1101
|
+
* instances of handlers (such as serializers, deserializers, type and type
|
|
1102
|
+
* id resolvers), given a class.
|
|
1103
|
+
*
|
|
1104
|
+
* @param hi Instantiator to use; if null, use the default implementation
|
|
1105
|
+
*/
|
|
1106
|
+
public void setHandlerInstantiator(HandlerInstantiator hi)
|
|
1107
|
+
{
|
|
1108
|
+
_deserializationConfig = _deserializationConfig.withHandlerInstantiator(hi);
|
|
1109
|
+
_serializationConfig = _serializationConfig.withHandlerInstantiator(hi);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* @since 1.9
|
|
1114
|
+
*/
|
|
1115
|
+
public ObjectMapper setInjectableValues(InjectableValues injectableValues) {
|
|
1116
|
+
_injectableValues = injectableValues;
|
|
1117
|
+
return this;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/*
|
|
1121
|
+
/**********************************************************
|
|
1122
|
+
/* Configuration, simple features
|
|
1123
|
+
/**********************************************************
|
|
1124
|
+
*/
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Method for changing state of an on/off serialization feature for
|
|
1128
|
+
* this object mapper.
|
|
1129
|
+
*<p>
|
|
1130
|
+
* This is method is basically a shortcut method for calling
|
|
1131
|
+
* {@link SerializationConfig#set} on the shared {@link SerializationConfig}
|
|
1132
|
+
* object with given arguments.
|
|
1133
|
+
*/
|
|
1134
|
+
@SuppressWarnings("deprecation")
|
|
1135
|
+
public ObjectMapper configure(SerializationConfig.Feature f, boolean state) {
|
|
1136
|
+
_serializationConfig.set(f, state);
|
|
1137
|
+
return this;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Method for changing state of an on/off deserialization feature for
|
|
1142
|
+
* this object mapper.
|
|
1143
|
+
*<p>
|
|
1144
|
+
* This is method is basically a shortcut method for calling
|
|
1145
|
+
* {@link DeserializationConfig#set} on the shared {@link DeserializationConfig}
|
|
1146
|
+
* object with given arguments.
|
|
1147
|
+
*/
|
|
1148
|
+
@SuppressWarnings("deprecation")
|
|
1149
|
+
public ObjectMapper configure(DeserializationConfig.Feature f, boolean state) {
|
|
1150
|
+
_deserializationConfig.set(f, state);
|
|
1151
|
+
return this;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Method for changing state of an on/off {@link JsonParser} feature for
|
|
1156
|
+
* {@link JsonFactory} instance this object mapper uses.
|
|
1157
|
+
*<p>
|
|
1158
|
+
* This is method is basically a shortcut method for calling
|
|
1159
|
+
* {@link JsonFactory#setParserFeature} on the shared
|
|
1160
|
+
* {@link JsonFactory} this mapper uses (which is accessible
|
|
1161
|
+
* using {@link #getJsonFactory}).
|
|
1162
|
+
*
|
|
1163
|
+
* @since 1.2
|
|
1164
|
+
*/
|
|
1165
|
+
public ObjectMapper configure(JsonParser.Feature f, boolean state) {
|
|
1166
|
+
_jsonFactory.configure(f, state);
|
|
1167
|
+
return this;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Method for changing state of an on/off {@link JsonGenerator} feature for
|
|
1172
|
+
* {@link JsonFactory} instance this object mapper uses.
|
|
1173
|
+
*<p>
|
|
1174
|
+
* This is method is basically a shortcut method for calling
|
|
1175
|
+
* {@link JsonFactory#setGeneratorFeature} on the shared
|
|
1176
|
+
* {@link JsonFactory} this mapper uses (which is accessible
|
|
1177
|
+
* using {@link #getJsonFactory}).
|
|
1178
|
+
*
|
|
1179
|
+
* @since 1.2
|
|
1180
|
+
*/
|
|
1181
|
+
public ObjectMapper configure(JsonGenerator.Feature f, boolean state) {
|
|
1182
|
+
_jsonFactory.configure(f, state);
|
|
1183
|
+
return this;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Method for enabling specified {@link DeserializationConfig} features.
|
|
1188
|
+
* Modifies and returns this instance; no new object is created.
|
|
1189
|
+
*
|
|
1190
|
+
* @since 1.9
|
|
1191
|
+
*/
|
|
1192
|
+
public ObjectMapper enable(DeserializationConfig.Feature... f) {
|
|
1193
|
+
_deserializationConfig = _deserializationConfig.with(f);
|
|
1194
|
+
return this;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Method for enabling specified {@link DeserializationConfig} features.
|
|
1199
|
+
* Modifies and returns this instance; no new object is created.
|
|
1200
|
+
*
|
|
1201
|
+
* @since 1.9
|
|
1202
|
+
*/
|
|
1203
|
+
public ObjectMapper disable(DeserializationConfig.Feature... f) {
|
|
1204
|
+
_deserializationConfig = _deserializationConfig.without(f);
|
|
1205
|
+
return this;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Method for enabling specified {@link DeserializationConfig} features.
|
|
1210
|
+
* Modifies and returns this instance; no new object is created.
|
|
1211
|
+
*
|
|
1212
|
+
* @since 1.9
|
|
1213
|
+
*/
|
|
1214
|
+
public ObjectMapper enable(SerializationConfig.Feature... f) {
|
|
1215
|
+
_serializationConfig = _serializationConfig.with(f);
|
|
1216
|
+
return this;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Method for enabling specified {@link DeserializationConfig} features.
|
|
1221
|
+
* Modifies and returns this instance; no new object is created.
|
|
1222
|
+
*
|
|
1223
|
+
* @since 1.9
|
|
1224
|
+
*/
|
|
1225
|
+
public ObjectMapper disable(SerializationConfig.Feature... f) {
|
|
1226
|
+
_serializationConfig = _serializationConfig.without(f);
|
|
1227
|
+
return this;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Convenience method, equivalent to:
|
|
1232
|
+
*<pre>
|
|
1233
|
+
* getSerializationConfig().isEnabled(f);
|
|
1234
|
+
*</pre>
|
|
1235
|
+
*
|
|
1236
|
+
* @since 1.9
|
|
1237
|
+
*/
|
|
1238
|
+
public boolean isEnabled(SerializationConfig.Feature f) {
|
|
1239
|
+
return _serializationConfig.isEnabled(f);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Convenience method, equivalent to:
|
|
1244
|
+
*<pre>
|
|
1245
|
+
* getDeserializationConfig().isEnabled(f);
|
|
1246
|
+
*</pre>
|
|
1247
|
+
*
|
|
1248
|
+
* @since 1.9
|
|
1249
|
+
*/
|
|
1250
|
+
public boolean isEnabled(DeserializationConfig.Feature f) {
|
|
1251
|
+
return _deserializationConfig.isEnabled(f);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Convenience method, equivalent to:
|
|
1256
|
+
*<pre>
|
|
1257
|
+
* getJsonFactory().isEnabled(f);
|
|
1258
|
+
*</pre>
|
|
1259
|
+
*
|
|
1260
|
+
* @since 1.9
|
|
1261
|
+
*/
|
|
1262
|
+
public boolean isEnabled(JsonParser.Feature f) {
|
|
1263
|
+
return _jsonFactory.isEnabled(f);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Convenience method, equivalent to:
|
|
1268
|
+
*<pre>
|
|
1269
|
+
* getJsonFactory().isEnabled(f);
|
|
1270
|
+
*</pre>
|
|
1271
|
+
*
|
|
1272
|
+
* @since 1.9
|
|
1273
|
+
*/
|
|
1274
|
+
public boolean isEnabled(JsonGenerator.Feature f) {
|
|
1275
|
+
return _jsonFactory.isEnabled(f);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Method that can be used to get hold of {@link JsonNodeFactory}
|
|
1280
|
+
* that this mapper will use when directly constructing
|
|
1281
|
+
* root {@link JsonNode} instances for Trees.
|
|
1282
|
+
*<p>
|
|
1283
|
+
* Note: this is just a shortcut for calling
|
|
1284
|
+
*<pre>
|
|
1285
|
+
* getDeserializationConfig().getNodeFactory()
|
|
1286
|
+
*</pre>
|
|
1287
|
+
*
|
|
1288
|
+
* @since 1.2
|
|
1289
|
+
*/
|
|
1290
|
+
public JsonNodeFactory getNodeFactory() {
|
|
1291
|
+
return _deserializationConfig.getNodeFactory();
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/*
|
|
1295
|
+
/**********************************************************
|
|
1296
|
+
/* Public API (from ObjectCodec): deserialization
|
|
1297
|
+
/* (mapping from JSON to Java types);
|
|
1298
|
+
/* main methods
|
|
1299
|
+
/**********************************************************
|
|
1300
|
+
*/
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* Method to deserialize JSON content into a non-container
|
|
1304
|
+
* type (it can be an array type, however): typically a bean, array
|
|
1305
|
+
* or a wrapper type (like {@link java.lang.Boolean}).
|
|
1306
|
+
*<p>
|
|
1307
|
+
* Note: this method should NOT be used if the result type is a
|
|
1308
|
+
* container ({@link java.util.Collection} or {@link java.util.Map}.
|
|
1309
|
+
* The reason is that due to type erasure, key and value types
|
|
1310
|
+
* can not be introspected when using this method.
|
|
1311
|
+
*/
|
|
1312
|
+
@Override
|
|
1313
|
+
@SuppressWarnings("unchecked")
|
|
1314
|
+
public <T> T readValue(JsonParser jp, Class<T> valueType)
|
|
1315
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1316
|
+
{
|
|
1317
|
+
// !!! TODO
|
|
1318
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1319
|
+
return (T) _readValue(copyDeserializationConfig(), jp, _typeFactory.constructType(valueType));
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Method to deserialize JSON content into a Java type, reference
|
|
1324
|
+
* to which is passed as argument. Type is passed using so-called
|
|
1325
|
+
* "super type token" (see )
|
|
1326
|
+
* and specifically needs to be used if the root type is a
|
|
1327
|
+
* parameterized (generic) container type.
|
|
1328
|
+
*/
|
|
1329
|
+
@Override
|
|
1330
|
+
@SuppressWarnings("unchecked")
|
|
1331
|
+
public <T> T readValue(JsonParser jp, TypeReference<?> valueTypeRef)
|
|
1332
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1333
|
+
{
|
|
1334
|
+
return (T) _readValue(copyDeserializationConfig(), jp, _typeFactory.constructType(valueTypeRef));
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Method to deserialize JSON content into a Java type, reference
|
|
1339
|
+
* to which is passed as argument. Type is passed using
|
|
1340
|
+
* Jackson specific type; instance of which can be constructed using
|
|
1341
|
+
* {@link TypeFactory}.
|
|
1342
|
+
*/
|
|
1343
|
+
@Override
|
|
1344
|
+
@SuppressWarnings("unchecked")
|
|
1345
|
+
public <T> T readValue(JsonParser jp, JavaType valueType)
|
|
1346
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1347
|
+
{
|
|
1348
|
+
return (T) _readValue(copyDeserializationConfig(), jp, valueType);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Method to deserialize JSON content as tree expressed
|
|
1353
|
+
* using set of {@link JsonNode} instances. Returns
|
|
1354
|
+
* root of the resulting tree (where root can consist
|
|
1355
|
+
* of just a single node if the current event is a
|
|
1356
|
+
* value event, not container).
|
|
1357
|
+
*/
|
|
1358
|
+
@Override
|
|
1359
|
+
public JsonNode readTree(JsonParser jp)
|
|
1360
|
+
throws IOException, JsonProcessingException
|
|
1361
|
+
{
|
|
1362
|
+
/* 02-Mar-2009, tatu: One twist; deserialization provider
|
|
1363
|
+
* will map JSON null straight into Java null. But what
|
|
1364
|
+
* we want to return is the "null node" instead.
|
|
1365
|
+
*/
|
|
1366
|
+
/* 05-Aug-2011, tatu: Also, must check for EOF here before
|
|
1367
|
+
* calling readValue(), since that'll choke on it otherwise
|
|
1368
|
+
*/
|
|
1369
|
+
DeserializationConfig cfg = copyDeserializationConfig();
|
|
1370
|
+
JsonToken t = jp.getCurrentToken();
|
|
1371
|
+
if (t == null) {
|
|
1372
|
+
t = jp.nextToken();
|
|
1373
|
+
if (t == null) {
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
JsonNode n = (JsonNode) _readValue(cfg, jp, JSON_NODE_TYPE);
|
|
1378
|
+
return (n == null) ? getNodeFactory().nullNode() : n;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Method for reading sequence of Objects from parser stream.
|
|
1383
|
+
*<p>
|
|
1384
|
+
* Note that {@link ObjectReader} has more complete set of variants.
|
|
1385
|
+
*
|
|
1386
|
+
* @since 1.8
|
|
1387
|
+
*/
|
|
1388
|
+
@Override
|
|
1389
|
+
public <T> MappingIterator<T> readValues(JsonParser jp, JavaType valueType)
|
|
1390
|
+
throws IOException, JsonProcessingException
|
|
1391
|
+
{
|
|
1392
|
+
DeserializationConfig config = copyDeserializationConfig();
|
|
1393
|
+
DeserializationContext ctxt = _createDeserializationContext(jp, config);
|
|
1394
|
+
JsonDeserializer<?> deser = _findRootDeserializer(config, valueType);
|
|
1395
|
+
// false -> do NOT close JsonParser (since caller passed it)
|
|
1396
|
+
return new MappingIterator<T>(valueType, jp, ctxt, deser,
|
|
1397
|
+
false, null);
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Method for reading sequence of Objects from parser stream.
|
|
1402
|
+
*
|
|
1403
|
+
* @since 1.8
|
|
1404
|
+
*/
|
|
1405
|
+
@Override
|
|
1406
|
+
public <T> MappingIterator<T> readValues(JsonParser jp, Class<T> valueType)
|
|
1407
|
+
throws IOException, JsonProcessingException
|
|
1408
|
+
{
|
|
1409
|
+
return readValues(jp, _typeFactory.constructType(valueType));
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Method for reading sequence of Objects from parser stream.
|
|
1414
|
+
*
|
|
1415
|
+
* @since 1.8
|
|
1416
|
+
*/
|
|
1417
|
+
@Override
|
|
1418
|
+
public <T> MappingIterator<T> readValues(JsonParser jp, TypeReference<?> valueTypeRef)
|
|
1419
|
+
throws IOException, JsonProcessingException
|
|
1420
|
+
{
|
|
1421
|
+
return readValues(jp, _typeFactory.constructType(valueTypeRef));
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/*
|
|
1425
|
+
/**********************************************************
|
|
1426
|
+
/* Public API not included in ObjectCodec: deserialization
|
|
1427
|
+
/* (mapping from JSON to Java types)
|
|
1428
|
+
/**********************************************************
|
|
1429
|
+
*/
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Method to deserialize JSON content into a non-container
|
|
1433
|
+
* type (it can be an array type, however): typically a bean, array
|
|
1434
|
+
* or a wrapper type (like {@link java.lang.Boolean}).
|
|
1435
|
+
*<p>
|
|
1436
|
+
* Note: this method should NOT be used if the result type is a
|
|
1437
|
+
* container ({@link java.util.Collection} or {@link java.util.Map}.
|
|
1438
|
+
* The reason is that due to type erasure, key and value types
|
|
1439
|
+
* can not be introspected when using this method.
|
|
1440
|
+
* @since 1.1
|
|
1441
|
+
*
|
|
1442
|
+
* @param cfg Specific deserialization configuration to use for
|
|
1443
|
+
* this operation. Note that not all config settings can
|
|
1444
|
+
* be changed on per-operation basis: some changeds only take effect
|
|
1445
|
+
* before calling the operation for the first time (for the mapper
|
|
1446
|
+
* instance)
|
|
1447
|
+
*/
|
|
1448
|
+
@SuppressWarnings("unchecked")
|
|
1449
|
+
public <T> T readValue(JsonParser jp, Class<T> valueType,
|
|
1450
|
+
DeserializationConfig cfg)
|
|
1451
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1452
|
+
{
|
|
1453
|
+
// !!! TODO
|
|
1454
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1455
|
+
return (T) _readValue(cfg, jp, _typeFactory.constructType(valueType));
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Method to deserialize JSON content into a Java type, reference
|
|
1460
|
+
* to which is passed as argument. Type is passed using so-called
|
|
1461
|
+
* "super type token" (see )
|
|
1462
|
+
* and specifically needs to be used if the root type is a
|
|
1463
|
+
* parameterized (generic) container type.
|
|
1464
|
+
*
|
|
1465
|
+
* @param cfg Specific deserialization configuration to use for
|
|
1466
|
+
* this operation. Note that not all config settings can
|
|
1467
|
+
* be changed on per-operation basis: some changeds only take effect
|
|
1468
|
+
* before calling the operation for the first time (for the mapper
|
|
1469
|
+
* instance)
|
|
1470
|
+
*
|
|
1471
|
+
* @since 1.1
|
|
1472
|
+
*/
|
|
1473
|
+
@SuppressWarnings("unchecked")
|
|
1474
|
+
public <T> T readValue(JsonParser jp, TypeReference<?> valueTypeRef,
|
|
1475
|
+
DeserializationConfig cfg)
|
|
1476
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1477
|
+
{
|
|
1478
|
+
return (T) _readValue(cfg, jp, _typeFactory.constructType(valueTypeRef));
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Method to deserialize JSON content into a Java type, reference
|
|
1483
|
+
* to which is passed as argument. Type is passed using
|
|
1484
|
+
* Jackson specific type; instance of which can be constructed using
|
|
1485
|
+
* {@link TypeFactory}.
|
|
1486
|
+
*
|
|
1487
|
+
* @param cfg Specific deserialization configuration to use for
|
|
1488
|
+
* this operation. Note that not all config settings can
|
|
1489
|
+
* be changed on per-operation basis: some changeds only take effect
|
|
1490
|
+
* before calling the operation for the first time (for the mapper
|
|
1491
|
+
* instance)
|
|
1492
|
+
*
|
|
1493
|
+
* @since 1.1
|
|
1494
|
+
*/
|
|
1495
|
+
@SuppressWarnings("unchecked")
|
|
1496
|
+
public <T> T readValue(JsonParser jp, JavaType valueType,
|
|
1497
|
+
DeserializationConfig cfg)
|
|
1498
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1499
|
+
{
|
|
1500
|
+
return (T) _readValue(cfg, jp, valueType);
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Method to deserialize JSON content as tree expressed
|
|
1505
|
+
* using set of {@link JsonNode} instances. Returns
|
|
1506
|
+
* root of the resulting tree (where root can consist
|
|
1507
|
+
* of just a single node if the current event is a
|
|
1508
|
+
* value event, not container).
|
|
1509
|
+
*
|
|
1510
|
+
* @param cfg Specific deserialization configuration to use for
|
|
1511
|
+
* this operation. Note that not all config settings can
|
|
1512
|
+
* be changed on per-operation basis: some changeds only take effect
|
|
1513
|
+
* before calling the operation for the first time (for the mapper
|
|
1514
|
+
* instance)
|
|
1515
|
+
*
|
|
1516
|
+
* @since 1.1
|
|
1517
|
+
*/
|
|
1518
|
+
public JsonNode readTree(JsonParser jp, DeserializationConfig cfg)
|
|
1519
|
+
throws IOException, JsonProcessingException
|
|
1520
|
+
{
|
|
1521
|
+
JsonNode n = (JsonNode) _readValue(cfg, jp, JSON_NODE_TYPE);
|
|
1522
|
+
return (n == null) ? NullNode.instance : n;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
/**
|
|
1526
|
+
* Method to deserialize JSON content as tree expressed
|
|
1527
|
+
* using set of {@link JsonNode} instances.
|
|
1528
|
+
* Returns root of the resulting tree (where root can consist
|
|
1529
|
+
* of just a single node if the current event is a
|
|
1530
|
+
* value event, not container).
|
|
1531
|
+
*
|
|
1532
|
+
* @param in Input stream used to read JSON content
|
|
1533
|
+
* for building the JSON tree.
|
|
1534
|
+
*
|
|
1535
|
+
* @since 1.3
|
|
1536
|
+
*/
|
|
1537
|
+
public JsonNode readTree(InputStream in)
|
|
1538
|
+
throws IOException, JsonProcessingException
|
|
1539
|
+
{
|
|
1540
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(in), JSON_NODE_TYPE);
|
|
1541
|
+
return (n == null) ? NullNode.instance : n;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Method to deserialize JSON content as tree expressed
|
|
1546
|
+
* using set of {@link JsonNode} instances.
|
|
1547
|
+
* Returns root of the resulting tree (where root can consist
|
|
1548
|
+
* of just a single node if the current event is a
|
|
1549
|
+
* value event, not container).
|
|
1550
|
+
*
|
|
1551
|
+
* @param r Reader used to read JSON content
|
|
1552
|
+
* for building the JSON tree.
|
|
1553
|
+
*
|
|
1554
|
+
* @since 1.3
|
|
1555
|
+
*/
|
|
1556
|
+
public JsonNode readTree(Reader r)
|
|
1557
|
+
throws IOException, JsonProcessingException
|
|
1558
|
+
{
|
|
1559
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(r), JSON_NODE_TYPE);
|
|
1560
|
+
return (n == null) ? NullNode.instance : n;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* Method to deserialize JSON content as tree expressed using set of {@link JsonNode} instances.
|
|
1565
|
+
* Returns root of the resulting tree (where root can consist of just a single node if the current
|
|
1566
|
+
* event is a value event, not container).
|
|
1567
|
+
*
|
|
1568
|
+
* @param content JSON content to parse to build the JSON tree.
|
|
1569
|
+
*
|
|
1570
|
+
* @since 1.3
|
|
1571
|
+
*/
|
|
1572
|
+
public JsonNode readTree(String content)
|
|
1573
|
+
throws IOException, JsonProcessingException
|
|
1574
|
+
{
|
|
1575
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(content), JSON_NODE_TYPE);
|
|
1576
|
+
return (n == null) ? NullNode.instance : n;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Method to deserialize JSON content as tree expressed using set of {@link JsonNode} instances.
|
|
1581
|
+
* Returns root of the resulting tree (where root can consist of just a single node if the current
|
|
1582
|
+
* event is a value event, not container).
|
|
1583
|
+
*
|
|
1584
|
+
* @param content JSON content to parse to build the JSON tree.
|
|
1585
|
+
*
|
|
1586
|
+
* @since 1.9
|
|
1587
|
+
*/
|
|
1588
|
+
public JsonNode readTree(byte[] content)
|
|
1589
|
+
throws IOException, JsonProcessingException
|
|
1590
|
+
{
|
|
1591
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(content), JSON_NODE_TYPE);
|
|
1592
|
+
return (n == null) ? NullNode.instance : n;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Method to deserialize JSON content as tree expressed using set of {@link JsonNode} instances.
|
|
1597
|
+
* Returns root of the resulting tree (where root can consist of just a single node if the current
|
|
1598
|
+
* event is a value event, not container).
|
|
1599
|
+
*
|
|
1600
|
+
* @param file File of which contents to parse as JSON for building a tree instance
|
|
1601
|
+
*
|
|
1602
|
+
* @since 1.9
|
|
1603
|
+
*/
|
|
1604
|
+
public JsonNode readTree(File file)
|
|
1605
|
+
throws IOException, JsonProcessingException
|
|
1606
|
+
{
|
|
1607
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(file), JSON_NODE_TYPE);
|
|
1608
|
+
return (n == null) ? NullNode.instance : n;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Method to deserialize JSON content as tree expressed using set of {@link JsonNode} instances.
|
|
1613
|
+
* Returns root of the resulting tree (where root can consist of just a single node if the current
|
|
1614
|
+
* event is a value event, not container).
|
|
1615
|
+
*
|
|
1616
|
+
* @param source URL to use for fetching contents to parse as JSON for building a tree instance
|
|
1617
|
+
*
|
|
1618
|
+
* @since 1.9
|
|
1619
|
+
*/
|
|
1620
|
+
public JsonNode readTree(URL source)
|
|
1621
|
+
throws IOException, JsonProcessingException
|
|
1622
|
+
{
|
|
1623
|
+
JsonNode n = (JsonNode) _readMapAndClose(_jsonFactory.createJsonParser(source), JSON_NODE_TYPE);
|
|
1624
|
+
return (n == null) ? NullNode.instance : n;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/*
|
|
1628
|
+
/**********************************************************
|
|
1629
|
+
/* Public API (from ObjectCodec): serialization
|
|
1630
|
+
/* (mapping from Java types to Json)
|
|
1631
|
+
/**********************************************************
|
|
1632
|
+
*/
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Method that can be used to serialize any Java value as
|
|
1636
|
+
* JSON output, using provided {@link JsonGenerator}.
|
|
1637
|
+
*/
|
|
1638
|
+
@Override
|
|
1639
|
+
public void writeValue(JsonGenerator jgen, Object value)
|
|
1640
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
1641
|
+
{
|
|
1642
|
+
SerializationConfig config = copySerializationConfig();
|
|
1643
|
+
if (config.isEnabled(SerializationConfig.Feature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) {
|
|
1644
|
+
_writeCloseableValue(jgen, value, config);
|
|
1645
|
+
} else {
|
|
1646
|
+
_serializerProvider.serializeValue(config, jgen, value, _serializerFactory);
|
|
1647
|
+
if (config.isEnabled(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE)) {
|
|
1648
|
+
jgen.flush();
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Method that can be used to serialize any Java value as
|
|
1655
|
+
* JSON output, using provided {@link JsonGenerator},
|
|
1656
|
+
* configured as per passed configuration object.
|
|
1657
|
+
*
|
|
1658
|
+
* @since 1.1
|
|
1659
|
+
*/
|
|
1660
|
+
public void writeValue(JsonGenerator jgen, Object value, SerializationConfig config)
|
|
1661
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
1662
|
+
{
|
|
1663
|
+
// [JACKSON-282] Consider java.util.Closeable
|
|
1664
|
+
if (config.isEnabled(SerializationConfig.Feature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) {
|
|
1665
|
+
_writeCloseableValue(jgen, value, config);
|
|
1666
|
+
} else {
|
|
1667
|
+
_serializerProvider.serializeValue(config, jgen, value, _serializerFactory);
|
|
1668
|
+
if (config.isEnabled(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE)) {
|
|
1669
|
+
jgen.flush();
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Method to serialize given JSON Tree, using generator
|
|
1676
|
+
* provided.
|
|
1677
|
+
*/
|
|
1678
|
+
@Override
|
|
1679
|
+
public void writeTree(JsonGenerator jgen, JsonNode rootNode)
|
|
1680
|
+
throws IOException, JsonProcessingException
|
|
1681
|
+
{
|
|
1682
|
+
SerializationConfig config = copySerializationConfig();
|
|
1683
|
+
_serializerProvider.serializeValue(config, jgen, rootNode, _serializerFactory);
|
|
1684
|
+
if (config.isEnabled(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE)) {
|
|
1685
|
+
jgen.flush();
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Method to serialize given Json Tree, using generator
|
|
1691
|
+
* provided.
|
|
1692
|
+
*
|
|
1693
|
+
* @since 1.1
|
|
1694
|
+
*/
|
|
1695
|
+
public void writeTree(JsonGenerator jgen, JsonNode rootNode,
|
|
1696
|
+
SerializationConfig cfg)
|
|
1697
|
+
throws IOException, JsonProcessingException
|
|
1698
|
+
{
|
|
1699
|
+
_serializerProvider.serializeValue(cfg, jgen, rootNode, _serializerFactory);
|
|
1700
|
+
if (cfg.isEnabled(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE)) {
|
|
1701
|
+
jgen.flush();
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/*
|
|
1706
|
+
/**********************************************************
|
|
1707
|
+
/* Public API (from ObjectCodec): Tree Model support
|
|
1708
|
+
/**********************************************************
|
|
1709
|
+
*/
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
*<p>
|
|
1713
|
+
* Note: return type is co-variant, as basic ObjectCodec
|
|
1714
|
+
* abstraction can not refer to concrete node types (as it's
|
|
1715
|
+
* part of core package, whereas impls are part of mapper
|
|
1716
|
+
* package)
|
|
1717
|
+
*
|
|
1718
|
+
* @since 1.2
|
|
1719
|
+
*/
|
|
1720
|
+
@Override
|
|
1721
|
+
public ObjectNode createObjectNode() {
|
|
1722
|
+
return _deserializationConfig.getNodeFactory().objectNode();
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
*<p>
|
|
1727
|
+
* Note: return type is co-variant, as basic ObjectCodec
|
|
1728
|
+
* abstraction can not refer to concrete node types (as it's
|
|
1729
|
+
* part of core package, whereas impls are part of mapper
|
|
1730
|
+
* package)
|
|
1731
|
+
*
|
|
1732
|
+
* @since 1.2
|
|
1733
|
+
*/
|
|
1734
|
+
@Override
|
|
1735
|
+
public ArrayNode createArrayNode() {
|
|
1736
|
+
return _deserializationConfig.getNodeFactory().arrayNode();
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/**
|
|
1740
|
+
* Method for constructing a {@link JsonParser} out of JSON tree
|
|
1741
|
+
* representation.
|
|
1742
|
+
*
|
|
1743
|
+
* @param n Root node of the tree that resulting parser will read from
|
|
1744
|
+
*
|
|
1745
|
+
* @since 1.3
|
|
1746
|
+
*/
|
|
1747
|
+
@Override
|
|
1748
|
+
public JsonParser treeAsTokens(JsonNode n)
|
|
1749
|
+
{
|
|
1750
|
+
return new TreeTraversingParser(n, this);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* Convenience conversion method that will bind data given JSON tree
|
|
1755
|
+
* contains into specific value (usually bean) type.
|
|
1756
|
+
*<p>
|
|
1757
|
+
* Equivalent to:
|
|
1758
|
+
*<pre>
|
|
1759
|
+
* objectMapper.convertValue(n, valueClass);
|
|
1760
|
+
*</pre>
|
|
1761
|
+
*/
|
|
1762
|
+
@Override
|
|
1763
|
+
public <T> T treeToValue(JsonNode n, Class<T> valueType)
|
|
1764
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1765
|
+
{
|
|
1766
|
+
return readValue(treeAsTokens(n), valueType);
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* Reverse of {@link #treeToValue}; given a value (usually bean), will
|
|
1771
|
+
* construct equivalent JSON Tree representation. Functionally same
|
|
1772
|
+
* as if serializing value into JSON and parsing JSON as tree, but
|
|
1773
|
+
* more efficient.
|
|
1774
|
+
*
|
|
1775
|
+
* @param <T> Actual node type; usually either basic {@link JsonNode} or
|
|
1776
|
+
* {@link sh.calaba.org.codehaus.jackson.node.ObjectNode}
|
|
1777
|
+
* @param fromValue Bean value to convert
|
|
1778
|
+
* @return Root node of the resulting JSON tree
|
|
1779
|
+
*
|
|
1780
|
+
* @since 1.6
|
|
1781
|
+
*/
|
|
1782
|
+
@SuppressWarnings("unchecked")
|
|
1783
|
+
public <T extends JsonNode> T valueToTree(Object fromValue)
|
|
1784
|
+
throws IllegalArgumentException
|
|
1785
|
+
{
|
|
1786
|
+
if (fromValue == null) return null;
|
|
1787
|
+
TokenBuffer buf = new TokenBuffer(this);
|
|
1788
|
+
JsonNode result;
|
|
1789
|
+
try {
|
|
1790
|
+
writeValue(buf, fromValue);
|
|
1791
|
+
JsonParser jp = buf.asParser();
|
|
1792
|
+
result = readTree(jp);
|
|
1793
|
+
jp.close();
|
|
1794
|
+
} catch (IOException e) { // should not occur, no real i/o...
|
|
1795
|
+
throw new IllegalArgumentException(e.getMessage(), e);
|
|
1796
|
+
}
|
|
1797
|
+
return (T) result;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/*
|
|
1801
|
+
/**********************************************************
|
|
1802
|
+
/* Extended Public API, accessors
|
|
1803
|
+
/**********************************************************
|
|
1804
|
+
*/
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Method that can be called to check whether mapper thinks
|
|
1808
|
+
* it could serialize an instance of given Class.
|
|
1809
|
+
* Check is done
|
|
1810
|
+
* by checking whether a serializer can be found for the type.
|
|
1811
|
+
*
|
|
1812
|
+
* @return True if mapper can find a serializer for instances of
|
|
1813
|
+
* given class (potentially serializable), false otherwise (not
|
|
1814
|
+
* serializable)
|
|
1815
|
+
*/
|
|
1816
|
+
public boolean canSerialize(Class<?> type)
|
|
1817
|
+
{
|
|
1818
|
+
return _serializerProvider.hasSerializerFor(copySerializationConfig(),
|
|
1819
|
+
type, _serializerFactory);
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* Method that can be called to check whether mapper thinks
|
|
1824
|
+
* it could deserialize an Object of given type.
|
|
1825
|
+
* Check is done
|
|
1826
|
+
* by checking whether a deserializer can be found for the type.
|
|
1827
|
+
*
|
|
1828
|
+
* @return True if mapper can find a serializer for instances of
|
|
1829
|
+
* given class (potentially serializable), false otherwise (not
|
|
1830
|
+
* serializable)
|
|
1831
|
+
*/
|
|
1832
|
+
public boolean canDeserialize(JavaType type)
|
|
1833
|
+
{
|
|
1834
|
+
return _deserializerProvider.hasValueDeserializerFor(copyDeserializationConfig(), type);
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/*
|
|
1838
|
+
/**********************************************************
|
|
1839
|
+
/* Extended Public API, deserialization,
|
|
1840
|
+
/* convenience methods
|
|
1841
|
+
/**********************************************************
|
|
1842
|
+
*/
|
|
1843
|
+
|
|
1844
|
+
@SuppressWarnings("unchecked")
|
|
1845
|
+
public <T> T readValue(File src, Class<T> valueType)
|
|
1846
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1847
|
+
{
|
|
1848
|
+
// !!! TODO
|
|
1849
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1850
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueType));
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1854
|
+
public <T> T readValue(File src, TypeReference valueTypeRef)
|
|
1855
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1856
|
+
{
|
|
1857
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueTypeRef));
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
@SuppressWarnings("unchecked")
|
|
1861
|
+
public <T> T readValue(File src, JavaType valueType)
|
|
1862
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1863
|
+
{
|
|
1864
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), valueType);
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
@SuppressWarnings("unchecked")
|
|
1868
|
+
public <T> T readValue(URL src, Class<T> valueType)
|
|
1869
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1870
|
+
{
|
|
1871
|
+
// !!! TODO
|
|
1872
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1873
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueType));
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1877
|
+
public <T> T readValue(URL src, TypeReference valueTypeRef)
|
|
1878
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1879
|
+
{
|
|
1880
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueTypeRef));
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
@SuppressWarnings("unchecked")
|
|
1884
|
+
public <T> T readValue(URL src, JavaType valueType)
|
|
1885
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1886
|
+
{
|
|
1887
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), valueType);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
@SuppressWarnings("unchecked")
|
|
1891
|
+
public <T> T readValue(String content, Class<T> valueType)
|
|
1892
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1893
|
+
{
|
|
1894
|
+
// !!! TODO
|
|
1895
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1896
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(content), _typeFactory.constructType(valueType));
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1900
|
+
public <T> T readValue(String content, TypeReference valueTypeRef)
|
|
1901
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1902
|
+
{
|
|
1903
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(content), _typeFactory.constructType(valueTypeRef));
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
@SuppressWarnings("unchecked")
|
|
1907
|
+
public <T> T readValue(String content, JavaType valueType)
|
|
1908
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1909
|
+
{
|
|
1910
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(content), valueType);
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
@SuppressWarnings("unchecked")
|
|
1914
|
+
public <T> T readValue(Reader src, Class<T> valueType)
|
|
1915
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1916
|
+
{
|
|
1917
|
+
// !!! TODO
|
|
1918
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1919
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueType));
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1923
|
+
public <T> T readValue(Reader src, TypeReference valueTypeRef)
|
|
1924
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1925
|
+
{
|
|
1926
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueTypeRef));
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
@SuppressWarnings("unchecked")
|
|
1930
|
+
public <T> T readValue(Reader src, JavaType valueType)
|
|
1931
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1932
|
+
{
|
|
1933
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), valueType);
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
@SuppressWarnings("unchecked")
|
|
1937
|
+
public <T> T readValue(InputStream src, Class<T> valueType)
|
|
1938
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1939
|
+
{
|
|
1940
|
+
// !!! TODO
|
|
1941
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1942
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueType));
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1946
|
+
public <T> T readValue(InputStream src, TypeReference valueTypeRef)
|
|
1947
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1948
|
+
{
|
|
1949
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueTypeRef));
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
@SuppressWarnings("unchecked")
|
|
1953
|
+
public <T> T readValue(InputStream src, JavaType valueType)
|
|
1954
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1955
|
+
{
|
|
1956
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), valueType);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* @since 1.8
|
|
1961
|
+
*/
|
|
1962
|
+
@SuppressWarnings("unchecked")
|
|
1963
|
+
public <T> T readValue(byte[] src, Class<T> valueType)
|
|
1964
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1965
|
+
{
|
|
1966
|
+
// !!! TODO
|
|
1967
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1968
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueType));
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
@SuppressWarnings("unchecked")
|
|
1972
|
+
public <T> T readValue(byte[] src, int offset, int len,
|
|
1973
|
+
Class<T> valueType)
|
|
1974
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1975
|
+
{
|
|
1976
|
+
// !!! TODO
|
|
1977
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
1978
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src, offset, len), _typeFactory.constructType(valueType));
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* @since 1.8
|
|
1983
|
+
*/
|
|
1984
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1985
|
+
public <T> T readValue(byte[] src, TypeReference valueTypeRef)
|
|
1986
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1987
|
+
{
|
|
1988
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), _typeFactory.constructType(valueTypeRef));
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
1992
|
+
public <T> T readValue(byte[] src, int offset, int len,
|
|
1993
|
+
TypeReference valueTypeRef)
|
|
1994
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
1995
|
+
{
|
|
1996
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src, offset, len), _typeFactory.constructType(valueTypeRef));
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* @since 1.8
|
|
2001
|
+
*/
|
|
2002
|
+
@SuppressWarnings("unchecked")
|
|
2003
|
+
public <T> T readValue(byte[] src, JavaType valueType)
|
|
2004
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2005
|
+
{
|
|
2006
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src), valueType);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
@SuppressWarnings("unchecked")
|
|
2010
|
+
public <T> T readValue(byte[] src, int offset, int len,
|
|
2011
|
+
JavaType valueType)
|
|
2012
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2013
|
+
{
|
|
2014
|
+
return (T) _readMapAndClose(_jsonFactory.createJsonParser(src, offset, len), valueType);
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* Convenience method for converting results from given JSON tree into given
|
|
2019
|
+
* value type. Basically short-cut for:
|
|
2020
|
+
*<pre>
|
|
2021
|
+
* mapper.readValue(mapper.treeAsTokens(root), valueType);
|
|
2022
|
+
*</pre>
|
|
2023
|
+
*
|
|
2024
|
+
* @since 1.6
|
|
2025
|
+
*/
|
|
2026
|
+
@SuppressWarnings("unchecked")
|
|
2027
|
+
public <T> T readValue(JsonNode root, Class<T> valueType)
|
|
2028
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2029
|
+
{
|
|
2030
|
+
// !!! TODO
|
|
2031
|
+
// _setupClassLoaderForDeserialization(valueType);
|
|
2032
|
+
return (T) _readValue(copyDeserializationConfig(), treeAsTokens(root), _typeFactory.constructType(valueType));
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* Convenience method for converting results from given JSON tree into given
|
|
2037
|
+
* value type. Basically short-cut for:
|
|
2038
|
+
*<pre>
|
|
2039
|
+
* mapper.readValue(mapper.treeAsTokens(root), valueType);
|
|
2040
|
+
*</pre>
|
|
2041
|
+
*
|
|
2042
|
+
* @since 1.6
|
|
2043
|
+
*/
|
|
2044
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
2045
|
+
public <T> T readValue(JsonNode root, TypeReference valueTypeRef)
|
|
2046
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2047
|
+
{
|
|
2048
|
+
return (T) _readValue(copyDeserializationConfig(), treeAsTokens(root), _typeFactory.constructType(valueTypeRef));
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* Convenience method for converting results from given JSON tree into given
|
|
2053
|
+
* value type. Basically short-cut for:
|
|
2054
|
+
*<pre>
|
|
2055
|
+
* mapper.readValue(mapper.treeAsTokens(root), valueType);
|
|
2056
|
+
*</pre>
|
|
2057
|
+
*
|
|
2058
|
+
* @since 1.6
|
|
2059
|
+
*/
|
|
2060
|
+
@SuppressWarnings("unchecked")
|
|
2061
|
+
public <T> T readValue(JsonNode root, JavaType valueType)
|
|
2062
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2063
|
+
{
|
|
2064
|
+
return (T) _readValue(copyDeserializationConfig(), treeAsTokens(root), valueType);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/*
|
|
2068
|
+
/**********************************************************
|
|
2069
|
+
/* Extended Public API: serialization
|
|
2070
|
+
/* (mapping from Java types to Json)
|
|
2071
|
+
/**********************************************************
|
|
2072
|
+
*/
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Method that can be used to serialize any Java value as
|
|
2076
|
+
* JSON output, written to File provided.
|
|
2077
|
+
*/
|
|
2078
|
+
public void writeValue(File resultFile, Object value)
|
|
2079
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2080
|
+
{
|
|
2081
|
+
_configAndWriteValue(_jsonFactory.createJsonGenerator(resultFile, JsonEncoding.UTF8), value);
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* Method that can be used to serialize any Java value as
|
|
2086
|
+
* JSON output, using output stream provided (using encoding
|
|
2087
|
+
* {@link JsonEncoding#UTF8}).
|
|
2088
|
+
*<p>
|
|
2089
|
+
* Note: method does not close the underlying stream explicitly
|
|
2090
|
+
* here; however, {@link JsonFactory} this mapper uses may choose
|
|
2091
|
+
* to close the stream depending on its settings (by default,
|
|
2092
|
+
* it will try to close it when {@link JsonGenerator} we construct
|
|
2093
|
+
* is closed).
|
|
2094
|
+
*/
|
|
2095
|
+
public void writeValue(OutputStream out, Object value)
|
|
2096
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2097
|
+
{
|
|
2098
|
+
_configAndWriteValue(_jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8), value);
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* Method that can be used to serialize any Java value as
|
|
2103
|
+
* JSON output, using Writer provided.
|
|
2104
|
+
*<p>
|
|
2105
|
+
* Note: method does not close the underlying stream explicitly
|
|
2106
|
+
* here; however, {@link JsonFactory} this mapper uses may choose
|
|
2107
|
+
* to close the stream depending on its settings (by default,
|
|
2108
|
+
* it will try to close it when {@link JsonGenerator} we construct
|
|
2109
|
+
* is closed).
|
|
2110
|
+
*/
|
|
2111
|
+
public void writeValue(Writer w, Object value)
|
|
2112
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2113
|
+
{
|
|
2114
|
+
_configAndWriteValue(_jsonFactory.createJsonGenerator(w), value);
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* Method that can be used to serialize any Java value as
|
|
2119
|
+
* a String. Functionally equivalent to calling
|
|
2120
|
+
* {@link #writeValue(Writer,Object)} with {@link java.io.StringWriter}
|
|
2121
|
+
* and constructing String, but more efficient.
|
|
2122
|
+
*
|
|
2123
|
+
* @since 1.3
|
|
2124
|
+
*/
|
|
2125
|
+
public String writeValueAsString(Object value)
|
|
2126
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2127
|
+
{
|
|
2128
|
+
// alas, we have to pull the recycler directly here...
|
|
2129
|
+
SegmentedStringWriter sw = new SegmentedStringWriter(_jsonFactory._getBufferRecycler());
|
|
2130
|
+
_configAndWriteValue(_jsonFactory.createJsonGenerator(sw), value);
|
|
2131
|
+
return sw.getAndClear();
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
/**
|
|
2135
|
+
* Method that can be used to serialize any Java value as
|
|
2136
|
+
* a byte array. Functionally equivalent to calling
|
|
2137
|
+
* {@link #writeValue(Writer,Object)} with {@link java.io.ByteArrayOutputStream}
|
|
2138
|
+
* and getting bytes, but more efficient.
|
|
2139
|
+
* Encoding used will be UTF-8.
|
|
2140
|
+
*
|
|
2141
|
+
* @since 1.5
|
|
2142
|
+
*/
|
|
2143
|
+
public byte[] writeValueAsBytes(Object value)
|
|
2144
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2145
|
+
{
|
|
2146
|
+
ByteArrayBuilder bb = new ByteArrayBuilder(_jsonFactory._getBufferRecycler());
|
|
2147
|
+
_configAndWriteValue(_jsonFactory.createJsonGenerator(bb, JsonEncoding.UTF8), value);
|
|
2148
|
+
byte[] result = bb.toByteArray();
|
|
2149
|
+
bb.release();
|
|
2150
|
+
return result;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
/*
|
|
2154
|
+
/**********************************************************
|
|
2155
|
+
/* Extended Public API: constructing ObjectWriters
|
|
2156
|
+
/* for more advanced configuration
|
|
2157
|
+
/**********************************************************
|
|
2158
|
+
*/
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Convenience method for constructing {@link ObjectWriter}
|
|
2162
|
+
* with default settings.
|
|
2163
|
+
*
|
|
2164
|
+
* @since 1.6
|
|
2165
|
+
*/
|
|
2166
|
+
public ObjectWriter writer() {
|
|
2167
|
+
return new ObjectWriter(this, copySerializationConfig());
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2172
|
+
* serialize objects using specified {@link DateFormat}; or, if
|
|
2173
|
+
* null passed, using timestamp (64-bit number.
|
|
2174
|
+
*
|
|
2175
|
+
* @since 1.9
|
|
2176
|
+
*/
|
|
2177
|
+
public ObjectWriter writer(DateFormat df) {
|
|
2178
|
+
return new ObjectWriter(this,
|
|
2179
|
+
copySerializationConfig().withDateFormat(df));
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2184
|
+
* serialize objects using specified JSON View (filter).
|
|
2185
|
+
*
|
|
2186
|
+
* @since 1.9
|
|
2187
|
+
*/
|
|
2188
|
+
public ObjectWriter writerWithView(Class<?> serializationView) {
|
|
2189
|
+
return new ObjectWriter(this, copySerializationConfig().withView(serializationView));
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2194
|
+
* serialize objects using specified root type, instead of actual
|
|
2195
|
+
* runtime type of value. Type must be a super-type of runtime
|
|
2196
|
+
* type.
|
|
2197
|
+
*
|
|
2198
|
+
* @since 1.9
|
|
2199
|
+
*/
|
|
2200
|
+
public ObjectWriter writerWithType(Class<?> rootType) {
|
|
2201
|
+
JavaType t = (rootType == null) ? null : _typeFactory.constructType(rootType);
|
|
2202
|
+
return new ObjectWriter(this, copySerializationConfig(), t, /*PrettyPrinter*/null);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2207
|
+
* serialize objects using specified root type, instead of actual
|
|
2208
|
+
* runtime type of value. Type must be a super-type of runtime type.
|
|
2209
|
+
*
|
|
2210
|
+
* @since 1.9
|
|
2211
|
+
*/
|
|
2212
|
+
public ObjectWriter writerWithType(JavaType rootType) {
|
|
2213
|
+
return new ObjectWriter(this, copySerializationConfig(), rootType, /*PrettyPrinter*/null);
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2218
|
+
* serialize objects using specified root type, instead of actual
|
|
2219
|
+
* runtime type of value. Type must be a super-type of runtime type.
|
|
2220
|
+
*
|
|
2221
|
+
* @since 1.9
|
|
2222
|
+
*/
|
|
2223
|
+
public ObjectWriter writerWithType(TypeReference<?> rootType) {
|
|
2224
|
+
JavaType t = (rootType == null) ? null : _typeFactory.constructType(rootType);
|
|
2225
|
+
return new ObjectWriter(this, copySerializationConfig(), t, /*PrettyPrinter*/null);
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
/**
|
|
2229
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2230
|
+
* serialize objects using specified pretty printer for indentation
|
|
2231
|
+
* (or if null, no pretty printer)
|
|
2232
|
+
*
|
|
2233
|
+
* @since 1.9
|
|
2234
|
+
*/
|
|
2235
|
+
public ObjectWriter writer(PrettyPrinter pp) {
|
|
2236
|
+
if (pp == null) { // need to use a marker to indicate explicit disabling of pp
|
|
2237
|
+
pp = ObjectWriter.NULL_PRETTY_PRINTER;
|
|
2238
|
+
}
|
|
2239
|
+
return new ObjectWriter(this, copySerializationConfig(), /*root type*/ null, pp);
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2244
|
+
* serialize objects using the default pretty printer for indentation
|
|
2245
|
+
*
|
|
2246
|
+
* @since 1.9
|
|
2247
|
+
*/
|
|
2248
|
+
public ObjectWriter writerWithDefaultPrettyPrinter() {
|
|
2249
|
+
return new ObjectWriter(this, copySerializationConfig(),
|
|
2250
|
+
/*root type*/ null, _defaultPrettyPrinter());
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
/**
|
|
2254
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2255
|
+
* serialize objects using specified filter provider.
|
|
2256
|
+
*
|
|
2257
|
+
* @since 1.9
|
|
2258
|
+
*/
|
|
2259
|
+
public ObjectWriter writer(FilterProvider filterProvider) {
|
|
2260
|
+
return new ObjectWriter(this,
|
|
2261
|
+
copySerializationConfig().withFilters(filterProvider));
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Factory method for constructing {@link ObjectWriter} that will
|
|
2266
|
+
* pass specific schema object to {@link JsonGenerator} used for
|
|
2267
|
+
* writing content.
|
|
2268
|
+
*
|
|
2269
|
+
* @param schema Schema to pass to generator
|
|
2270
|
+
*
|
|
2271
|
+
* @since 1.9
|
|
2272
|
+
*/
|
|
2273
|
+
public ObjectWriter writer(FormatSchema schema) {
|
|
2274
|
+
return new ObjectWriter(this, copySerializationConfig(), schema);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/*
|
|
2278
|
+
/**********************************************************
|
|
2279
|
+
/* Deprecated ObjectWriter creator methods
|
|
2280
|
+
/**********************************************************
|
|
2281
|
+
*/
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* @deprecated Since 1.9, use {@link #writerWithType(Class)} instead.
|
|
2285
|
+
*/
|
|
2286
|
+
@Deprecated
|
|
2287
|
+
public ObjectWriter typedWriter(Class<?> rootType) {
|
|
2288
|
+
return writerWithType(rootType);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* @deprecated Since 1.9, use {@link #writerWithType(JavaType)} instead.
|
|
2293
|
+
*/
|
|
2294
|
+
@Deprecated
|
|
2295
|
+
public ObjectWriter typedWriter(JavaType rootType) {
|
|
2296
|
+
return writerWithType(rootType);
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
/**
|
|
2300
|
+
* @deprecated Since 1.9, use {@link #writerWithType(TypeReference)} instead.
|
|
2301
|
+
*/
|
|
2302
|
+
@Deprecated
|
|
2303
|
+
public ObjectWriter typedWriter(TypeReference<?> rootType) {
|
|
2304
|
+
return writerWithType(rootType);
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* @deprecated Since 1.9, use {@link #writerWithView(Class)} instead.
|
|
2309
|
+
*/
|
|
2310
|
+
@Deprecated
|
|
2311
|
+
public ObjectWriter viewWriter(Class<?> serializationView) {
|
|
2312
|
+
return writerWithView(serializationView);
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* @deprecated Since 1.9, use {@link #writer(FilterProvider)} instead.
|
|
2317
|
+
*/
|
|
2318
|
+
@Deprecated
|
|
2319
|
+
public ObjectWriter prettyPrintingWriter(PrettyPrinter pp) {
|
|
2320
|
+
return writer(pp);
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
/**
|
|
2324
|
+
* @deprecated Since 1.9, use {@link #writerWithDefaultPrettyPrinter} instead.
|
|
2325
|
+
*/
|
|
2326
|
+
@Deprecated
|
|
2327
|
+
public ObjectWriter defaultPrettyPrintingWriter() {
|
|
2328
|
+
return writerWithDefaultPrettyPrinter();
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* @deprecated Since 1.9, use {@link #writer(FilterProvider)} instead.
|
|
2333
|
+
*/
|
|
2334
|
+
@Deprecated
|
|
2335
|
+
public ObjectWriter filteredWriter(FilterProvider filterProvider) {
|
|
2336
|
+
return writer(filterProvider);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
/**
|
|
2340
|
+
* @deprecated Since 1.9, use {@link #writer(FilterProvider)} instead.
|
|
2341
|
+
*/
|
|
2342
|
+
@Deprecated
|
|
2343
|
+
public ObjectWriter schemaBasedWriter(FormatSchema schema) {
|
|
2344
|
+
return writer(schema);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
/*
|
|
2348
|
+
/**********************************************************
|
|
2349
|
+
/* Extended Public API: constructing ObjectReaders
|
|
2350
|
+
/* for more advanced configuration
|
|
2351
|
+
/**********************************************************
|
|
2352
|
+
*/
|
|
2353
|
+
|
|
2354
|
+
/**
|
|
2355
|
+
* Factory method for constructing {@link ObjectReader} with
|
|
2356
|
+
* default settings. Note that the resulting instance is NOT usable as is,
|
|
2357
|
+
* without defining expected value type.
|
|
2358
|
+
*
|
|
2359
|
+
* @since 1.6
|
|
2360
|
+
*/
|
|
2361
|
+
public ObjectReader reader() {
|
|
2362
|
+
return new ObjectReader(this, copyDeserializationConfig())
|
|
2363
|
+
.withInjectableValues(_injectableValues);
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2368
|
+
* update given Object (usually Bean, but can be a Collection or Map
|
|
2369
|
+
* as well, but NOT an array) with JSON data. Deserialization occurs
|
|
2370
|
+
* normally except that the root-level value in JSON is not used for
|
|
2371
|
+
* instantiating a new object; instead give updateable object is used
|
|
2372
|
+
* as root.
|
|
2373
|
+
* Runtime type of value object is used for locating deserializer,
|
|
2374
|
+
* unless overridden by other factory methods of {@link ObjectReader}
|
|
2375
|
+
*
|
|
2376
|
+
* @since 1.9
|
|
2377
|
+
*/
|
|
2378
|
+
public ObjectReader readerForUpdating(Object valueToUpdate)
|
|
2379
|
+
{
|
|
2380
|
+
JavaType t = _typeFactory.constructType(valueToUpdate.getClass());
|
|
2381
|
+
return new ObjectReader(this, copyDeserializationConfig(), t, valueToUpdate,
|
|
2382
|
+
null, _injectableValues);
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2387
|
+
* read or update instances of specified type
|
|
2388
|
+
*
|
|
2389
|
+
* @since 1.6
|
|
2390
|
+
*/
|
|
2391
|
+
public ObjectReader reader(JavaType type)
|
|
2392
|
+
{
|
|
2393
|
+
return new ObjectReader(this, copyDeserializationConfig(), type, null,
|
|
2394
|
+
null, _injectableValues);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2399
|
+
* read or update instances of specified type
|
|
2400
|
+
*
|
|
2401
|
+
* @since 1.6
|
|
2402
|
+
*/
|
|
2403
|
+
public ObjectReader reader(Class<?> type)
|
|
2404
|
+
{
|
|
2405
|
+
return reader(_typeFactory.constructType(type));
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
/**
|
|
2409
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2410
|
+
* read or update instances of specified type
|
|
2411
|
+
*
|
|
2412
|
+
* @since 1.6
|
|
2413
|
+
*/
|
|
2414
|
+
public ObjectReader reader(TypeReference<?> type)
|
|
2415
|
+
{
|
|
2416
|
+
return reader(_typeFactory.constructType(type));
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2421
|
+
* use specified {@link JsonNodeFactory} for constructing JSON trees.
|
|
2422
|
+
*
|
|
2423
|
+
* @since 1.6
|
|
2424
|
+
*/
|
|
2425
|
+
public ObjectReader reader(JsonNodeFactory f)
|
|
2426
|
+
{
|
|
2427
|
+
return new ObjectReader(this, copyDeserializationConfig()).withNodeFactory(f);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2432
|
+
* pass specific schema object to {@link JsonParser} used for
|
|
2433
|
+
* reading content.
|
|
2434
|
+
*
|
|
2435
|
+
* @param schema Schema to pass to parser
|
|
2436
|
+
*
|
|
2437
|
+
* @since 1.8
|
|
2438
|
+
*/
|
|
2439
|
+
public ObjectReader reader(FormatSchema schema) {
|
|
2440
|
+
return new ObjectReader(this, copyDeserializationConfig(), null, null,
|
|
2441
|
+
schema, _injectableValues);
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Factory method for constructing {@link ObjectReader} that will
|
|
2446
|
+
* use specified injectable values.
|
|
2447
|
+
*
|
|
2448
|
+
* @param injectableValues Injectable values to use
|
|
2449
|
+
*
|
|
2450
|
+
* @since 1.9
|
|
2451
|
+
*/
|
|
2452
|
+
public ObjectReader reader(InjectableValues injectableValues) {
|
|
2453
|
+
return new ObjectReader(this, copyDeserializationConfig(), null, null,
|
|
2454
|
+
null, injectableValues);
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
/*
|
|
2458
|
+
/**********************************************************
|
|
2459
|
+
/* Deprecated ObjectReader creator methods
|
|
2460
|
+
/**********************************************************
|
|
2461
|
+
*/
|
|
2462
|
+
|
|
2463
|
+
/**
|
|
2464
|
+
* @deprecated Since 1.9, use {@link #readerForUpdating} instead.
|
|
2465
|
+
*/
|
|
2466
|
+
@Deprecated
|
|
2467
|
+
public ObjectReader updatingReader(Object valueToUpdate) {
|
|
2468
|
+
return readerForUpdating(valueToUpdate);
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
/**
|
|
2472
|
+
* @deprecated Since 1.9, use {@link #reader(FormatSchema)} instead.
|
|
2473
|
+
*/
|
|
2474
|
+
@Deprecated
|
|
2475
|
+
public ObjectReader schemaBasedReader(FormatSchema schema) {
|
|
2476
|
+
return reader(schema);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/*
|
|
2480
|
+
/**********************************************************
|
|
2481
|
+
/* Extended Public API: convenience type conversion
|
|
2482
|
+
/**********************************************************
|
|
2483
|
+
*/
|
|
2484
|
+
|
|
2485
|
+
/**
|
|
2486
|
+
* Convenience method for doing two-step conversion from given value, into
|
|
2487
|
+
* instance of given value type. This is functionality equivalent to first
|
|
2488
|
+
* serializing given value into JSON, then binding JSON data into value
|
|
2489
|
+
* of given type, but may be executed without fully serializing into
|
|
2490
|
+
* JSON. Same converters (serializers, deserializers) will be used as for
|
|
2491
|
+
* data binding, meaning same object mapper configuration works.
|
|
2492
|
+
*
|
|
2493
|
+
* @throws IllegalArgumentException If conversion fails due to incompatible type;
|
|
2494
|
+
* if so, root cause will contain underlying checked exception data binding
|
|
2495
|
+
* functionality threw
|
|
2496
|
+
*/
|
|
2497
|
+
@SuppressWarnings("unchecked")
|
|
2498
|
+
public <T> T convertValue(Object fromValue, Class<T> toValueType)
|
|
2499
|
+
throws IllegalArgumentException
|
|
2500
|
+
{
|
|
2501
|
+
return (T) _convert(fromValue, _typeFactory.constructType(toValueType));
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
2505
|
+
public <T> T convertValue(Object fromValue, TypeReference toValueTypeRef)
|
|
2506
|
+
throws IllegalArgumentException
|
|
2507
|
+
{
|
|
2508
|
+
return (T) _convert(fromValue, _typeFactory.constructType(toValueTypeRef));
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
@SuppressWarnings("unchecked")
|
|
2512
|
+
public <T> T convertValue(Object fromValue, JavaType toValueType)
|
|
2513
|
+
throws IllegalArgumentException
|
|
2514
|
+
{
|
|
2515
|
+
return (T) _convert(fromValue, toValueType);
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
protected Object _convert(Object fromValue, JavaType toValueType)
|
|
2519
|
+
throws IllegalArgumentException
|
|
2520
|
+
{
|
|
2521
|
+
// sanity check for null first:
|
|
2522
|
+
if (fromValue == null) return null;
|
|
2523
|
+
/* Then use TokenBuffer, which is a JsonGenerator:
|
|
2524
|
+
* (see [JACKSON-175])
|
|
2525
|
+
*/
|
|
2526
|
+
TokenBuffer buf = new TokenBuffer(this);
|
|
2527
|
+
try {
|
|
2528
|
+
writeValue(buf, fromValue);
|
|
2529
|
+
// and provide as with a JsonParser for contents as well!
|
|
2530
|
+
JsonParser jp = buf.asParser();
|
|
2531
|
+
Object result = readValue(jp, toValueType);
|
|
2532
|
+
jp.close();
|
|
2533
|
+
return result;
|
|
2534
|
+
} catch (IOException e) { // should not occur, no real i/o...
|
|
2535
|
+
throw new IllegalArgumentException(e.getMessage(), e);
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/*
|
|
2540
|
+
/**********************************************************
|
|
2541
|
+
/* Extended Public API: JSON Schema generation
|
|
2542
|
+
/**********************************************************
|
|
2543
|
+
*/
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Generate <a href="http://json-schema.org/">Json-schema</a>
|
|
2547
|
+
* instance for specified class.
|
|
2548
|
+
*
|
|
2549
|
+
* @param t The class to generate schema for
|
|
2550
|
+
* @return Constructed JSON schema.
|
|
2551
|
+
*/
|
|
2552
|
+
public JsonSchema generateJsonSchema(Class<?> t)
|
|
2553
|
+
throws JsonMappingException
|
|
2554
|
+
{
|
|
2555
|
+
return generateJsonSchema(t, copySerializationConfig());
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
/**
|
|
2559
|
+
* Generate <a href="http://json-schema.org/">Json-schema</a>
|
|
2560
|
+
* instance for specified class, using specific
|
|
2561
|
+
* serialization configuration
|
|
2562
|
+
*
|
|
2563
|
+
* @param t The class to generate schema for
|
|
2564
|
+
* @return Constructed JSON schema.
|
|
2565
|
+
*/
|
|
2566
|
+
public JsonSchema generateJsonSchema(Class<?> t, SerializationConfig cfg)
|
|
2567
|
+
throws JsonMappingException
|
|
2568
|
+
{
|
|
2569
|
+
return _serializerProvider.generateJsonSchema(t, cfg, _serializerFactory);
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/*
|
|
2573
|
+
/**********************************************************
|
|
2574
|
+
/* Internal methods for serialization, overridable
|
|
2575
|
+
/**********************************************************
|
|
2576
|
+
*/
|
|
2577
|
+
|
|
2578
|
+
/**
|
|
2579
|
+
* Helper method that should return default pretty-printer to
|
|
2580
|
+
* use for generators constructed by this mapper, when instructed
|
|
2581
|
+
* to use default pretty printer.
|
|
2582
|
+
*
|
|
2583
|
+
* @since 1.7
|
|
2584
|
+
*/
|
|
2585
|
+
protected PrettyPrinter _defaultPrettyPrinter() {
|
|
2586
|
+
return new DefaultPrettyPrinter();
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/**
|
|
2590
|
+
* Method called to configure the generator as necessary and then
|
|
2591
|
+
* call write functionality
|
|
2592
|
+
*/
|
|
2593
|
+
protected final void _configAndWriteValue(JsonGenerator jgen, Object value)
|
|
2594
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2595
|
+
{
|
|
2596
|
+
SerializationConfig cfg = copySerializationConfig();
|
|
2597
|
+
// [JACKSON-96]: allow enabling pretty printing for ObjectMapper directly
|
|
2598
|
+
if (cfg.isEnabled(SerializationConfig.Feature.INDENT_OUTPUT)) {
|
|
2599
|
+
jgen.useDefaultPrettyPrinter();
|
|
2600
|
+
}
|
|
2601
|
+
// [JACKSON-282]: consider Closeable
|
|
2602
|
+
if (cfg.isEnabled(SerializationConfig.Feature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) {
|
|
2603
|
+
_configAndWriteCloseable(jgen, value, cfg);
|
|
2604
|
+
return;
|
|
2605
|
+
}
|
|
2606
|
+
boolean closed = false;
|
|
2607
|
+
try {
|
|
2608
|
+
_serializerProvider.serializeValue(cfg, jgen, value, _serializerFactory);
|
|
2609
|
+
closed = true;
|
|
2610
|
+
jgen.close();
|
|
2611
|
+
} finally {
|
|
2612
|
+
/* won't try to close twice; also, must catch exception (so it
|
|
2613
|
+
* will not mask exception that is pending)
|
|
2614
|
+
*/
|
|
2615
|
+
if (!closed) {
|
|
2616
|
+
try {
|
|
2617
|
+
jgen.close();
|
|
2618
|
+
} catch (IOException ioe) { }
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
protected final void _configAndWriteValue(JsonGenerator jgen, Object value, Class<?> viewClass)
|
|
2624
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2625
|
+
{
|
|
2626
|
+
SerializationConfig cfg = copySerializationConfig().withView(viewClass);
|
|
2627
|
+
if (cfg.isEnabled(SerializationConfig.Feature.INDENT_OUTPUT)) {
|
|
2628
|
+
jgen.useDefaultPrettyPrinter();
|
|
2629
|
+
}
|
|
2630
|
+
// [JACKSON-282]: consider Closeable
|
|
2631
|
+
if (cfg.isEnabled(SerializationConfig.Feature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) {
|
|
2632
|
+
_configAndWriteCloseable(jgen, value, cfg);
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
boolean closed = false;
|
|
2636
|
+
try {
|
|
2637
|
+
_serializerProvider.serializeValue(cfg, jgen, value, _serializerFactory);
|
|
2638
|
+
closed = true;
|
|
2639
|
+
jgen.close();
|
|
2640
|
+
} finally {
|
|
2641
|
+
if (!closed) {
|
|
2642
|
+
try {
|
|
2643
|
+
jgen.close();
|
|
2644
|
+
} catch (IOException ioe) { }
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
/**
|
|
2650
|
+
* Helper method used when value to serialize is {@link Closeable} and its <code>close()</code>
|
|
2651
|
+
* method is to be called right after serialization has been called
|
|
2652
|
+
*/
|
|
2653
|
+
private final void _configAndWriteCloseable(JsonGenerator jgen, Object value, SerializationConfig cfg)
|
|
2654
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2655
|
+
{
|
|
2656
|
+
Closeable toClose = (Closeable) value;
|
|
2657
|
+
try {
|
|
2658
|
+
_serializerProvider.serializeValue(cfg, jgen, value, _serializerFactory);
|
|
2659
|
+
JsonGenerator tmpJgen = jgen;
|
|
2660
|
+
jgen = null;
|
|
2661
|
+
tmpJgen.close();
|
|
2662
|
+
Closeable tmpToClose = toClose;
|
|
2663
|
+
toClose = null;
|
|
2664
|
+
tmpToClose.close();
|
|
2665
|
+
} finally {
|
|
2666
|
+
/* Need to close both generator and value, as long as they haven't yet
|
|
2667
|
+
* been closed
|
|
2668
|
+
*/
|
|
2669
|
+
if (jgen != null) {
|
|
2670
|
+
try {
|
|
2671
|
+
jgen.close();
|
|
2672
|
+
} catch (IOException ioe) { }
|
|
2673
|
+
}
|
|
2674
|
+
if (toClose != null) {
|
|
2675
|
+
try {
|
|
2676
|
+
toClose.close();
|
|
2677
|
+
} catch (IOException ioe) { }
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
/**
|
|
2683
|
+
* Helper method used when value to serialize is {@link Closeable} and its <code>close()</code>
|
|
2684
|
+
* method is to be called right after serialization has been called
|
|
2685
|
+
*/
|
|
2686
|
+
private final void _writeCloseableValue(JsonGenerator jgen, Object value, SerializationConfig cfg)
|
|
2687
|
+
throws IOException, JsonGenerationException, JsonMappingException
|
|
2688
|
+
{
|
|
2689
|
+
Closeable toClose = (Closeable) value;
|
|
2690
|
+
try {
|
|
2691
|
+
_serializerProvider.serializeValue(cfg, jgen, value, _serializerFactory);
|
|
2692
|
+
if (cfg.isEnabled(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE)) {
|
|
2693
|
+
jgen.flush();
|
|
2694
|
+
}
|
|
2695
|
+
Closeable tmpToClose = toClose;
|
|
2696
|
+
toClose = null;
|
|
2697
|
+
tmpToClose.close();
|
|
2698
|
+
} finally {
|
|
2699
|
+
if (toClose != null) {
|
|
2700
|
+
try {
|
|
2701
|
+
toClose.close();
|
|
2702
|
+
} catch (IOException ioe) { }
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
/*
|
|
2708
|
+
/**********************************************************
|
|
2709
|
+
/* Internal methods for deserialization, overridable
|
|
2710
|
+
/**********************************************************
|
|
2711
|
+
*/
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* Actual implementation of value reading+binding operation.
|
|
2715
|
+
*/
|
|
2716
|
+
protected Object _readValue(DeserializationConfig cfg, JsonParser jp, JavaType valueType)
|
|
2717
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2718
|
+
{
|
|
2719
|
+
/* First: may need to read the next token, to initialize
|
|
2720
|
+
* state (either before first read from parser, or after
|
|
2721
|
+
* previous token has been cleared)
|
|
2722
|
+
*/
|
|
2723
|
+
Object result;
|
|
2724
|
+
JsonToken t = _initForReading(jp);
|
|
2725
|
+
if (t == JsonToken.VALUE_NULL) {
|
|
2726
|
+
// [JACKSON-643]: Ask JsonDeserializer what 'null value' to use:
|
|
2727
|
+
result = _findRootDeserializer(cfg, valueType).getNullValue();
|
|
2728
|
+
} else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) {
|
|
2729
|
+
result = null;
|
|
2730
|
+
} else { // pointing to event other than null
|
|
2731
|
+
DeserializationContext ctxt = _createDeserializationContext(jp, cfg);
|
|
2732
|
+
JsonDeserializer<Object> deser = _findRootDeserializer(cfg, valueType);
|
|
2733
|
+
// ok, let's get the value
|
|
2734
|
+
if (cfg.isEnabled(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE)) {
|
|
2735
|
+
result = _unwrapAndDeserialize(jp, valueType, ctxt, deser);
|
|
2736
|
+
} else {
|
|
2737
|
+
result = deser.deserialize(jp, ctxt);
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
// Need to consume the token too
|
|
2741
|
+
jp.clearCurrentToken();
|
|
2742
|
+
return result;
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
protected Object _readMapAndClose(JsonParser jp, JavaType valueType)
|
|
2747
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2748
|
+
{
|
|
2749
|
+
try {
|
|
2750
|
+
Object result;
|
|
2751
|
+
JsonToken t = _initForReading(jp);
|
|
2752
|
+
if (t == JsonToken.VALUE_NULL) {
|
|
2753
|
+
// [JACKSON-643]: Ask JsonDeserializer what 'null value' to use:
|
|
2754
|
+
// (note: probably no need to make a copy of config for just this access)
|
|
2755
|
+
result = _findRootDeserializer(this._deserializationConfig, valueType).getNullValue();
|
|
2756
|
+
} else if (t == JsonToken.END_ARRAY || t == JsonToken.END_OBJECT) {
|
|
2757
|
+
result = null;
|
|
2758
|
+
} else {
|
|
2759
|
+
DeserializationConfig cfg = copyDeserializationConfig();
|
|
2760
|
+
DeserializationContext ctxt = _createDeserializationContext(jp, cfg);
|
|
2761
|
+
JsonDeserializer<Object> deser = _findRootDeserializer(cfg, valueType);
|
|
2762
|
+
if (cfg.isEnabled(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE)) {
|
|
2763
|
+
result = _unwrapAndDeserialize(jp, valueType, ctxt, deser);
|
|
2764
|
+
} else {
|
|
2765
|
+
result = deser.deserialize(jp, ctxt);
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
// Need to consume the token too
|
|
2769
|
+
jp.clearCurrentToken();
|
|
2770
|
+
return result;
|
|
2771
|
+
} finally {
|
|
2772
|
+
try {
|
|
2773
|
+
jp.close();
|
|
2774
|
+
} catch (IOException ioe) { }
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
/**
|
|
2779
|
+
* Method called to ensure that given parser is ready for reading
|
|
2780
|
+
* content for data binding.
|
|
2781
|
+
*
|
|
2782
|
+
* @return First token to be used for data binding after this call:
|
|
2783
|
+
* can never be null as exception will be thrown if parser can not
|
|
2784
|
+
* provide more tokens.
|
|
2785
|
+
*
|
|
2786
|
+
* @throws IOException if the underlying input source has problems during
|
|
2787
|
+
* parsing
|
|
2788
|
+
* @throws JsonParseException if parser has problems parsing content
|
|
2789
|
+
* @throws JsonMappingException if the parser does not have any more
|
|
2790
|
+
* content to map (note: Json "null" value is considered content;
|
|
2791
|
+
* enf-of-stream not)
|
|
2792
|
+
*/
|
|
2793
|
+
protected JsonToken _initForReading(JsonParser jp)
|
|
2794
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2795
|
+
{
|
|
2796
|
+
/* First: must point to a token; if not pointing to one, advance.
|
|
2797
|
+
* This occurs before first read from JsonParser, as well as
|
|
2798
|
+
* after clearing of current token.
|
|
2799
|
+
*/
|
|
2800
|
+
JsonToken t = jp.getCurrentToken();
|
|
2801
|
+
if (t == null) {
|
|
2802
|
+
// and then we must get something...
|
|
2803
|
+
t = jp.nextToken();
|
|
2804
|
+
if (t == null) {
|
|
2805
|
+
/* [JACKSON-99] Should throw EOFException, closest thing
|
|
2806
|
+
* semantically
|
|
2807
|
+
*/
|
|
2808
|
+
throw new EOFException("No content to map to Object due to end of input");
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
return t;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
protected Object _unwrapAndDeserialize(JsonParser jp, JavaType rootType,
|
|
2815
|
+
DeserializationContext ctxt, JsonDeserializer<Object> deser)
|
|
2816
|
+
throws IOException, JsonParseException, JsonMappingException
|
|
2817
|
+
{
|
|
2818
|
+
SerializedString rootName = _deserializerProvider.findExpectedRootName(ctxt.getConfig(), rootType);
|
|
2819
|
+
if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
|
|
2820
|
+
throw JsonMappingException.from(jp, "Current token not START_OBJECT (needed to unwrap root name '"
|
|
2821
|
+
+rootName+"'), but "+jp.getCurrentToken());
|
|
2822
|
+
}
|
|
2823
|
+
if (jp.nextToken() != JsonToken.FIELD_NAME) {
|
|
2824
|
+
throw JsonMappingException.from(jp, "Current token not FIELD_NAME (to contain expected root name '"
|
|
2825
|
+
+rootName+"'), but "+jp.getCurrentToken());
|
|
2826
|
+
}
|
|
2827
|
+
String actualName = jp.getCurrentName();
|
|
2828
|
+
if (!rootName.getValue().equals(actualName)) {
|
|
2829
|
+
throw JsonMappingException.from(jp, "Root name '"+actualName+"' does not match expected ('"+rootName
|
|
2830
|
+
+"') for type "+rootType);
|
|
2831
|
+
}
|
|
2832
|
+
// ok, then move to value itself....
|
|
2833
|
+
jp.nextToken();
|
|
2834
|
+
|
|
2835
|
+
Object result = deser.deserialize(jp, ctxt);
|
|
2836
|
+
// and last, verify that we now get matching END_OBJECT
|
|
2837
|
+
if (jp.nextToken() != JsonToken.END_OBJECT) {
|
|
2838
|
+
throw JsonMappingException.from(jp, "Current token not END_OBJECT (to match wrapper object with root name '"
|
|
2839
|
+
+rootName+"'), but "+jp.getCurrentToken());
|
|
2840
|
+
}
|
|
2841
|
+
return result;
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
/*
|
|
2845
|
+
/**********************************************************
|
|
2846
|
+
/* Internal methods, other
|
|
2847
|
+
/**********************************************************
|
|
2848
|
+
*/
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* Method called to locate deserializer for the passed root-level value.
|
|
2852
|
+
*/
|
|
2853
|
+
protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType)
|
|
2854
|
+
throws JsonMappingException
|
|
2855
|
+
{
|
|
2856
|
+
// First: have we already seen it?
|
|
2857
|
+
JsonDeserializer<Object> deser = _rootDeserializers.get(valueType);
|
|
2858
|
+
if (deser != null) {
|
|
2859
|
+
return deser;
|
|
2860
|
+
}
|
|
2861
|
+
// Nope: need to ask provider to resolve it
|
|
2862
|
+
deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null);
|
|
2863
|
+
if (deser == null) { // can this happen?
|
|
2864
|
+
throw new JsonMappingException("Can not find a deserializer for type "+valueType);
|
|
2865
|
+
}
|
|
2866
|
+
_rootDeserializers.put(valueType, deser);
|
|
2867
|
+
return deser;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
protected DeserializationContext _createDeserializationContext(JsonParser jp, DeserializationConfig cfg)
|
|
2871
|
+
{
|
|
2872
|
+
return new StdDeserializationContext(cfg, jp, _deserializerProvider,
|
|
2873
|
+
_injectableValues);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
//Allows use of the correct classloader (primarily for OSGi), separating framework from application
|
|
2877
|
+
//should be safe to use in all contexts
|
|
2878
|
+
/*
|
|
2879
|
+
protected <T> void _setupClassLoaderForDeserialization(Class<T> valueType)
|
|
2880
|
+
{
|
|
2881
|
+
ClassLoader loader = (valueType.getClassLoader() == null) ? Thread.currentThread().getContextClassLoader() : valueType.getClassLoader();
|
|
2882
|
+
Thread.currentThread().setContextClassLoader(loader);
|
|
2883
|
+
}
|
|
2884
|
+
*/
|
|
2885
|
+
}
|