├── README.txt
├── ant
├── build-clirr.xml
├── build-coverage.xml
├── build-jarjar-asm.xml
├── build-maven-deploy.xml
├── build-mini.xml
├── build-osgi.xml
└── build-test.xml
├── bin
├── profile-json-perf.sh
├── profile-read-perf.sh
├── run-copy-perf.sh
├── run-json-perf.sh
├── run-read-perf.sh
└── run-ser-perf.sh
├── build.xml
├── contrib
└── materialized-interface
│ ├── BeanHelper.java
│ ├── MaterializingDeserializerFactory.java
│ ├── README
│ └── TestMaterializingDeserializer.java
├── lib
├── ant
│ ├── bndtask-0.2.0.jar
│ └── maven-ant-tasks-2.0.10.jar
├── cobertura
│ ├── asm-tree-3.0.jar
│ ├── cobertura-1.9.4.1.jar
│ ├── jakarta-oro-2.0.8.jar
│ └── log4j-1.2.13.jar
├── ext
│ ├── asm
│ │ └── asm-3.3.jar
│ ├── cglib
│ │ └── cglib-nodep-2.2.jar
│ ├── google
│ │ └── google-collections-1.0.jar
│ ├── groovy
│ │ ├── antlr-2.7.7.jar
│ │ └── groovy-1.7.4.jar
│ ├── hibernate
│ │ └── hibernate-cglib-repack-nodep-2.1_3-SNAPSHOT.jar
│ ├── jarjar
│ │ └── jarjar-1.0.jar
│ └── joda-time-1.5.2.jar
├── jaxb
│ ├── activation.jar
│ └── jaxb-api-2.0.jar
├── jaxrs
│ ├── jersey-core-1.1.5.jar
│ ├── jersey-server-1.1.5.jar
│ └── jsr311-api-1.1.jar
├── junit
│ └── junit-4.8.2.jar
├── perf
│ ├── antlr-2.7.6.jar
│ ├── jackson-module-json-org-0.9.1.jar
│ ├── json-org.jar
│ └── json-smart-1.0.6.1.jar
└── repackaged
│ └── jackson-asm-3.3.jar
├── obsolete-src
└── README
├── profile.sh
├── regression
├── clirr-core-0.6-uber.jar
├── jackson-core-asl-1.7.3.jar
└── jackson-mapper-asl-1.7.3.jar
├── release-notes
├── CREDITS
├── VERSION
├── asl
│ ├── ASL2.0
│ ├── LICENSE
│ └── NOTICE
└── lgpl
│ ├── LGPL2.1
│ ├── LICENSE
│ └── NOTICE
├── run.sh
├── samples-nondist
├── twitter-search-mod-entry.json
└── twitter-search.jsn
├── samples-smile
├── db100.xml.smile
├── json-org-sample1.smile
├── json-org-sample2.smile
├── json-org-sample3.smile
├── json-org-sample4.smile
├── json-org-sample5.smile
├── map-spam.xml.smile
├── ns-invoice100.xml.smile
├── ns-soap.xml.smile
├── numbers-fp-4k.smile
├── numbers-fp-64k.smile
├── numbers-int-4k.smile
├── numbers-int-64k.smile
├── test1.smile
└── test2.smile
├── samples
├── db100.xml.jsn
├── json-org-sample1-nows.jsn
├── json-org-sample1.jsn
├── json-org-sample2.jsn
├── json-org-sample3.jsn
├── json-org-sample4-nows.jsn
├── json-org-sample4.jsn
├── json-org-sample5-nows.jsn
├── json-org-sample5.jsn
├── jvm-ser1.json
├── map-spain.xml.jsn
├── ns-invoice100.xml.jsn
├── ns-soap.xml.jsn
├── numbers-fp-4k.jsn
├── numbers-fp-64k.jsn
├── numbers-int-4k.jsn
├── numbers-int-64k.jsn
├── test1.jsn
└── test2.jsn
├── sandbox
└── tests
│ └── TestOverloaded.java
└── src
├── VERSION.txt
├── java
└── org
│ └── codehaus
│ └── jackson
│ ├── Base64Variant.java
│ ├── Base64Variants.java
│ ├── FormatSchema.java
│ ├── JsonEncoding.java
│ ├── JsonFactory.java
│ ├── JsonGenerationException.java
│ ├── JsonGenerator.java
│ ├── JsonLocation.java
│ ├── JsonNode.java
│ ├── JsonParseException.java
│ ├── JsonParser.java
│ ├── JsonProcessingException.java
│ ├── JsonStreamContext.java
│ ├── JsonToken.java
│ ├── ObjectCodec.java
│ ├── PrettyPrinter.java
│ ├── SerializableString.java
│ ├── Version.java
│ ├── Versioned.java
│ ├── annotate
│ ├── JacksonAnnotation.java
│ ├── JsonAnyGetter.java
│ ├── JsonAnySetter.java
│ ├── JsonAutoDetect.java
│ ├── JsonBackReference.java
│ ├── JsonCreator.java
│ ├── JsonGetter.java
│ ├── JsonIgnore.java
│ ├── JsonIgnoreProperties.java
│ ├── JsonIgnoreType.java
│ ├── JsonManagedReference.java
│ ├── JsonMethod.java
│ ├── JsonProperty.java
│ ├── JsonPropertyOrder.java
│ ├── JsonRawValue.java
│ ├── JsonSetter.java
│ ├── JsonSubTypes.java
│ ├── JsonTypeInfo.java
│ ├── JsonTypeName.java
│ ├── JsonUnwrapped.java
│ ├── JsonValue.java
│ ├── JsonWriteNullProperties.java
│ └── package-info.java
│ ├── format
│ ├── DataFormatDetector.java
│ ├── DataFormatMatcher.java
│ ├── InputAccessor.java
│ ├── MatchStrength.java
│ └── package-info.java
│ ├── impl
│ ├── ByteSourceBootstrapper.java
│ ├── DefaultPrettyPrinter.java
│ ├── Indenter.java
│ ├── JsonGeneratorBase.java
│ ├── JsonNumericParserBase.java
│ ├── JsonParserBase.java
│ ├── JsonParserMinimalBase.java
│ ├── JsonReadContext.java
│ ├── JsonWriteContext.java
│ ├── ReaderBasedParser.java
│ ├── ReaderBasedParserBase.java
│ ├── StreamBasedParserBase.java
│ ├── Utf8Generator.java
│ ├── Utf8StreamParser.java
│ ├── WriterBasedGenerator.java
│ └── package-info.java
│ ├── io
│ ├── BaseReader.java
│ ├── CharacterEscapes.java
│ ├── IOContext.java
│ ├── InputDecorator.java
│ ├── JsonStringEncoder.java
│ ├── MergedStream.java
│ ├── NumberInput.java
│ ├── NumberOutput.java
│ ├── OutputDecorator.java
│ ├── SegmentedStringWriter.java
│ ├── SerializedString.java
│ ├── UTF32Reader.java
│ ├── UTF8Writer.java
│ └── package.html
│ ├── package-info.java
│ ├── sym
│ ├── BytesToNameCanonicalizer.java
│ ├── CharsToNameCanonicalizer.java
│ ├── Name.java
│ ├── Name1.java
│ ├── Name2.java
│ ├── Name3.java
│ ├── NameN.java
│ └── package-info.java
│ ├── type
│ ├── JavaType.java
│ ├── TypeReference.java
│ └── package-info.java
│ └── util
│ ├── BufferRecycler.java
│ ├── ByteArrayBuilder.java
│ ├── CharTypes.java
│ ├── DefaultPrettyPrinter.java
│ ├── InternCache.java
│ ├── JsonGeneratorDelegate.java
│ ├── JsonParserDelegate.java
│ ├── JsonParserSequence.java
│ ├── MinimalPrettyPrinter.java
│ ├── TextBuffer.java
│ ├── TokenBuffer.java
│ ├── VersionUtil.java
│ └── package-info.java
├── jaxrs
├── java
│ └── org
│ │ └── codehaus
│ │ └── jackson
│ │ └── jaxrs
│ │ ├── Annotations.java
│ │ ├── JacksonJaxbJsonProvider.java
│ │ ├── JacksonJsonProvider.java
│ │ ├── JsonMappingExceptionMapper.java
│ │ ├── JsonParseExceptionMapper.java
│ │ ├── MapperConfigurator.java
│ │ └── package-info.java
└── resources
│ ├── javax.ws.rs.ext.MessageBodyReader
│ └── javax.ws.rs.ext.MessageBodyWriter
├── mapper
└── java
│ └── org
│ └── codehaus
│ └── jackson
│ ├── map
│ ├── AbstractTypeResolver.java
│ ├── AnnotationIntrospector.java
│ ├── BeanDescription.java
│ ├── BeanProperty.java
│ ├── BeanPropertyDefinition.java
│ ├── ClassIntrospector.java
│ ├── ContextualDeserializer.java
│ ├── ContextualKeyDeserializer.java
│ ├── ContextualSerializer.java
│ ├── DeserializationConfig.java
│ ├── DeserializationContext.java
│ ├── DeserializationProblemHandler.java
│ ├── DeserializerFactory.java
│ ├── DeserializerProvider.java
│ ├── Deserializers.java
│ ├── HandlerInstantiator.java
│ ├── InjectableValues.java
│ ├── JsonDeserializer.java
│ ├── JsonMappingException.java
│ ├── JsonSerializable.java
│ ├── JsonSerializableWithType.java
│ ├── JsonSerializer.java
│ ├── KeyDeserializer.java
│ ├── KeyDeserializers.java
│ ├── MapperConfig.java
│ ├── MappingIterator.java
│ ├── MappingJsonFactory.java
│ ├── Module.java
│ ├── ObjectMapper.java
│ ├── ObjectReader.java
│ ├── ObjectWriter.java
│ ├── PropertyNamingStrategy.java
│ ├── ResolvableDeserializer.java
│ ├── ResolvableSerializer.java
│ ├── RuntimeJsonMappingException.java
│ ├── SerializationConfig.java
│ ├── SerializerFactory.java
│ ├── SerializerProvider.java
│ ├── Serializers.java
│ ├── TypeDeserializer.java
│ ├── TypeSerializer.java
│ ├── annotate
│ │ ├── JacksonInject.java
│ │ ├── JacksonStdImpl.java
│ │ ├── JsonCachable.java
│ │ ├── JsonDeserialize.java
│ │ ├── JsonFilter.java
│ │ ├── JsonRootName.java
│ │ ├── JsonSerialize.java
│ │ ├── JsonTypeIdResolver.java
│ │ ├── JsonTypeResolver.java
│ │ ├── JsonValueInstantiator.java
│ │ ├── JsonView.java
│ │ ├── NoClass.java
│ │ └── package-info.java
│ ├── deser
│ │ ├── AbstractDeserializer.java
│ │ ├── ArrayDeserializer.java
│ │ ├── ArrayDeserializers.java
│ │ ├── BasicDeserializerFactory.java
│ │ ├── BeanDeserializer.java
│ │ ├── BeanDeserializerBuilder.java
│ │ ├── BeanDeserializerFactory.java
│ │ ├── BeanDeserializerModifier.java
│ │ ├── CollectionDeserializer.java
│ │ ├── ContainerDeserializer.java
│ │ ├── CustomDeserializerFactory.java
│ │ ├── DateDeserializer.java
│ │ ├── EnumDeserializer.java
│ │ ├── EnumResolver.java
│ │ ├── FromStringDeserializer.java
│ │ ├── JsonNodeDeserializer.java
│ │ ├── MapDeserializer.java
│ │ ├── SettableAnyProperty.java
│ │ ├── SettableBeanProperty.java
│ │ ├── StdDeserializationContext.java
│ │ ├── StdDeserializer.java
│ │ ├── StdDeserializerProvider.java
│ │ ├── StdDeserializers.java
│ │ ├── StdKeyDeserializer.java
│ │ ├── StdKeyDeserializers.java
│ │ ├── StdScalarDeserializer.java
│ │ ├── ThrowableDeserializer.java
│ │ ├── UntypedObjectDeserializer.java
│ │ ├── ValueInstantiator.java
│ │ ├── ValueInstantiators.java
│ │ ├── impl
│ │ │ ├── BeanPropertyMap.java
│ │ │ ├── CreatorCollector.java
│ │ │ ├── CreatorProperty.java
│ │ │ ├── ExternalTypeHandler.java
│ │ │ ├── PropertyBasedCreator.java
│ │ │ ├── PropertyValue.java
│ │ │ ├── PropertyValueBuffer.java
│ │ │ ├── UnwrappedPropertyHandler.java
│ │ │ ├── ValueInjector.java
│ │ │ └── package-info.java
│ │ ├── package-info.java
│ │ └── std
│ │ │ ├── AtomicBooleanDeserializer.java
│ │ │ ├── AtomicReferenceDeserializer.java
│ │ │ ├── CalendarDeserializer.java
│ │ │ ├── ClassDeserializer.java
│ │ │ ├── CollectionDeserializer.java
│ │ │ ├── ContainerDeserializerBase.java
│ │ │ ├── DateDeserializer.java
│ │ │ ├── EnumDeserializer.java
│ │ │ ├── EnumMapDeserializer.java
│ │ │ ├── EnumSetDeserializer.java
│ │ │ ├── FromStringDeserializer.java
│ │ │ ├── JavaTypeDeserializer.java
│ │ │ ├── JsonNodeDeserializer.java
│ │ │ ├── MapDeserializer.java
│ │ │ ├── ObjectArrayDeserializer.java
│ │ │ ├── PrimitiveArrayDeserializers.java
│ │ │ ├── StdDeserializer.java
│ │ │ ├── StdKeyDeserializer.java
│ │ │ ├── StdKeyDeserializers.java
│ │ │ ├── StdScalarDeserializer.java
│ │ │ ├── StdValueInstantiator.java
│ │ │ ├── StringCollectionDeserializer.java
│ │ │ ├── StringDeserializer.java
│ │ │ ├── ThrowableDeserializer.java
│ │ │ ├── TimestampDeserializer.java
│ │ │ ├── TokenBufferDeserializer.java
│ │ │ ├── UntypedObjectDeserializer.java
│ │ │ └── package-info.java
│ ├── exc
│ │ └── UnrecognizedPropertyException.java
│ ├── ext
│ │ ├── CoreXMLDeserializers.java
│ │ ├── CoreXMLSerializers.java
│ │ ├── DOMDeserializer.java
│ │ ├── DOMSerializer.java
│ │ ├── JodaDeserializers.java
│ │ ├── JodaSerializers.java
│ │ ├── OptionalHandlerFactory.java
│ │ └── package-info.java
│ ├── introspect
│ │ ├── Annotated.java
│ │ ├── AnnotatedClass.java
│ │ ├── AnnotatedConstructor.java
│ │ ├── AnnotatedField.java
│ │ ├── AnnotatedMember.java
│ │ ├── AnnotatedMethod.java
│ │ ├── AnnotatedMethodMap.java
│ │ ├── AnnotatedParameter.java
│ │ ├── AnnotatedWithParams.java
│ │ ├── AnnotationMap.java
│ │ ├── BasicBeanDescription.java
│ │ ├── BasicClassIntrospector.java
│ │ ├── JacksonAnnotationIntrospector.java
│ │ ├── MemberKey.java
│ │ ├── MethodFilter.java
│ │ ├── NopAnnotationIntrospector.java
│ │ ├── POJOPropertiesCollector.java
│ │ ├── POJOPropertyBuilder.java
│ │ ├── VisibilityChecker.java
│ │ └── package-info.java
│ ├── jsontype
│ │ ├── NamedType.java
│ │ ├── SubtypeResolver.java
│ │ ├── TypeIdResolver.java
│ │ ├── TypeResolverBuilder.java
│ │ ├── impl
│ │ │ ├── AsArrayTypeDeserializer.java
│ │ │ ├── AsArrayTypeSerializer.java
│ │ │ ├── AsExternalTypeDeserializer.java
│ │ │ ├── AsExternalTypeSerializer.java
│ │ │ ├── AsPropertyTypeDeserializer.java
│ │ │ ├── AsPropertyTypeSerializer.java
│ │ │ ├── AsWrapperTypeDeserializer.java
│ │ │ ├── AsWrapperTypeSerializer.java
│ │ │ ├── ClassNameIdResolver.java
│ │ │ ├── MinimalClassNameIdResolver.java
│ │ │ ├── StdSubtypeResolver.java
│ │ │ ├── StdTypeResolverBuilder.java
│ │ │ ├── TypeDeserializerBase.java
│ │ │ ├── TypeIdResolverBase.java
│ │ │ ├── TypeNameIdResolver.java
│ │ │ ├── TypeSerializerBase.java
│ │ │ └── package-info.java
│ │ └── package-info.java
│ ├── module
│ │ ├── SimpleAbstractTypeResolver.java
│ │ ├── SimpleDeserializers.java
│ │ ├── SimpleKeyDeserializers.java
│ │ ├── SimpleModule.java
│ │ ├── SimpleSerializers.java
│ │ ├── SimpleValueInstantiators.java
│ │ └── package-info.java
│ ├── package-info.java
│ ├── ser
│ │ ├── AnyGetterWriter.java
│ │ ├── ArraySerializers.java
│ │ ├── BasicSerializerFactory.java
│ │ ├── BeanPropertyFilter.java
│ │ ├── BeanPropertyWriter.java
│ │ ├── BeanSerializer.java
│ │ ├── BeanSerializerBuilder.java
│ │ ├── BeanSerializerFactory.java
│ │ ├── BeanSerializerModifier.java
│ │ ├── ContainerSerializers.java
│ │ ├── CustomSerializerFactory.java
│ │ ├── EnumSerializer.java
│ │ ├── FilterProvider.java
│ │ ├── FilteredBeanPropertyWriter.java
│ │ ├── JdkSerializers.java
│ │ ├── MapSerializer.java
│ │ ├── PropertyBuilder.java
│ │ ├── ScalarSerializerBase.java
│ │ ├── SerializerBase.java
│ │ ├── StdKeySerializer.java
│ │ ├── StdSerializerProvider.java
│ │ ├── StdSerializers.java
│ │ ├── ToStringSerializer.java
│ │ ├── impl
│ │ │ ├── FailingSerializer.java
│ │ │ ├── JsonSerializerMap.java
│ │ │ ├── PropertySerializerMap.java
│ │ │ ├── ReadOnlyClassToSerializerMap.java
│ │ │ ├── SerializerCache.java
│ │ │ ├── SimpleBeanPropertyFilter.java
│ │ │ ├── SimpleFilterProvider.java
│ │ │ ├── UnknownSerializer.java
│ │ │ ├── UnwrappingBeanPropertyWriter.java
│ │ │ ├── UnwrappingBeanSerializer.java
│ │ │ └── package-info.java
│ │ ├── package-info.java
│ │ └── std
│ │ │ ├── AsArraySerializerBase.java
│ │ │ ├── BeanSerializerBase.java
│ │ │ ├── CalendarSerializer.java
│ │ │ ├── CollectionSerializer.java
│ │ │ ├── ContainerSerializerBase.java
│ │ │ ├── DateSerializer.java
│ │ │ ├── EnumMapSerializer.java
│ │ │ ├── EnumSerializer.java
│ │ │ ├── EnumSetSerializer.java
│ │ │ ├── IndexedStringListSerializer.java
│ │ │ ├── InetAddressSerializer.java
│ │ │ ├── IterableSerializer.java
│ │ │ ├── JsonValueSerializer.java
│ │ │ ├── MapSerializer.java
│ │ │ ├── NonTypedScalarSerializerBase.java
│ │ │ ├── NullSerializer.java
│ │ │ ├── ObjectArraySerializer.java
│ │ │ ├── RawSerializer.java
│ │ │ ├── ScalarSerializerBase.java
│ │ │ ├── SerializableSerializer.java
│ │ │ ├── SerializableWithTypeSerializer.java
│ │ │ ├── SerializerBase.java
│ │ │ ├── StaticListSerializerBase.java
│ │ │ ├── StdArraySerializers.java
│ │ │ ├── StdContainerSerializers.java
│ │ │ ├── StdJdkSerializers.java
│ │ │ ├── StdKeySerializer.java
│ │ │ ├── StdKeySerializers.java
│ │ │ ├── StringCollectionSerializer.java
│ │ │ ├── StringSerializer.java
│ │ │ ├── TimeZoneSerializer.java
│ │ │ ├── ToStringSerializer.java
│ │ │ └── TokenBufferSerializer.java
│ ├── type
│ │ ├── ArrayType.java
│ │ ├── ClassKey.java
│ │ ├── CollectionLikeType.java
│ │ ├── CollectionType.java
│ │ ├── HierarchicType.java
│ │ ├── MapLikeType.java
│ │ ├── MapType.java
│ │ ├── SimpleType.java
│ │ ├── TypeBase.java
│ │ ├── TypeBindings.java
│ │ ├── TypeFactory.java
│ │ ├── TypeModifier.java
│ │ ├── TypeParser.java
│ │ └── package-info.java
│ └── util
│ │ ├── Annotations.java
│ │ ├── ArrayBuilders.java
│ │ ├── BeanUtil.java
│ │ ├── ClassUtil.java
│ │ ├── Comparators.java
│ │ ├── EnumResolver.java
│ │ ├── EnumValues.java
│ │ ├── ISO8601DateFormat.java
│ │ ├── ISO8601Utils.java
│ │ ├── JSONPObject.java
│ │ ├── JSONWrappedObject.java
│ │ ├── LRUMap.java
│ │ ├── LinkedNode.java
│ │ ├── Named.java
│ │ ├── ObjectBuffer.java
│ │ ├── PrimitiveArrayBuilder.java
│ │ ├── Provider.java
│ │ ├── RootNameLookup.java
│ │ ├── StdDateFormat.java
│ │ └── package-info.java
│ ├── node
│ ├── ArrayNode.java
│ ├── BaseJsonNode.java
│ ├── BigIntegerNode.java
│ ├── BinaryNode.java
│ ├── BooleanNode.java
│ ├── ContainerNode.java
│ ├── DecimalNode.java
│ ├── DoubleNode.java
│ ├── IntNode.java
│ ├── JsonNodeFactory.java
│ ├── LongNode.java
│ ├── MissingNode.java
│ ├── NodeCursor.java
│ ├── NullNode.java
│ ├── NumericNode.java
│ ├── ObjectNode.java
│ ├── POJONode.java
│ ├── TextNode.java
│ ├── TreeTraversingParser.java
│ ├── ValueNode.java
│ └── package-info.java
│ └── schema
│ ├── JsonSchema.java
│ ├── JsonSerializableSchema.java
│ ├── SchemaAware.java
│ └── package-info.java
├── maven
├── jackson-core-asl.pom
├── jackson-core-lgpl.pom
├── jackson-jaxrs.pom
├── jackson-mapper-asl.pom
├── jackson-mapper-lgpl.pom
├── jackson-mrbean.pom
├── jackson-smile.pom
└── jackson-xc.pom
├── mrbean
└── java
│ └── org
│ └── codehaus
│ └── jackson
│ └── mrbean
│ ├── AbstractTypeMaterializer.java
│ ├── BeanBuilder.java
│ ├── BeanUtil.java
│ ├── MrBeanModule.java
│ └── package-info.java
├── perf
└── perf
│ ├── BaseReader.java
│ ├── MediaItem.java
│ ├── TestCopyPerf.java
│ ├── TestCreatorPerf.java
│ ├── TestDeserPerf.java
│ ├── TestIteratorPerf.java
│ ├── TestJsonPerf.java
│ ├── TestMapMessageDeserPerf.java
│ ├── TestMapSpeed.java
│ ├── TestMethodDispatchSpeed.java
│ ├── TestNumberPerf.java
│ ├── TestReadPerf.java
│ ├── TestSerPerf.java
│ ├── TestStringDeserPerf.java
│ ├── TestStringSerPerf.java
│ ├── TestViewPerf.java
│ ├── TestWritePerf.java
│ └── UTF8Reader.java
├── sample
└── sample
│ ├── BeanWithCursor.java
│ ├── CustomSerializationView.java
│ ├── DynaBean.java
│ ├── ParserContextSample.java
│ └── UserSerializationExample.java
├── smile
└── java
│ └── org
│ └── codehaus
│ └── jackson
│ └── smile
│ ├── SmileBufferRecycler.java
│ ├── SmileConstants.java
│ ├── SmileFactory.java
│ ├── SmileGenerator.java
│ ├── SmileParser.java
│ ├── SmileParserBootstrapper.java
│ ├── SmileUtil.java
│ ├── Tool.java
│ └── package-info.java
├── test
├── main
│ └── BaseTest.java
└── org
│ └── codehaus
│ └── jackson
│ ├── failing
│ ├── TestAbstractParentChild.java
│ ├── TestCustomMapKeySerializer.java
│ ├── TestDelegatingCreators.java
│ ├── TestGenericsBounded.java
│ ├── TestMrbeanNestedGeneric.java
│ └── TestSerializationFiltering.java
│ ├── format
│ └── TestJsonFormatDetection.java
│ ├── impl
│ ├── TestBase64Codec.java
│ ├── TestBase64Parsing.java
│ ├── TestByteBasedSymbols.java
│ ├── TestCustomEscaping.java
│ ├── TestDecorators.java
│ ├── TestJsonParser.java
│ ├── TestJsonParserBinary.java
│ ├── TestNextXxx.java
│ ├── TestParserNonStandard.java
│ ├── TestUtf8Generator.java
│ └── TestUtf8Parser.java
│ ├── io
│ ├── TestIOContext.java
│ ├── TestJsonStringEncoder.java
│ ├── TestMergedStream.java
│ └── TestUTF8Writer.java
│ ├── jaxb
│ ├── BaseJaxbTest.java
│ ├── CommonAttributes.java
│ ├── Content.java
│ ├── EntryType.java
│ ├── MapAdapter.java
│ ├── MapType.java
│ ├── ObjectContainingAMap.java
│ ├── TestAccessType.java
│ ├── TestAdaptedMapType.java
│ ├── TestAdapters.java
│ ├── TestAnnotationPriority.java
│ ├── TestCyclicTypes.java
│ ├── TestDeserializerCaching.java
│ ├── TestDomElementSerialization.java
│ ├── TestElementWrapper.java
│ ├── TestIntrospectorPair.java
│ ├── TestJaxbAnnotationIntrospector.java
│ ├── TestJaxbAutoDetect.java
│ ├── TestJaxbFieldAccess.java
│ ├── TestJaxbNullProperties.java
│ ├── TestJaxbPolymorphic.java
│ ├── TestJaxbPolymorphicLists.java
│ ├── TestJaxbPolymorphicMaps.java
│ ├── TestJaxbTypeCoercion.java
│ ├── TestJaxbTypes.java
│ ├── TestPropertyOrdering.java
│ ├── TestPropertyVisibility.java
│ ├── TestRootName.java
│ ├── TestSchemaGeneration.java
│ ├── TestXmlAnyElementWithElementRef.java
│ └── package-info.java
│ ├── jaxrs
│ ├── TestCanSerialize.java
│ ├── TestJsonView.java
│ ├── TestJsonpWrapping.java
│ ├── TestLoading.java
│ ├── TestRootType.java
│ └── TestUntouchables.java
│ ├── main
│ ├── TestArrayParsing.java
│ ├── TestCharEscaping.java
│ ├── TestComments.java
│ ├── TestGeneratorArray.java
│ ├── TestGeneratorClosing.java
│ ├── TestGeneratorCopy.java
│ ├── TestGeneratorMisc.java
│ ├── TestGeneratorObject.java
│ ├── TestGeneratorWithSerializedString.java
│ ├── TestJsonFactory.java
│ ├── TestJsonGenerator.java
│ ├── TestJsonGeneratorFeatures.java
│ ├── TestJsonParserSymbols.java
│ ├── TestNumberParsing.java
│ ├── TestNumericValues.java
│ ├── TestParserClosing.java
│ ├── TestParserFeatures.java
│ ├── TestParserLinefeeds.java
│ ├── TestParserWithObjects.java
│ ├── TestPrettyPrinter.java
│ ├── TestRawStringWriting.java
│ ├── TestScopeMatching.java
│ ├── TestStringGeneration.java
│ ├── TestUnicode.java
│ ├── TestValueConversions.java
│ └── TestWithTonsaSymbols.java
│ ├── map
│ ├── BaseMapTest.java
│ ├── BrokenStringReader.java
│ ├── BrokenStringWriter.java
│ ├── TestFormatSchema.java
│ ├── TestFromJavaType.java
│ ├── TestHandlerInstantiation.java
│ ├── TestNamingStrategy.java
│ ├── TestObjectMapper.java
│ ├── TestObjectMapperBeanDeserializer.java
│ ├── TestObjectMapperBeanSerializer.java
│ ├── TestReadValues.java
│ ├── TestRootName.java
│ ├── TestStdDateFormat.java
│ ├── TestStdNamingStrategies.java
│ ├── TestToJavaType.java
│ ├── TestUpdateValue.java
│ ├── access
│ │ └── TestSerAnyGetter.java
│ ├── contextual
│ │ ├── TestContextualDeserialization.java
│ │ ├── TestContextualKeyTypes.java
│ │ └── TestContextualSerialization.java
│ ├── convert
│ │ ├── TestArrayConversions.java
│ │ ├── TestBeanConversions.java
│ │ ├── TestMapConversions.java
│ │ ├── TestPolymorphicUpdateValue.java
│ │ └── TestStringConversions.java
│ ├── deser
│ │ ├── TestAbstract.java
│ │ ├── TestAnnotationIgnore.java
│ │ ├── TestAnnotationUsing.java
│ │ ├── TestAnyProperties.java
│ │ ├── TestArrayDeserialization.java
│ │ ├── TestAutoDetect.java
│ │ ├── TestBasicAnnotations.java
│ │ ├── TestBeanDeserializer.java
│ │ ├── TestBlocking.java
│ │ ├── TestCollectionDeserialization.java
│ │ ├── TestConcurrency.java
│ │ ├── TestConfig.java
│ │ ├── TestConstructFromMap.java
│ │ ├── TestCreatorNullValue.java
│ │ ├── TestCreators.java
│ │ ├── TestCreators2.java
│ │ ├── TestCustomFactory.java
│ │ ├── TestCyclicTypes.java
│ │ ├── TestDateDeserialization.java
│ │ ├── TestEnumDeserialization.java
│ │ ├── TestExceptionDeserialization.java
│ │ ├── TestExceptionHandling.java
│ │ ├── TestFieldDeserialization.java
│ │ ├── TestGenericCollectionDeser.java
│ │ ├── TestGenericMapDeser.java
│ │ ├── TestGenericNumber.java
│ │ ├── TestGenericSubTyping.java
│ │ ├── TestGenerics.java
│ │ ├── TestGenericsBounded.java
│ │ ├── TestIgnoredTypes.java
│ │ ├── TestInjectables.java
│ │ ├── TestInnerClass.java
│ │ ├── TestJacksonTypes.java
│ │ ├── TestJdkTypes.java
│ │ ├── TestMapDeserialization.java
│ │ ├── TestNullHandling.java
│ │ ├── TestNumbers.java
│ │ ├── TestOverloaded.java
│ │ ├── TestParentChildReferences.java
│ │ ├── TestPolymorphicCreators.java
│ │ ├── TestSetterlessProperties.java
│ │ ├── TestSimpleAtomicTypes.java
│ │ ├── TestSimpleTypes.java
│ │ ├── TestStatics.java
│ │ ├── TestTimestampDeserialization.java
│ │ ├── TestUnknownProperties.java
│ │ └── TestValueAnnotations.java
│ ├── ext
│ │ ├── TestCoreXMLTypes.java
│ │ ├── TestDOM.java
│ │ └── TestJodaTime.java
│ ├── interop
│ │ ├── TestCglibUsage.java
│ │ ├── TestGoogleCollections.java
│ │ ├── TestGroovyBeans.java
│ │ ├── TestHibernate.java
│ │ └── TestJDKProxy.java
│ ├── introspect
│ │ ├── TestAnnotationMerging.java
│ │ ├── TestJacksonAnnotationIntrospector.java
│ │ └── TestPOJOPropertiesCollector.java
│ ├── jsontype
│ │ ├── TestAbstractTypeNames.java
│ │ ├── TestBackRefsWithPolymorphic.java
│ │ ├── TestCustomTypeIdResolver.java
│ │ ├── TestDefaultForArrays.java
│ │ ├── TestDefaultForEnums.java
│ │ ├── TestDefaultForLists.java
│ │ ├── TestDefaultForMaps.java
│ │ ├── TestDefaultForObject.java
│ │ ├── TestDefaultForScalars.java
│ │ ├── TestDefaultWithCreators.java
│ │ ├── TestEnumTyping.java
│ │ ├── TestExternalId.java
│ │ ├── TestGenericListSerialization.java
│ │ ├── TestNoTypeInfo.java
│ │ ├── TestPropertyTypeInfo.java
│ │ ├── TestScalars.java
│ │ ├── TestSubtypes.java
│ │ ├── TestTypeNames.java
│ │ ├── TestTypedArrayDeserialization.java
│ │ ├── TestTypedArraySerialization.java
│ │ ├── TestTypedContainerSerialization.java
│ │ ├── TestTypedDeserialization.java
│ │ ├── TestTypedDeserializationWithDefault.java
│ │ ├── TestTypedSerialization.java
│ │ └── TestWithGenerics.java
│ ├── mixins
│ │ ├── TestMixinDeserForClass.java
│ │ ├── TestMixinDeserForCreators.java
│ │ ├── TestMixinDeserForMethods.java
│ │ ├── TestMixinInheritance.java
│ │ ├── TestMixinSerForClass.java
│ │ ├── TestMixinSerForFields.java
│ │ ├── TestMixinSerForMethods.java
│ │ └── TestMixinSerWithViews.java
│ ├── module
│ │ ├── TestAbstractTypes.java
│ │ ├── TestSimpleModule.java
│ │ ├── TestTypeModifiers.java
│ │ └── TestValueInstantiator.java
│ ├── ser
│ │ ├── TestAnnotationAnyGetter.java
│ │ ├── TestAnnotationIgnore.java
│ │ ├── TestAnnotationInheritance.java
│ │ ├── TestAnnotationJsonRawValue.java
│ │ ├── TestAnnotationJsonSerialize.java
│ │ ├── TestAnnotationJsonSerialize2.java
│ │ ├── TestAnnotationJsonValue.java
│ │ ├── TestAnnotations.java
│ │ ├── TestArraySerialization.java
│ │ ├── TestAutoDetect.java
│ │ ├── TestBeanSerializer.java
│ │ ├── TestCollectionSerialization.java
│ │ ├── TestConfig.java
│ │ ├── TestCustomFactory.java
│ │ ├── TestCustomSerializers.java
│ │ ├── TestCyclicTypes.java
│ │ ├── TestDateSerialization.java
│ │ ├── TestEmptyClass.java
│ │ ├── TestEnumSerialization.java
│ │ ├── TestExceptionHandling.java
│ │ ├── TestExceptionSerialization.java
│ │ ├── TestFeatures.java
│ │ ├── TestFieldSerialization.java
│ │ ├── TestFiltering.java
│ │ ├── TestGenericTypes.java
│ │ ├── TestIgnoreProperties.java
│ │ ├── TestJSONP.java
│ │ ├── TestJacksonTypes.java
│ │ ├── TestJdkTypes.java
│ │ ├── TestJsonSerialize3.java
│ │ ├── TestMapSerialization.java
│ │ ├── TestNullProperties.java
│ │ ├── TestNullSerialization.java
│ │ ├── TestObjectWriter.java
│ │ ├── TestRootType.java
│ │ ├── TestSerializationOrder.java
│ │ ├── TestSerializerProvider.java
│ │ ├── TestSimpleAtomicTypes.java
│ │ ├── TestSimpleTypes.java
│ │ ├── TestStatics.java
│ │ ├── TestTreeSerialization.java
│ │ ├── TestViews.java
│ │ └── TestViews2.java
│ ├── struct
│ │ └── TestUnwrapping.java
│ ├── tree
│ │ ├── TestTreeDeserialization.java
│ │ ├── TestTreeMapperDeserializer.java
│ │ ├── TestTreeMapperMaps.java
│ │ └── TestTreeMapperSerializer.java
│ ├── type
│ │ ├── TestAnnotatedClass.java
│ │ ├── TestTypeFactory.java
│ │ └── TestTypeResolution.java
│ └── util
│ │ ├── ISO8601DateFormatTest.java
│ │ ├── ISO8601UtilsTest.java
│ │ └── TestClassUtil.java
│ ├── mrbean
│ ├── TestAbstractClasses.java
│ ├── TestGenericTypes.java
│ └── TestSimpleMaterializedInterfaces.java
│ ├── node
│ ├── TestArrayNode.java
│ ├── TestConversions.java
│ ├── TestFindMethods.java
│ ├── TestJsonNode.java
│ ├── TestNodeFactoryConfig.java
│ ├── TestObjectNode.java
│ └── TestTreeTraversingParser.java
│ ├── schema
│ ├── TestGenerateJsonSchema.java
│ └── TestReadJsonSchema.java
│ ├── smile
│ ├── SmileTestBase.java
│ ├── TestGeneratorWithRawUtf8.java
│ ├── TestGeneratorWithSerializedString.java
│ ├── TestMapper.java
│ ├── TestSmileAsTree.java
│ ├── TestSmileDetection.java
│ ├── TestSmileDocBoundary.java
│ ├── TestSmileFeatures.java
│ ├── TestSmileGenerator.java
│ ├── TestSmileGeneratorBufferRecycle.java
│ ├── TestSmileGeneratorLongStrings.java
│ ├── TestSmileGeneratorNumbers.java
│ ├── TestSmileGeneratorSymbols.java
│ ├── TestSmileParser.java
│ ├── TestSmileParserBinary.java
│ ├── TestSmileParserLocation.java
│ ├── TestSmileParserNames.java
│ ├── TestSmileParserNumbers.java
│ ├── TestSmileParserSymbolHandling.java
│ ├── TestSmileParserUnicode.java
│ └── TestSmileUtil.java
│ ├── sym
│ └── TestSymbolTables.java
│ ├── type
│ ├── TestJavaType.java
│ └── TestTypeBindings.java
│ ├── util
│ ├── TestCharTypes.java
│ ├── TestDelegates.java
│ ├── TestJsonParserSequence.java
│ ├── TestNumberPrinting.java
│ ├── TestObjectBuffer.java
│ ├── TestTextBuffer.java
│ ├── TestTokenBuffer.java
│ └── TestVersionUtil.java
│ └── version
│ └── TestVersions.java
├── tools
├── CheckNumberSpeed.java
├── GenerateDoubleDoc.java
├── GenerateIntDoc.java
├── TestBeanMapper.java
├── TestGenerator.java
├── TestMapSpeed.java
├── TestObjectMapper.java
├── TestParser.java
├── TestReflection.java
├── TestSerializationError.java
└── VerifySmileDocs.java
└── xc
└── java
└── org
└── codehaus
└── jackson
└── xc
├── DataHandlerJsonDeserializer.java
├── DataHandlerJsonSerializer.java
├── DomElementJsonDeserializer.java
├── DomElementJsonSerializer.java
├── JaxbAnnotationIntrospector.java
├── XmlAdapterJsonDeserializer.java
├── XmlAdapterJsonSerializer.java
└── package-info.java
/ant/build-clirr.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ant/build-jarjar-asm.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/bin/profile-json-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx48m -server -cp build/classes/perf:build/classes/core\
4 | :build/classes/mapper:lib/perf/\* \
5 | -XX:CompileThreshold=2000 \
6 | -Xrunhprof:cpu=samples,depth=10,verbose=n,interval=2 \
7 | TestJsonPerf \
8 | $*
9 |
--------------------------------------------------------------------------------
/bin/profile-read-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx16m -server \
4 | -cp build/classes/perf:perflib/\* \
5 | -XX:CompileThreshold=2000 \
6 | -Xrunhprof:cpu=samples,depth=10,verbose=n,interval=2 \
7 | TestReadPerf $*
8 |
--------------------------------------------------------------------------------
/bin/run-copy-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx48m -server -cp build/classes \
4 | TestCopyPerf $*
5 |
--------------------------------------------------------------------------------
/bin/run-json-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx48m -server -cp build/classes/perf:build/classes/core\
4 | :build/classes/mapper:lib/perf/\* \
5 | TestJsonPerf \
6 | $*
7 |
--------------------------------------------------------------------------------
/bin/run-read-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx16m -server \
4 | -cp build/classes/perf:perflib/\* \
5 | TestReadPerf $*
6 |
--------------------------------------------------------------------------------
/bin/run-ser-perf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx48m -server -cp build/classes/perf:build/classes/core\
4 | :build/classes/mapper:lib/perf/\* \
5 | TestSerPerf \
6 | $*
7 |
--------------------------------------------------------------------------------
/contrib/materialized-interface/README:
--------------------------------------------------------------------------------
1 | Work in progress for "materialized interface" extension, contributed by Sunny Gleason.
2 |
3 | Exciting stuff, real source at GitHub (see [http://github.com/sunnygleason/g414-jackson]), but temporarily also cached here for convenience.
4 |
--------------------------------------------------------------------------------
/lib/ant/bndtask-0.2.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ant/bndtask-0.2.0.jar
--------------------------------------------------------------------------------
/lib/ant/maven-ant-tasks-2.0.10.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ant/maven-ant-tasks-2.0.10.jar
--------------------------------------------------------------------------------
/lib/cobertura/asm-tree-3.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/cobertura/asm-tree-3.0.jar
--------------------------------------------------------------------------------
/lib/cobertura/cobertura-1.9.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/cobertura/cobertura-1.9.4.1.jar
--------------------------------------------------------------------------------
/lib/cobertura/jakarta-oro-2.0.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/cobertura/jakarta-oro-2.0.8.jar
--------------------------------------------------------------------------------
/lib/cobertura/log4j-1.2.13.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/cobertura/log4j-1.2.13.jar
--------------------------------------------------------------------------------
/lib/ext/asm/asm-3.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/asm/asm-3.3.jar
--------------------------------------------------------------------------------
/lib/ext/cglib/cglib-nodep-2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/cglib/cglib-nodep-2.2.jar
--------------------------------------------------------------------------------
/lib/ext/google/google-collections-1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/google/google-collections-1.0.jar
--------------------------------------------------------------------------------
/lib/ext/groovy/antlr-2.7.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/groovy/antlr-2.7.7.jar
--------------------------------------------------------------------------------
/lib/ext/groovy/groovy-1.7.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/groovy/groovy-1.7.4.jar
--------------------------------------------------------------------------------
/lib/ext/hibernate/hibernate-cglib-repack-nodep-2.1_3-SNAPSHOT.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/hibernate/hibernate-cglib-repack-nodep-2.1_3-SNAPSHOT.jar
--------------------------------------------------------------------------------
/lib/ext/jarjar/jarjar-1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/jarjar/jarjar-1.0.jar
--------------------------------------------------------------------------------
/lib/ext/joda-time-1.5.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/ext/joda-time-1.5.2.jar
--------------------------------------------------------------------------------
/lib/jaxb/activation.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/jaxb/activation.jar
--------------------------------------------------------------------------------
/lib/jaxb/jaxb-api-2.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/jaxb/jaxb-api-2.0.jar
--------------------------------------------------------------------------------
/lib/jaxrs/jersey-core-1.1.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/jaxrs/jersey-core-1.1.5.jar
--------------------------------------------------------------------------------
/lib/jaxrs/jersey-server-1.1.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/jaxrs/jersey-server-1.1.5.jar
--------------------------------------------------------------------------------
/lib/jaxrs/jsr311-api-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/jaxrs/jsr311-api-1.1.jar
--------------------------------------------------------------------------------
/lib/junit/junit-4.8.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/junit/junit-4.8.2.jar
--------------------------------------------------------------------------------
/lib/perf/antlr-2.7.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/perf/antlr-2.7.6.jar
--------------------------------------------------------------------------------
/lib/perf/jackson-module-json-org-0.9.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/perf/jackson-module-json-org-0.9.1.jar
--------------------------------------------------------------------------------
/lib/perf/json-org.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/perf/json-org.jar
--------------------------------------------------------------------------------
/lib/perf/json-smart-1.0.6.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/perf/json-smart-1.0.6.1.jar
--------------------------------------------------------------------------------
/lib/repackaged/jackson-asm-3.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/lib/repackaged/jackson-asm-3.3.jar
--------------------------------------------------------------------------------
/obsolete-src/README:
--------------------------------------------------------------------------------
1 | This directory contains source code that has been in use at some point,
2 | but not used or needed any more. However, there is a chance that such code
3 | might be useful for some other use later on, and as such it is still retained
4 | in a somewhat visible place (not just SCM system version history).
5 |
--------------------------------------------------------------------------------
/profile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx64m -server \
4 | -cp build/classes/core:build/classes/mapper:build/classes/extra\
5 | :build/classes/smile:build/classes/xc:build/classes/perf\
6 | :lib/xml/\*\
7 | -Xrunhprof:cpu=samples,depth=10,verbose=n,interval=2 \
8 | $*
9 |
--------------------------------------------------------------------------------
/regression/clirr-core-0.6-uber.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/regression/clirr-core-0.6-uber.jar
--------------------------------------------------------------------------------
/regression/jackson-core-asl-1.7.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/regression/jackson-core-asl-1.7.3.jar
--------------------------------------------------------------------------------
/regression/jackson-mapper-asl-1.7.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/regression/jackson-mapper-asl-1.7.3.jar
--------------------------------------------------------------------------------
/release-notes/asl/LICENSE:
--------------------------------------------------------------------------------
1 | This copy of Jackson JSON processor is licensed under the
2 | Apache (Software) License, version 2.0 ("the License").
3 | See the License for details about distribution rights, and the
4 | specific rights regarding derivate works.
5 |
6 | You may obtain a copy of the License at:
7 |
8 | http://www.apache.org/licenses/
9 |
10 | A copy is also included with both the the downloadable source code package
11 | and jar that contains class bytecodes, as file "ASL 2.0". In both cases,
12 | that file should be located next to this file: in source distribution
13 | the location should be "release-notes/asl"; and in jar "META-INF/"
14 |
--------------------------------------------------------------------------------
/release-notes/asl/NOTICE:
--------------------------------------------------------------------------------
1 | This product currently only contains code developed by authors
2 | of specific components, as identified by the source code files;
3 | if such notes are missing files have been created by
4 | Tatu Saloranta.
5 |
6 | For additional credits (generally to people who reported problems)
7 | see CREDITS file.
8 |
--------------------------------------------------------------------------------
/release-notes/lgpl/LICENSE:
--------------------------------------------------------------------------------
1 | This copy of Jackson JSON processor is licensed under the
2 | Lesser General Public License (LGPL), version 2.1 ("the License").
3 | See the License for details about distribution rights, and the
4 | specific rights regarding derivate works.
5 |
6 | You may obtain a copy of the License at:
7 |
8 | http://www.gnu.org/licenses/licenses.html
9 |
10 | A copy is also included with both the the downloadable source code package
11 | and jar that contains class bytecodes, as file "LGPL 2.1". In both cases,
12 | that file should be located next to this file: in source distribution
13 | the location should be "release-notes/lgpl"; and in jar "META-INF/"
14 |
--------------------------------------------------------------------------------
/release-notes/lgpl/NOTICE:
--------------------------------------------------------------------------------
1 | This product currently only contains code developed by authors
2 | of specific components, as identified by the source code files;
3 | if such notes are missing files have been created by
4 | Tatu Saloranta.
5 |
6 | For additional credits (generally to people who reported problems)
7 | see CREDITS file.
8 |
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | java -Xmx128m -server\
4 | -XX:-PrintGC -XX:-PrintGCDetails \
5 | -cp lib/junit/junit-3.8.1.jar\
6 | :lib/repackaged/\*:lib/xml/\*\
7 | :build/classes/core:build/classes/mapper:build/classes/xc:build/classes/extra\
8 | :build/classes/perf:build/classes/smile \
9 | $*
10 |
--------------------------------------------------------------------------------
/samples-nondist/twitter-search-mod-entry.json:
--------------------------------------------------------------------------------
1 | {
2 | "id":1125687077,
3 | "text":"@stroughtonsmith You need to add a \"Favourites\" tab to TC/iPhone. Like what TwitterFon did. I can't WAIT for your Twitter App!! :) Any ETA?",
4 | "fromUserId":855523,
5 | "toUserId":815309,
6 | "languageCode":"en"
7 | }
8 |
--------------------------------------------------------------------------------
/samples-smile/db100.xml.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/db100.xml.smile
--------------------------------------------------------------------------------
/samples-smile/json-org-sample1.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/json-org-sample1.smile
--------------------------------------------------------------------------------
/samples-smile/json-org-sample2.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/json-org-sample2.smile
--------------------------------------------------------------------------------
/samples-smile/json-org-sample3.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/json-org-sample3.smile
--------------------------------------------------------------------------------
/samples-smile/json-org-sample4.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/json-org-sample4.smile
--------------------------------------------------------------------------------
/samples-smile/json-org-sample5.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/json-org-sample5.smile
--------------------------------------------------------------------------------
/samples-smile/map-spam.xml.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/map-spam.xml.smile
--------------------------------------------------------------------------------
/samples-smile/ns-invoice100.xml.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/ns-invoice100.xml.smile
--------------------------------------------------------------------------------
/samples-smile/ns-soap.xml.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/ns-soap.xml.smile
--------------------------------------------------------------------------------
/samples-smile/numbers-fp-4k.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/numbers-fp-4k.smile
--------------------------------------------------------------------------------
/samples-smile/numbers-fp-64k.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/numbers-fp-64k.smile
--------------------------------------------------------------------------------
/samples-smile/numbers-int-4k.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/numbers-int-4k.smile
--------------------------------------------------------------------------------
/samples-smile/numbers-int-64k.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/numbers-int-64k.smile
--------------------------------------------------------------------------------
/samples-smile/test1.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/test1.smile
--------------------------------------------------------------------------------
/samples-smile/test2.smile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codehaus/jackson/b7c2fcb9f659200033c7569bc514bf3589727efb/samples-smile/test2.smile
--------------------------------------------------------------------------------
/samples/json-org-sample1-nows.jsn:
--------------------------------------------------------------------------------
1 | {"glossary": {"title": "example glossary",
2 | "GlossDiv": {"title": "S",
3 | "GlossList": {"GlossEntry": {"ID": "SGML","SortAs": "SGML",
4 | "GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986",
5 | "GlossDef":{"para": "A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso": ["GML", "XML"]},"GlossSee": "markup"
6 | }}}}}
7 |
8 |
--------------------------------------------------------------------------------
/samples/json-org-sample1.jsn:
--------------------------------------------------------------------------------
1 | {
2 | "glossary": {
3 | "title": "example glossary",
4 | "GlossDiv": {
5 | "title": "S",
6 | "GlossList": {
7 | "GlossEntry": {
8 | "ID": "SGML",
9 | "SortAs": "SGML",
10 | "GlossTerm": "Standard Generalized Markup Language",
11 | "Acronym": "SGML",
12 | "Abbrev": "ISO 8879:1986",
13 | "GlossDef": {
14 | "para": "A meta-markup language, used to create markup languages such as DocBook.",
15 | "GlossSeeAlso": ["GML", "XML"]
16 | },
17 | "GlossSee": "markup"
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/samples/json-org-sample2.jsn:
--------------------------------------------------------------------------------
1 | {"menu": {
2 | "id": "file",
3 | "value": "File",
4 | "popup": {
5 | "menuitem": [
6 | {"value": "New", "onclick": "CreateNewDoc()"},
7 | {"value": "Open", "onclick": "OpenDoc()"},
8 | {"value": "Close", "onclick": "CloseDoc()"}
9 | ]
10 | }
11 | }}
12 |
--------------------------------------------------------------------------------
/samples/json-org-sample3.jsn:
--------------------------------------------------------------------------------
1 | {"widget": {
2 | "debug": "on",
3 | "window": {
4 | "title": "Sample Konfabulator Widget",
5 | "name": "main_window",
6 | "width": 500,
7 | "height": 500
8 | },
9 | "image": {
10 | "src": "Images/Sun.png",
11 | "name": "sun1",
12 | "hOffset": 250,
13 | "vOffset": 250,
14 | "alignment": "center"
15 | },
16 | "text": {
17 | "data": "Click Here",
18 | "size": 36,
19 | "style": "bold",
20 | "name": "text1",
21 | "hOffset": 250,
22 | "vOffset": 100,
23 | "alignment": "center",
24 | "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
25 | }
26 | }}
27 |
--------------------------------------------------------------------------------
/samples/json-org-sample5-nows.jsn:
--------------------------------------------------------------------------------
1 | {"menu": {
2 | "header": "SVG Viewer",
3 | "items": [
4 | {"id": "Open"},
5 | {"id": "OpenNew", "label": "Open New"},
6 | null,
7 | {"id": "ZoomIn", "label": "Zoom In"},
8 | {"id": "ZoomOut", "label": "Zoom Out"},
9 | {"id": "OriginalView", "label": "Original View"},
10 | null,
11 | {"id": "Quality"},
12 | {"id": "Pause"},
13 | {"id": "Mute"},
14 | null,
15 | {"id": "Find", "label": "Find..."},
16 | {"id": "FindAgain", "label": "Find Again"},
17 | {"id": "Copy"},
18 | {"id": "CopyAgain", "label": "Copy Again"},
19 | {"id": "CopySVG", "label": "Copy SVG"},
20 | {"id": "ViewSVG", "label": "View SVG"},
21 | {"id": "ViewSource", "label": "View Source"},
22 | {"id": "SaveAs", "label": "Save As"},
23 | null,
24 | {"id": "Help"},
25 | {"id": "About", "label": "About Adobe CVG Viewer..."}
26 | ]
27 | }}
28 |
--------------------------------------------------------------------------------
/samples/json-org-sample5.jsn:
--------------------------------------------------------------------------------
1 | {"menu": {
2 | "header": "SVG Viewer",
3 | "items": [
4 | {"id": "Open"},
5 | {"id": "OpenNew", "label": "Open New"},
6 | null,
7 | {"id": "ZoomIn", "label": "Zoom In"},
8 | {"id": "ZoomOut", "label": "Zoom Out"},
9 | {"id": "OriginalView", "label": "Original View"},
10 | null,
11 | {"id": "Quality"},
12 | {"id": "Pause"},
13 | {"id": "Mute"},
14 | null,
15 | {"id": "Find", "label": "Find..."},
16 | {"id": "FindAgain", "label": "Find Again"},
17 | {"id": "Copy"},
18 | {"id": "CopyAgain", "label": "Copy Again"},
19 | {"id": "CopySVG", "label": "Copy SVG"},
20 | {"id": "ViewSVG", "label": "View SVG"},
21 | {"id": "ViewSource", "label": "View Source"},
22 | {"id": "SaveAs", "label": "Save As"},
23 | null,
24 | {"id": "Help"},
25 | {"id": "About", "label": "About Adobe CVG Viewer..."}
26 | ]
27 | }}
28 |
--------------------------------------------------------------------------------
/samples/jvm-ser1.json:
--------------------------------------------------------------------------------
1 | {"content":{"size":256000000,"format":"mpeg","player":"FLASH","uri":"http://www.cowtowncoder.com","title":"CowTown Blog Rulez Ok","width":640,"height":480,"duration":360000,"bitrate":320,"persons":["Cowtowncoder","Billy-bob"],"copyright":"GPL"},"images":[{"size":"SMALL","uri":"http://images.r.us/foobar.jpeg","title":"Fabulous FUBAR incident","width":320,"height":256},{"size":"LARGE","uri":"http://images.r.us/total-cluster.jpeg","title":"More of the same -- add keywords for SEO","width":640,"height":480},{"size":"SMALL","uri":"http://images.r.us/barf.png","title":"One more angle, gotta see this","width":320,"height":256}]}
--------------------------------------------------------------------------------
/samples/test1.jsn:
--------------------------------------------------------------------------------
1 | { "test key" : true,
2 | "nullField":null,
3 | "foo":1,
4 | "foo2": { "a" : 3 },
5 | "a\u00E3b" : -323,
6 | "2" : [ 1, 2, 3],
7 | "\"foo\"" : "foo\nbar"
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/samples/test2.jsn:
--------------------------------------------------------------------------------
1 | {"\"abKey\"":3, "foo":false}
2 |
--------------------------------------------------------------------------------
/sandbox/tests/TestOverloaded.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.map.*;
4 |
5 | /**
6 | * Unit tests related to handling of overloaded methods;
7 | * and specifically addressing problem [JACKSON-189].
8 | *
9 | * @since 1.5
10 | */
11 | public class TestOverloaded
12 | extends BaseMapTest
13 | {
14 | static class OverloadBean
15 | {
16 | String a;
17 |
18 | public OverloadBean() { }
19 |
20 | public void setA(int value) { a = String.valueOf(value); }
21 | public void setA(String value) { a = value; }
22 | }
23 |
24 | /**
25 | * Unit test related to [JACKSON-189]
26 | */
27 | public void testSimpleOverload() throws Exception
28 | {
29 | OverloadBean bean;
30 | try {
31 | bean = new ObjectMapper().readValue("{ \"a\" : 13 }", OverloadBean.class);
32 | } catch (JsonMappingException e) {
33 | fail("Did not expect an exception, got: "+e.getMessage());
34 | return;
35 | }
36 | assertEquals("13", bean.a);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/VERSION.txt:
--------------------------------------------------------------------------------
1 | @VERSION@
2 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/FormatSchema.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson;
2 |
3 | /**
4 | * Simple tag interface used to mark schema objects that are used by some
5 | * {@link JsonParser} and {@link JsonGenerator} implementations to further
6 | * specify structure of expected format.
7 | * Basic JSON-based parsers and generators do not use schemas, but some data
8 | * formats (like many binary data formats like Thrift, protobuf) mandate
9 | * use of schemas.
10 | *
11 | * Since there is little commonality between schemas for different data formats,
12 | * this interface does not define much meaningful functionality for accessing
13 | * schema details; rather, specific parser and generator implementations need
14 | * to cast to schema implementations they use. This marker interface is mostly
15 | * used for tagging "some kind of schema" -- instead of passing opaque
16 | * {@link java.lang.Object} -- for documentation purposes.
17 | *
18 | * @since 1.8
19 | */
20 | public interface FormatSchema
21 | {
22 | /**
23 | * Method that can be used to get an identifier that can be used for diagnostics
24 | * purposes, to indicate what kind of data format this schema is used for: typically
25 | * it is a short name of format itself, but it can also contain additional information
26 | * in cases where data format supports multiple types of schemas.
27 | */
28 | public String getSchemaType();
29 | }
30 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/JsonGenerationException.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson;
2 |
3 | /**
4 | * Exception type for exceptions during JSON writing, such as trying
5 | * to output content in wrong context (non-matching end-array or end-object,
6 | * for example).
7 | */
8 | public class JsonGenerationException
9 | extends JsonProcessingException
10 | {
11 | @SuppressWarnings("hiding")
12 | final static long serialVersionUID = 123; // Stupid eclipse...
13 |
14 | public JsonGenerationException(Throwable rootCause)
15 | {
16 | super(rootCause);
17 | }
18 |
19 | public JsonGenerationException(String msg)
20 | {
21 | super(msg, (JsonLocation)null);
22 | }
23 |
24 | public JsonGenerationException(String msg, Throwable rootCause)
25 | {
26 | super(msg, (JsonLocation)null, rootCause);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/JsonParseException.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson;
2 |
3 | /**
4 | * Exception type for parsing problems, used when non-well-formed content
5 | * (content that does not conform to JSON syntax as per specification)
6 | * is encountered.
7 | */
8 | public class JsonParseException
9 | extends JsonProcessingException
10 | {
11 | @SuppressWarnings("hiding")
12 | final static long serialVersionUID = 123; // Stupid eclipse...
13 |
14 | public JsonParseException(String msg, JsonLocation loc)
15 | {
16 | super(msg, loc);
17 | }
18 |
19 | public JsonParseException(String msg, JsonLocation loc, Throwable root)
20 | {
21 | super(msg, loc, root);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/Versioned.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson;
2 |
3 | /**
4 | * Interface that those Jackson components that are explicitly versioned will implement.
5 | * Intention is to allow both plug-in components (custom extensions) and applications and
6 | * frameworks that use Jackson to detect exact version of Jackson in use.
7 | * This may be useful for example for ensuring that proper Jackson version is deployed
8 | * (beyond mechanisms that deployment system may have), as well as for possible
9 | * workarounds.
10 | *
11 | * @since 1.6
12 | */
13 | public interface Versioned {
14 | /**
15 | * Method called to detect version of the component that implements this interface;
16 | * returned version should never be null, but may return specific "not available"
17 | * instance (see {@link Version} for details).
18 | */
19 | public Version version();
20 | }
21 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JacksonAnnotation.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Meta-annotation (annotations used on other annotations)
10 | * used for marking all annotations that are
11 | * part of Jackson package. Can be used for recognizing all
12 | * Jackson annotations generically, and in future also for
13 | * passing other generic annotation configuration.
14 | */
15 | @Target({ElementType.ANNOTATION_TYPE})
16 | @Retention(RetentionPolicy.RUNTIME)
17 | public @interface JacksonAnnotation
18 | {
19 | // for now, a pure tag annotation, no parameters
20 | }
21 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonAnyGetter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define a non-static,
10 | * no-argument method or member field as something of a reverse of
11 | * {@link JsonAnySetter} method; basically being used like a
12 | * getter but such that contents of the returned Map (type must be
13 | * {@link java.util.Map}) are serialized as if they were actual properties
14 | * of the bean that contains method/field with this annotations.
15 | * As with {@link JsonAnySetter}, only one property should be annotated
16 | * with this annotation.
17 | *
18 | * @since 1.6
19 | */
20 | @Target(ElementType.METHOD)
21 | @Retention(RetentionPolicy.RUNTIME)
22 | @JacksonAnnotation
23 | public @interface JsonAnyGetter
24 | {
25 | }
26 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonAnySetter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define a non-static,
10 | * single-argument method, to be used as a "fallback" handler
11 | * for all otherwise unrecognized properties found from Json content.
12 | * It is similar to {@link javax.xml.bind.annotation.XmlAnyElement}
13 | * in behavior; and can only be used to denote a single property
14 | * per type.
15 | *
16 | * If used, all otherwise unmapped key-value pairs from Json Object
17 | * structs are added to the property (of type Map or bean).
18 | */
19 | @Target(ElementType.METHOD)
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @JacksonAnnotation
22 | public @interface JsonAnySetter
23 | {
24 | }
25 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonCreator.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define constructors and factory
10 | * methods as one to use for instantiating new instances of the associated
11 | * class.
12 | */
13 | @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @JacksonAnnotation
16 | public @interface JsonCreator
17 | {
18 | // no values, since there's no property
19 | }
20 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonGetter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define a non-static,
10 | * no-argument value-returning (non-void) method to be used as a "getter"
11 | * for a logical property,
12 | * as an alternative to recommended
13 | * {@link JsonProperty} annotation (which was introduced in version 1.1).
14 | *
15 | * Getter means that when serializing Object instance of class that has
16 | * this method (possibly inherited from a super class), a call is made
17 | * through the method, and return value will be serialized as value of
18 | * the property.
19 | *
20 | * @deprecated Use {@link JsonProperty} instead (deprecated since version 1.5)
21 | */
22 | @Target(ElementType.METHOD)
23 | @Retention(RetentionPolicy.RUNTIME)
24 | @JacksonAnnotation
25 | @Deprecated
26 | public @interface JsonGetter
27 | {
28 | /**
29 | * Defines name of the logical property this
30 | * method is used to access ("get"); empty String means that
31 | * name should be derived from the underlying method (using
32 | * standard Bean name detection rules)
33 | */
34 | String value() default "";
35 | }
36 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonIgnoreType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that indicates that all properties of annotated
10 | * type are to be ignored during serialization and deserialization.
11 | *
12 | * Note: annotation does have boolean 'value' property (which defaults
13 | * to 'true'), so that it is actually possible to override value
14 | * using mix-in annotations.
15 | *
16 | * @since 1.7
17 | */
18 | @Target({ElementType.TYPE})
19 | @Retention(RetentionPolicy.RUNTIME)
20 | @JacksonAnnotation
21 | public @interface JsonIgnoreType
22 | {
23 | /**
24 | * Optional argument that defines whether this annotation is active
25 | * or not. The only use for value 'false' if for overriding purposes
26 | * (which is not needed often); most likely it is needed for use
27 | * with "mix-in annotations" ("annotation overrides").
28 | * For most cases, however, default value of "true" is just fine
29 | * and should be omitted.
30 | */
31 | boolean value() default true;
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonProperty.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define a non-static
10 | * method as a "setter" or "getter" for a logical property
11 | * (depending on its signature),
12 | * or non-static object field to be used (serialized, deserialized) as
13 | * a logical property.
14 | *
15 | * Default value ("") indicates that the field name is used
16 | * as the property name without any modifications, but it
17 | * can be specified to non-empty value to specify different
18 | * name. Property name refers to name used externally, as
19 | * the field name in Json objects.
20 | *
21 | * NOTE: since version 1.1, annotation has also been applicable
22 | * to fields (not with 1.0).
23 | *
24 | * NOTE: since version 1.2, annotation has also been applicable
25 | * to (constructor) parameters
26 | */
27 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @JacksonAnnotation
30 | public @interface JsonProperty
31 | {
32 | /**
33 | * Defines name of the logical property, i.e. Json object field
34 | * name to use for the property: if empty String (which is the
35 | * default), will use name of the field that is annotated.
36 | */
37 | String value() default "";
38 | }
39 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonRawValue.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that indicates that the annotated method
10 | * or field should be serialized by including literal String value
11 | * of the property as is, without quoting of characters.
12 | * This can be useful for injecting values already serialized in JSON or
13 | * passing javascript function definitions from server to a javascript client.
14 | *
15 | * Warning: the resulting JSON stream may be invalid depending on your input value.
16 | *
17 | * @since 1.7.0
18 | */
19 | @Target( { ElementType.METHOD, ElementType.FIELD })
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @JacksonAnnotation
22 | public @interface JsonRawValue
23 | {
24 | /**
25 | * Optional argument that defines whether this annotation is active
26 | * or not. The only use for value 'false' if for overriding purposes
27 | * (which is not needed often); most likely it is needed for use
28 | * with "mix-in annotations" (aka "annotation overrides").
29 | * For most cases, however, default value of "true" is just fine
30 | * and should be omitted.
31 | */
32 | boolean value() default true;
33 | }
34 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonSetter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Marker annotation that can be used to define a non-static,
10 | * single-argument method to be used as a "setter" for a logical property
11 | * as an alternative to recommended
12 | * {@link JsonProperty} annotation (which was introduced in version 1.1).
13 | *
14 | * Setter means that when a property with matching name is encountered in
15 | * JSON content, this method will be used to set value of the property.
16 | *
17 | * NOTE: this annotation was briefly deprecated for version 1.5; but has
18 | * since been un-deprecated to both allow for asymmetric naming (possibly
19 | * different name when reading and writing JSON), and more importantly to
20 | * allow multi-argument setter method in future.
21 | */
22 | @Target(ElementType.METHOD)
23 | @Retention(RetentionPolicy.RUNTIME)
24 | @JacksonAnnotation
25 | public @interface JsonSetter
26 | {
27 | /**
28 | * Optional default argument that defines logical property this
29 | * method is used to modify ("set"); this is the property
30 | * name used in JSON content.
31 | */
32 | String value() default "";
33 | }
34 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonTypeName.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 |
9 | /**
10 | * Annotation used for binding logical name that the annotated class
11 | * has. Used with {@link JsonTypeInfo} (and specifically its
12 | * {@link JsonTypeInfo#use} property) to establish relationship
13 | * between type names and types.
14 | *
15 | * @since 1.5
16 | *
17 | * @author tatu
18 | */
19 | @Target({ElementType.TYPE})
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @JacksonAnnotation
22 | public @interface JsonTypeName {
23 | /**
24 | * Logical type name for annotated type. If missing (or defined as Empty String),
25 | * defaults to using non-qualified class name as the type.
26 | */
27 | public String value() default "";
28 | }
29 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/JsonWriteNullProperties.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Annotation that can be used to define whether object properties
10 | * that have null values are to be written out when serializing
11 | * content as JSON. This affects Bean and Map serialization.
12 | *
13 | * Annotation can be used with Classes (all instances of
14 | * given class) and Methods.
15 | *
16 | * Default value for this property is 'true', meaning that null
17 | * properties are written.
18 | *
19 | * @deprecated (since 1.6) Currently recommended annotation to use is
20 | * {@link org.codehaus.jackson.map.annotate.JsonSerialize#include()}
21 | * (with values ALWAYS
or NON_NULL
)
22 | */
23 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
24 | @Retention(RetentionPolicy.RUNTIME)
25 | @JacksonAnnotation
26 | @Deprecated
27 | public @interface JsonWriteNullProperties
28 | {
29 | /**
30 | * Whether properties for beans of annotated type will always be
31 | * written (true), or only if not null (false).
32 | */
33 | boolean value() default true;
34 | }
35 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/annotate/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Public core annotations, most of which are used to configure how
3 | * Data Mapping/Binding works. Annotations in this package can only
4 | * have dependencies to non-annotation classes in Core package;
5 | * annotations that have dependencies to Mapper classes are included
6 | * in Mapper module (under org.codehaus.jackson.map.annotate
).
7 | * Also contains parameter types (mostly enums) needed by annotations.
8 | *
9 | * In future (version 2.0?), this package will probably be split off
10 | * as a separate jar/module, to allow use of annotations without
11 | * including core module. This would be useful for third party value
12 | * classes that themselves do not depend on Jackson, but may want to
13 | * be annotated to be automatically and conveniently serializable by
14 | * Jackson.
15 | */
16 | package org.codehaus.jackson.annotate;
17 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/format/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains interfaces needed for dynamic, pluggable
3 | * format (auto)detection; as well as basic utility classes for
4 | * simple format detection functionality.
5 | *
6 | * @since 1.8
7 | */
8 | package org.codehaus.jackson.format;
9 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/impl/DefaultPrettyPrinter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.impl;
2 |
3 | /**
4 | * Deprecated version of the default pretty printer.
5 | *
6 | * @deprecated Moved to {@link org.codehaus.jackson.util.DefaultPrettyPrinter}; will be removed in Jackson 2.0
7 | */
8 | @Deprecated
9 | public class DefaultPrettyPrinter
10 | extends org.codehaus.jackson.util.DefaultPrettyPrinter
11 | {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/impl/Indenter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.impl;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.*;
6 |
7 | /**
8 | * Interface that defines objects that can produce indentation used
9 | * to separate object entries and array values. Indentation in this
10 | * context just means insertion of white space, independent of whether
11 | * linefeeds are output.
12 | */
13 | public interface Indenter
14 | {
15 | public void writeIndentation(JsonGenerator jg, int level)
16 | throws IOException, JsonGenerationException;
17 |
18 | /**
19 | * @return True if indenter is considered inline (does not add linefeeds),
20 | * false otherwise
21 | */
22 | public boolean isInline();
23 | }
24 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/impl/JsonNumericParserBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.impl;
2 |
3 | import org.codehaus.jackson.*;
4 | import org.codehaus.jackson.io.IOContext;
5 |
6 | /**
7 | * Another intermediate base class used by all Jackson {@link JsonParser}
8 | * implementations. Contains shared functionality for dealing with
9 | * number parsing aspects, independent of input source decoding.
10 | *
11 | * @deprecated Since 1.9.0: functionality demoted down to JsonParserBase
12 | */
13 | @Deprecated
14 | public abstract class JsonNumericParserBase
15 | extends JsonParserBase
16 | {
17 | protected JsonNumericParserBase(IOContext ctxt, int features) {
18 | super(ctxt, features);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Parser and generator implementation classes that Jackson
3 | * defines and uses.
4 | * Application code should not (need to) use contents of this package.
5 | */
6 | package org.codehaus.jackson.impl;
7 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/io/OutputDecorator.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.io;
2 |
3 | import java.io.*;
4 |
5 | /**
6 | * Handler class that can be used to decorate output destinations.
7 | * Typical use is to use a filter abstraction (filtered output stream,
8 | * writer) around original output destination, and apply additional
9 | * processing during write operations.
10 | *
11 | * @since 1.8
12 | */
13 | public abstract class OutputDecorator
14 | {
15 | /**
16 | * Method called by {@link org.codehaus.jackson.JsonFactory} instance when
17 | * creating generator for given {@link OutputStream}, when this decorator
18 | * has been registered.
19 | *
20 | * @param ctxt IO context in use (provides access to declared encoding)
21 | * @param out Original output destination
22 | *
23 | * @return OutputStream to use; either passed in argument, or something that
24 | * calls it
25 | */
26 | public abstract OutputStream decorate(IOContext ctxt, OutputStream out)
27 | throws IOException;
28 |
29 | /**
30 | * Method called by {@link org.codehaus.jackson.JsonFactory} instance when
31 | * creating generator for given {@link Writer}, when this decorator
32 | * has been registered.
33 | *
34 | * @param ctxt IO context in use (provides access to declared encoding)
35 | * @param w Original output writer
36 | *
37 | * @return Writer to use; either passed in argument, or something that calls it
38 | */
39 | public abstract Writer decorate(IOContext ctxt, Writer w) throws IOException;
40 | }
41 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/io/package.html:
--------------------------------------------------------------------------------
1 |
2 | This package contains I/O helper classes Jackson itself uses, but that
3 | are not exposed for external reuse.
4 |
5 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Main public API classes of the core streaming JSON
3 | * processor: most importantly {@link org.codehaus.jackson.JsonFactory}
4 | * used for constructing
5 | * JSON parser ({@link org.codehaus.jackson.JsonParser})
6 | * and generator
7 | * ({@link org.codehaus.jackson.JsonParser})
8 | * instances.
9 | *
10 | * Public API of the higher-level mapping interfaces ("Mapping API")
11 | * is found from
12 | * under {@link org.codehaus.jackson.map} and not included here,
13 | * except for following base interfaces:
14 | *
15 | *{@link org.codehaus.jackson.JsonNode} is included
16 | *within Streaming API to support integration of the Tree Model
17 | *(which is based on JsonNode
) with the basic
18 | *parsers and generators (iff using mapping-supporting factory: which
19 | *is part of Mapping API, not core)
20 | *
21 | *{@link org.codehaus.jackson.ObjectCodec} is included so that
22 | * reference to the object capable of serializing/deserializing
23 | * Objects to/from JSON (usually, {@link org.codehaus.jackson.map.ObjectMapper})
24 | * can be exposed, without adding direct dependency to implementation.
25 | *
26 | *
27 | *
28 | */
29 |
30 | package org.codehaus.jackson;
31 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/sym/Name.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.sym;
2 |
3 | /**
4 | * Base class for tokenized names (key strings in objects) that have
5 | * been tokenized from byte-based input sources (like
6 | * {@link java.io.InputStream}.
7 | *
8 | * @author Tatu Saloranta
9 | */
10 | public abstract class Name
11 | {
12 | protected final String _name;
13 |
14 | protected final int _hashCode;
15 |
16 | protected Name(String name, int hashCode) {
17 | _name = name;
18 | _hashCode = hashCode;
19 | }
20 |
21 | public String getName() { return _name; }
22 |
23 | /*
24 | /**********************************************************
25 | /* Methods for package/core parser
26 | /**********************************************************
27 | */
28 |
29 | public abstract boolean equals(int quad1);
30 |
31 | public abstract boolean equals(int quad1, int quad2);
32 |
33 | public abstract boolean equals(int[] quads, int qlen);
34 |
35 | /*
36 | /**********************************************************
37 | /* Overridden standard methods
38 | /**********************************************************
39 | */
40 |
41 | @Override public String toString() { return _name; }
42 |
43 | @Override public final int hashCode() { return _hashCode; }
44 |
45 | @Override public boolean equals(Object o)
46 | {
47 | // Canonical instances, can usually just do identity comparison
48 | return (o == this);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/sym/Name1.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.sym;
2 |
3 | /**
4 | * Specialized implementation of PName: can be used for short Strings
5 | * that consists of at most 4 bytes. Usually this means short
6 | * ascii-only names.
7 | *
8 | * The reason for such specialized classes is mostly space efficiency;
9 | * and to a lesser degree performance. Both are achieved for short
10 | * Strings by avoiding another level of indirection (via quad arrays)
11 | */
12 | public final class Name1
13 | extends Name
14 | {
15 | final static Name1 sEmptyName = new Name1("", 0, 0);
16 |
17 | final int mQuad;
18 |
19 | Name1(String name, int hash, int quad)
20 | {
21 | super(name, hash);
22 | mQuad = quad;
23 | }
24 |
25 | final static Name1 getEmptyName() { return sEmptyName; }
26 |
27 | @Override
28 | public boolean equals(int quad)
29 | {
30 | return (quad == mQuad);
31 | }
32 |
33 | @Override
34 | public boolean equals(int quad1, int quad2)
35 | {
36 | return (quad1 == mQuad) && (quad2 == 0);
37 | }
38 |
39 | @Override
40 | public boolean equals(int[] quads, int qlen)
41 | {
42 | return (qlen == 1 && quads[0] == mQuad);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/sym/Name2.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.sym;
2 |
3 | /**
4 | * Specialized implementation of PName: can be used for short Strings
5 | * that consists of 5 to 8 bytes. Usually this means relatively short
6 | * ascii-only names.
7 | *
8 | * The reason for such specialized classes is mostly space efficiency;
9 | * and to a lesser degree performance. Both are achieved for short
10 | * Strings by avoiding another level of indirection (via quad arrays)
11 | */
12 | public final class Name2
13 | extends Name
14 | {
15 | final int mQuad1;
16 |
17 | final int mQuad2;
18 |
19 | Name2(String name, int hash, int quad1, int quad2)
20 | {
21 | super(name, hash);
22 | mQuad1 = quad1;
23 | mQuad2 = quad2;
24 | }
25 |
26 | @Override
27 | public boolean equals(int quad) { return false; }
28 |
29 | @Override
30 | public boolean equals(int quad1, int quad2)
31 | {
32 | return (quad1 == mQuad1) && (quad2 == mQuad2);
33 | }
34 |
35 | @Override
36 | public boolean equals(int[] quads, int qlen)
37 | {
38 | return (qlen == 2 && quads[0] == mQuad1 && quads[1] == mQuad2);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/sym/Name3.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.sym;
2 |
3 | /**
4 | * Specialized implementation of PName: can be used for short Strings
5 | * that consists of 9 to 12 bytes. It's the longest special purpose
6 | * implementaion; longer ones are expressed using {@link NameN}.
7 | */
8 | public final class Name3
9 | extends Name
10 | {
11 | final int mQuad1;
12 | final int mQuad2;
13 | final int mQuad3;
14 |
15 | Name3(String name, int hash, int q1, int q2, int q3)
16 | {
17 | super(name, hash);
18 | mQuad1 = q1;
19 | mQuad2 = q2;
20 | mQuad3 = q3;
21 | }
22 |
23 | // Implies quad length == 1, never matches
24 | @Override
25 | public boolean equals(int quad) { return false; }
26 |
27 | // Implies quad length == 2, never matches
28 | @Override
29 | public boolean equals(int quad1, int quad2) { return false; }
30 |
31 | @Override
32 | public boolean equals(int[] quads, int qlen)
33 | {
34 | return (qlen == 3)
35 | && (quads[0] == mQuad1)
36 | && (quads[1] == mQuad2)
37 | && (quads[2] == mQuad3);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/sym/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Internal implementation classes for efficient handling of
3 | * of symbols in JSON (field names in Objects)
4 | */
5 | package org.codehaus.jackson.sym;
6 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/type/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains classes needed for type introspection, mostly used by data binding
3 | * functionality. Most of this functionality is needed to properly handled
4 | * generic types, and to simplify and unify processing of things Jackson needs
5 | * to determine how contained types (of {@link java.util.Collection} and
6 | * {@link java.util.Map} classes) are to be handled.
7 | */
8 | package org.codehaus.jackson.type;
9 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/util/InternCache.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.util;
2 |
3 | import java.util.Map;
4 | import java.util.LinkedHashMap;
5 |
6 | /**
7 | * Singleton class that adds a simple first-level cache in front of
8 | * regular String.intern() functionality. This is done as a minor
9 | * performance optimization, to avoid calling native intern() method
10 | * in cases where same String is being interned multiple times.
11 | *
12 | * Note: that this class extends {@link LinkedHashMap} is an implementation
13 | * detail -- no code should ever directly call Map methods.
14 | */
15 | @SuppressWarnings("serial")
16 | public final class InternCache
17 | extends LinkedHashMap
18 | {
19 | /**
20 | * Size to use is somewhat arbitrary, so let's choose something that's
21 | * neither too small (low hit ratio) nor too large (waste of memory)
22 | */
23 | private final static int MAX_ENTRIES = 192;
24 |
25 | public final static InternCache instance = new InternCache();
26 |
27 | private InternCache() {
28 | super(MAX_ENTRIES, 0.8f, true);
29 | }
30 |
31 | @Override
32 | protected boolean removeEldestEntry(Map.Entry eldest)
33 | {
34 | return size() > MAX_ENTRIES;
35 | }
36 |
37 | public synchronized String intern(String input)
38 | {
39 | String result = get(input);
40 | if (result == null) {
41 | result = input.intern();
42 | put(result, result);
43 | }
44 | return result;
45 | }
46 |
47 |
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/src/java/org/codehaus/jackson/util/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Utility classes used by Jackson Core functionality.
3 | */
4 | package org.codehaus.jackson.util;
5 |
--------------------------------------------------------------------------------
/src/jaxrs/java/org/codehaus/jackson/jaxrs/Annotations.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | /**
4 | * Enumeration that defines standard annotation sets available for configuring
5 | * data binding aspects.
6 | */
7 | public enum Annotations {
8 | /**
9 | * Standard Jackson annotations, defined in Jackson core and mapper
10 | * packages
11 | */
12 | JACKSON,
13 |
14 | /**
15 | * Standard JAXB annotations, used in a way that approximates expected
16 | * definitions (since JAXB defines XML aspects, not all features map
17 | * well to JSON handling)
18 | */
19 | JAXB
20 | ;
21 | }
22 |
--------------------------------------------------------------------------------
/src/jaxrs/java/org/codehaus/jackson/jaxrs/JsonMappingExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import org.codehaus.jackson.map.JsonMappingException;
4 |
5 | import javax.ws.rs.core.Response;
6 | import javax.ws.rs.ext.ExceptionMapper;
7 | import javax.ws.rs.ext.Provider;
8 |
9 | /**
10 | * Implementation if {@link ExceptionMapper} to send down a "400 Bad Request"
11 | * response in the event that unmappable JSON is received.
12 | */
13 | @Provider
14 | public class JsonMappingExceptionMapper implements ExceptionMapper {
15 | @Override
16 | public Response toResponse(JsonMappingException exception) {
17 | return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).type("text/plain").build();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/jaxrs/java/org/codehaus/jackson/jaxrs/JsonParseExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import org.codehaus.jackson.JsonParseException;
4 |
5 | import javax.ws.rs.core.Response;
6 | import javax.ws.rs.ext.ExceptionMapper;
7 | import javax.ws.rs.ext.Provider;
8 |
9 | /**
10 | * Implementation of {@link ExceptionMapper} to send down a "400 Bad Request"
11 | * in the event unparsable JSON is received.
12 | */
13 | @Provider
14 | public class JsonParseExceptionMapper implements ExceptionMapper {
15 | @Override
16 | public Response toResponse(JsonParseException exception) {
17 | return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).type("text/plain").build();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/jaxrs/java/org/codehaus/jackson/jaxrs/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Jackson-based JAX-RS provider that can automatically
3 | * serialize and deserialize resources for
4 | * JSON content type (MediaType).
5 | *
6 | * Also continues supporting functionality, such as
7 | * exception mappers that can simplify handling of
8 | * error conditions.
9 | */
10 | package org.codehaus.jackson.jaxrs;
11 |
--------------------------------------------------------------------------------
/src/jaxrs/resources/javax.ws.rs.ext.MessageBodyReader:
--------------------------------------------------------------------------------
1 | org.codehaus.jackson.jaxrs.JacksonJsonProvider
2 |
--------------------------------------------------------------------------------
/src/jaxrs/resources/javax.ws.rs.ext.MessageBodyWriter:
--------------------------------------------------------------------------------
1 | org.codehaus.jackson.jaxrs.JacksonJsonProvider
2 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/JsonSerializable.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.*;
6 |
7 | /**
8 | * Interface that can be implemented by objects that know how to
9 | * serialize themselves to JSON, using {@link JsonGenerator}
10 | * (and {@link SerializerProvider} if necessary).
11 | *
12 | * Note that implementing this interface binds implementing object
13 | * closely to Jackson API, and that it is often not necessary to do
14 | * so -- if class is a bean, it can be serialized without
15 | * implementing this interface.
16 | *
17 | * NOTE: as of version 1.5, this interface is missing one crucial
18 | * aspect, that of dealing with type information embedding.
19 | * Because of this, this interface is deprecated, although will be
20 | * fully supported for all 1.x releases, and will work except for
21 | * cases where polymorphic type information handling is needed for
22 | * type (in which case implementing if {@link JsonSerializableWithType} is crucial).
23 | *
24 | * @see org.codehaus.jackson.map.JsonSerializableWithType
25 | *
26 | * @since 1.5
27 | */
28 | @Deprecated
29 | public interface JsonSerializable
30 | {
31 | public void serialize(JsonGenerator jgen, SerializerProvider provider)
32 | throws IOException, JsonProcessingException;
33 | }
34 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/JsonSerializableWithType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonGenerator;
6 | import org.codehaus.jackson.JsonProcessingException;
7 |
8 | /**
9 | * Interface that is to replace {@link JsonSerializable} to
10 | * allow for dynamic type information embedding.
11 | *
12 | * @since 1.5
13 | * @author tatu
14 | */
15 | @SuppressWarnings("deprecation")
16 | public interface JsonSerializableWithType
17 | extends JsonSerializable
18 | {
19 | public void serializeWithType(JsonGenerator jgen, SerializerProvider provider,
20 | TypeSerializer typeSer)
21 | throws IOException, JsonProcessingException;
22 | }
23 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/KeyDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.*;
6 |
7 | /**
8 | * Abstract class that defines API used for deserializing JSON content
9 | * field names into Java Map keys. These deserializers are only used
10 | * if the Map key class is not String
or Object
.
11 | */
12 | public abstract class KeyDeserializer
13 | {
14 | /**
15 | * Method called to deserialize a {@link java.util.Map} key from JSON property name.
16 | */
17 | public abstract Object deserializeKey(String key, DeserializationContext ctxt)
18 | throws IOException, JsonProcessingException;
19 |
20 | /**
21 | * This marker class is only to be used with annotations, to
22 | * indicate that no deserializer is configured .
23 | *
24 | * Specifically, this class is to be used as the marker for
25 | * annotation {@link org.codehaus.jackson.map.annotate.JsonDeserialize}.
26 | *
27 | * @since 1.3
28 | */
29 | public abstract static class None
30 | extends KeyDeserializer { }
31 | }
32 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/KeyDeserializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import org.codehaus.jackson.type.JavaType;
4 |
5 | /**
6 | * Interface that defines API for simple extensions that can provide additional deserializers
7 | * for deserializer Map keys of various types, from JSON property names.
8 | * Access is by a single callback method; instance is to either return
9 | * a configured {@link KeyDeserializer} for specified type, or null to indicate that it
10 | * does not support handling of the type. In latter case, further calls can be made
11 | * for other providers; in former case returned key deserializer is used for handling of
12 | * key instances of specified type.
13 | *
14 | * @since 1.8
15 | */
16 | public interface KeyDeserializers
17 | {
18 | public KeyDeserializer findKeyDeserializer(JavaType type, DeserializationConfig config,
19 | BeanDescription beanDesc, BeanProperty property)
20 | throws JsonMappingException;
21 | }
22 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ResolvableDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | /**
4 | * Interface used to indicate deserializers that want to do post-processing
5 | * after construction and being added to {@link DeserializerProvider},
6 | * but before being used. This is typically used to resolve references
7 | * to other contained types; for example, bean deserializers use this
8 | * to eagerly find deserializers for contained field types.
9 | */
10 | public interface ResolvableDeserializer
11 | {
12 | /**
13 | * Method called after {@link DeserializerProvider} has registered
14 | * the deserializer, but before it has returned it to the caller.
15 | * Called object can then resolve its dependencies to other types,
16 | * including self-references (direct or indirect).
17 | *
18 | * @param provider Provider that has constructed deserializer this method
19 | * is called on.
20 | */
21 | public abstract void resolve(DeserializationConfig config, DeserializerProvider provider)
22 | throws JsonMappingException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ResolvableSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | /**
4 | * Interface used to indicate serializers that want to do post-processing
5 | * after construction and being added to {@link SerializerProvider},
6 | * but before being used. This is typically used to resolve references
7 | * to other contained types; for example, bean serializers use this
8 | * to eagerly find serializers for contained field types.
9 | */
10 | public interface ResolvableSerializer
11 | {
12 | /**
13 | * Method called after {@link SerializerProvider} has registered
14 | * the serializer, but before it has returned it to the caller.
15 | * Called object can then resolve its dependencies to other types,
16 | * including self-references (direct or indirect).
17 | *
18 | * @param provider Provider that has constructed serializer this method
19 | * is called on.
20 | */
21 | public abstract void resolve(SerializerProvider provider)
22 | throws JsonMappingException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/RuntimeJsonMappingException.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | /**
4 | * Wrapper used when interface does not allow throwing a checked
5 | * {@link JsonMappingException}
6 | */
7 | @SuppressWarnings("serial")
8 | public class RuntimeJsonMappingException extends RuntimeException
9 | {
10 | public RuntimeJsonMappingException(JsonMappingException cause) {
11 | super(cause);
12 | }
13 |
14 | public RuntimeJsonMappingException(String message) {
15 | super(message);
16 | }
17 |
18 | public RuntimeJsonMappingException(String message, JsonMappingException cause) {
19 | super(message, cause);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JacksonInject.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Jackson-specific annotation used for indicating that value of
12 | * annotated property will be "injected", i.e. set based on value
13 | * configured by ObjectMapper
(usually on per-call basis).
14 | * Usually property is not deserialized from JSON, although it possible
15 | * to have injected value as default and still allow optional override
16 | * from JSON.
17 | *
18 | * @since 1.9
19 | */
20 | @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
21 | @Retention(RetentionPolicy.RUNTIME)
22 | @JacksonAnnotation
23 | public @interface JacksonInject
24 | {
25 | /**
26 | * Logical id of the value to inject; if not specified (or specified
27 | * as empty String), will use id based on declared type of property.
28 | */
29 | public String value() default "";
30 | }
31 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JacksonStdImpl.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Marker interface used to indicate implementation classes
12 | * (serializers, deserializers etc) that are standard ones Jackson
13 | * uses; not custom ones that application has added. It can be
14 | * added in cases where certain optimizations can be made if
15 | * default instances are uses; for example when handling conversions
16 | * of "natural" JSON types like Strings, booleans and numbers.
17 | *
18 | * @since 1.6
19 | */
20 | @Target({ElementType.TYPE})
21 | @Retention(RetentionPolicy.RUNTIME)
22 | @JacksonAnnotation
23 | public @interface JacksonStdImpl {
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonCachable.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Marker annotation used to denote whether given instance
12 | * (currently only used with {@link org.codehaus.jackson.map.JsonDeserializer})
13 | * can be cached.
14 | *
15 | * Default action to take in absence of annotation depends
16 | * on object using annotation; with deserializers default is
17 | * to assume instances are not cachable.
18 | *
19 | * @since 1.1
20 | */
21 | @Target({ElementType.TYPE})
22 | @Retention(RetentionPolicy.RUNTIME)
23 | @JacksonAnnotation
24 | public @interface JsonCachable
25 | {
26 | /**
27 | * Default value is true, giving semantics for parameterless tag instance
28 | * such that empty instance indicates that instances of annotated class
29 | * are indeed cachable.
30 | */
31 | boolean value() default true;
32 | }
33 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonFilter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Annotation used to indicate which logical filter is to be used
12 | * for filtering out properties of type (class) annotated;
13 | * association made by this annotation declaring ids of filters,
14 | * and {@link org.codehaus.jackson.map.ObjectMapper} (or objects
15 | * it delegates to) providing matching filters by id.
16 | * Filters to use are of type
17 | * {@link org.codehaus.jackson.map.ser.BeanPropertyFilter} and
18 | * are registered through {@link org.codehaus.jackson.map.ObjectMapper}
19 | *
20 | * @since 1.7
21 | */
22 | @Target(ElementType.TYPE)
23 | @Retention(RetentionPolicy.RUNTIME)
24 | @JacksonAnnotation
25 | public @interface JsonFilter
26 | {
27 | /**
28 | * Id of filter to use; if empty String (""), no filter is to be used.
29 | */
30 | public String value();
31 | }
32 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonRootName.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Annotation similar to {@link javax.xml.bind.annotation.XmlRootElement},
12 | * used to indicate name to use for root-level wrapping, if wrapping is
13 | * enabled. Annotation itself does not indicate that wrapping should
14 | * be used; but if it is, name used for serialization should be name
15 | * specified here, and deserializer will expect the name as well.
16 | *
17 | * @since 1.9.0
18 | */
19 | @Target(ElementType.TYPE)
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @JacksonAnnotation
22 | public @interface JsonRootName
23 | {
24 | /**
25 | * Root name to use if root-level wrapping is enabled.
26 | */
27 | public String value();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonTypeIdResolver.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 | import org.codehaus.jackson.map.jsontype.TypeIdResolver;
10 |
11 | /**
12 | * Annotation that can be used to plug a custom type identifier handler
13 | * ({@link TypeIdResolver})
14 | * to be used by
15 | * {@link org.codehaus.jackson.map.TypeSerializer}s
16 | * and {@link org.codehaus.jackson.map.TypeDeserializer}s
17 | * for converting between java types and type id included in JSON content.
18 | * In simplest cases this can be a simple class with static mapping between
19 | * type names and matching classes.
20 | *
21 | * @author tatu
22 | * @since 1.5
23 | */
24 | @Target({ElementType.TYPE})
25 | @Retention(RetentionPolicy.RUNTIME)
26 | @JacksonAnnotation
27 | public @interface JsonTypeIdResolver
28 | {
29 | /**
30 | * Defines implementation class of {@link TypeIdResolver} to use for
31 | * converting between external type id (type name) and actual
32 | * type of object.
33 | */
34 | public Class extends TypeIdResolver> value();
35 | }
36 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonTypeResolver.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.*;
4 |
5 | import org.codehaus.jackson.annotate.JacksonAnnotation;
6 | import org.codehaus.jackson.map.jsontype.TypeResolverBuilder;
7 |
8 | /**
9 | * Annotation that can be used to explicitly define custom resolver
10 | * used for handling serialization and deserialization of type information,
11 | * needed for handling of polymorphic types (or sometimes just for linking
12 | * abstract types to concrete types)
13 | *
14 | * @since 1.5
15 | */
16 | @Target({ElementType.TYPE})
17 | @Retention(RetentionPolicy.RUNTIME)
18 | @JacksonAnnotation
19 | public @interface JsonTypeResolver
20 | {
21 | /**
22 | * Defines implementation class of {@link TypeResolverBuilder} which is used to construct
23 | * actual {@link org.codehaus.jackson.map.TypeDeserializer} and {@link org.codehaus.jackson.map.TypeDeserializer}
24 | * instances that handle reading and writing addition type information needed to support polymorphic
25 | * deserialization.
26 | */
27 | public Class extends TypeResolverBuilder>> value();
28 | }
29 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonValueInstantiator.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 | import org.codehaus.jackson.map.deser.ValueInstantiator;
10 |
11 | /**
12 | * Annotation that can be used to indicate a {@link ValueInstantiator} to use
13 | * for creating instances of specified type.
14 | *
15 | * @since 1.9
16 | */
17 | @Target(ElementType.TYPE)
18 | @Retention(RetentionPolicy.RUNTIME)
19 | @JacksonAnnotation
20 | public @interface JsonValueInstantiator
21 | {
22 | /**
23 | * @return {@link ValueInstantiator} to use for annotated type
24 | */
25 | public Class extends ValueInstantiator> value();
26 | }
27 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/JsonView.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.codehaus.jackson.annotate.JacksonAnnotation;
9 |
10 | /**
11 | * Annotation used for indicating view(s) that the property
12 | * that is defined by method or field annotated is part of.
13 | *
14 | * An example annotation would be:
15 | *
16 | * \@JsonView(BasicView.class)
17 | *
18 | * which would specify that property annotated would be included
19 | * when processing (serializing, deserializing) View identified
20 | * by BasicView.class
(or its sub-class).
21 | * If multiple View class identifiers are included, property will
22 | * be part of all of them.
23 | *
24 | * @since 1.4
25 | */
26 |
27 | @Target({ElementType.METHOD, ElementType.FIELD})
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @JacksonAnnotation
30 | public @interface JsonView {
31 | /**
32 | * View or views that annotated element is part of. Views are identified
33 | * by classes, and use expected class inheritance relationship: child
34 | * views contain all elements parent views have, for example.
35 | */
36 | public Class>[] value() default { };
37 | }
38 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/NoClass.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.annotate;
2 |
3 | /**
4 | * Marker class used with annotations to indicate "no class". This is
5 | * a silly but necessary work-around -- annotations can not take nulls
6 | * as either default or explicit values. Hence for class values we must
7 | * explicitly use a bogus placeholder to denote equivalent of
8 | * "no class" (for which 'null' is usually the natural choice).
9 | *
10 | * Note before version 1.4, this marker class was under
11 | * "org.codehaus.jackson.annotate". However, since it is only used
12 | * by annotations in "org.codehaus.jackson.map.annotate" (and not externally
13 | * exposed), it was moved to that package as of version 1.5.
14 | */
15 | public final class NoClass
16 | {
17 | private NoClass() { }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/annotate/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Annotations that directly depend on Mapper classes (not just
3 | * Jackson core) and are used for configuring Data Mapping functionality.
4 | */
5 | package org.codehaus.jackson.map.annotate;
6 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/ArrayDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.map.*;
4 | import org.codehaus.jackson.map.type.ArrayType;
5 |
6 | /**
7 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer} instead.
8 | */
9 | @Deprecated
10 | public class ArrayDeserializer
11 | extends org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer
12 | {
13 | /**
14 | * @deprecated
15 | */
16 | @Deprecated
17 | public ArrayDeserializer(ArrayType arrayType, JsonDeserializer elemDeser)
18 | {
19 | this(arrayType, elemDeser, null);
20 | }
21 |
22 | public ArrayDeserializer(ArrayType arrayType, JsonDeserializer elemDeser,
23 | TypeDeserializer elemTypeDeser)
24 | {
25 | super(arrayType, elemDeser, elemTypeDeser);
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/ArrayDeserializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.PrimitiveArrayDeserializers} instead.
5 | */
6 | @Deprecated
7 | public class ArrayDeserializers
8 | extends org.codehaus.jackson.map.deser.std.PrimitiveArrayDeserializers
9 | {
10 | private ArrayDeserializers() { super(); }
11 | }
12 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/CollectionDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.lang.reflect.Constructor;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.map.*;
7 | import org.codehaus.jackson.type.JavaType;
8 |
9 | /**
10 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.ContainerDeserializerBase} instead.
11 | */
12 | @Deprecated
13 | public class CollectionDeserializer
14 | extends org.codehaus.jackson.map.deser.std.CollectionDeserializer
15 | {
16 | /**
17 | * @deprecated Since 1.9, use variant that takes ValueInstantiator
18 | */
19 | @SuppressWarnings("deprecation")
20 | @Deprecated
21 | public CollectionDeserializer(JavaType collectionType, JsonDeserializer valueDeser,
22 | TypeDeserializer valueTypeDeser,
23 | Constructor> defCtor)
24 | {
25 | super(collectionType, valueDeser, valueTypeDeser, defCtor);
26 | }
27 |
28 | /**
29 | * @since 1.9
30 | */
31 | public CollectionDeserializer(JavaType collectionType, JsonDeserializer valueDeser,
32 | TypeDeserializer valueTypeDeser, ValueInstantiator valueInstantiator)
33 | {
34 | super(collectionType, valueDeser, valueTypeDeser, valueInstantiator);
35 | }
36 |
37 | /**
38 | * Copy-constructor that can be used by sub-classes to allow
39 | * copy-on-write styling copying of settings of an existing instance.
40 | *
41 | * @since 1.9
42 | */
43 | protected CollectionDeserializer(CollectionDeserializer src)
44 | {
45 | super(src);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/ContainerDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.ContainerDeserializerBase} instead.
5 | */
6 | @Deprecated
7 | public abstract class ContainerDeserializer
8 | extends org.codehaus.jackson.map.deser.std.ContainerDeserializerBase
9 | {
10 | protected ContainerDeserializer(Class> selfType)
11 | {
12 | super(selfType);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/DateDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.JsonNodeDeserializer} instead.
5 | */
6 | @Deprecated
7 | public class DateDeserializer
8 | extends org.codehaus.jackson.map.deser.std.DateDeserializer
9 | { }
10 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/EnumDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.map.util.EnumResolver;
4 |
5 | /**
6 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.EnumDeserializer} instead.
7 | */
8 | @Deprecated
9 | public class EnumDeserializer
10 | extends org.codehaus.jackson.map.deser.std.EnumDeserializer
11 | {
12 | public EnumDeserializer(EnumResolver> res) {
13 | super(res);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/EnumResolver.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.util.HashMap;
4 |
5 | /**
6 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.util.EnumResolver} instead.
7 | */
8 | @Deprecated
9 | public final class EnumResolver>
10 | extends org.codehaus.jackson.map.util.EnumResolver
11 | {
12 | private EnumResolver(Class enumClass, T[] enums, HashMap map) {
13 | super(enumClass, enums, map);
14 | }
15 | }
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/FromStringDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.FromStringDeserializer} instead.
5 | */
6 | @Deprecated
7 | public abstract class FromStringDeserializer
8 | extends org.codehaus.jackson.map.deser.std.FromStringDeserializer
9 | {
10 | protected FromStringDeserializer(Class> vc) {
11 | super(vc);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/MapDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.lang.reflect.Constructor;
4 | import java.util.Map;
5 |
6 | import org.codehaus.jackson.map.*;
7 | import org.codehaus.jackson.type.JavaType;
8 |
9 | /**
10 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.MapDeserializer} instead.
11 | */
12 | @Deprecated
13 | public class MapDeserializer
14 | extends org.codehaus.jackson.map.deser.std.MapDeserializer
15 | {
16 | /**
17 | * @deprecated Since 1.9, use variant that takes ValueInstantiator
18 | */
19 | @SuppressWarnings("deprecation")
20 | @Deprecated
21 | public MapDeserializer(JavaType mapType, Constructor> defCtor,
22 | KeyDeserializer keyDeser, JsonDeserializer valueDeser,
23 | TypeDeserializer valueTypeDeser)
24 | {
25 | super(mapType, defCtor, keyDeser, valueDeser, valueTypeDeser);
26 | }
27 |
28 | public MapDeserializer(JavaType mapType, ValueInstantiator valueInstantiator,
29 | KeyDeserializer keyDeser, JsonDeserializer valueDeser,
30 | TypeDeserializer valueTypeDeser)
31 | {
32 | super(mapType, valueInstantiator, keyDeser, valueDeser, valueTypeDeser);
33 | }
34 |
35 | /**
36 | * Copy-constructor that can be used by sub-classes to allow
37 | * copy-on-write styling copying of settings of an existing instance.
38 | *
39 | * @since 1.9
40 | */
41 | protected MapDeserializer(MapDeserializer src) {
42 | super(src);
43 | }
44 | }
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/StdKeyDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.StdKeyDeserializer} instead.
5 | */
6 | @Deprecated
7 | public abstract class StdKeyDeserializer
8 | extends org.codehaus.jackson.map.deser.std.StdKeyDeserializer
9 | {
10 | protected StdKeyDeserializer(Class> cls) { super(cls); }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/StdKeyDeserializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.StdKeyDeserializers} instead.
5 | */
6 | @Deprecated
7 | class StdKeyDeserializers
8 | extends org.codehaus.jackson.map.deser.std.StdKeyDeserializers
9 | {
10 | protected StdKeyDeserializers() { super(); }
11 | }
12 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/StdScalarDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.StdScalarDeserializer} instead.
5 | */
6 | @Deprecated
7 | public abstract class StdScalarDeserializer
8 | extends org.codehaus.jackson.map.deser.std.StdDeserializer
9 | {
10 | protected StdScalarDeserializer(Class> vc) {
11 | super(vc);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/ThrowableDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.ThrowableDeserializer} instead.
5 | */
6 | @Deprecated
7 | public class ThrowableDeserializer
8 | extends org.codehaus.jackson.map.deser.std.ThrowableDeserializer
9 | {
10 | public ThrowableDeserializer(BeanDeserializer baseDeserializer) {
11 | super(baseDeserializer);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/UntypedObjectDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | /**
4 | * @deprecated Since 1.9, use {@link org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer} instead.
5 | */
6 | @Deprecated
7 | public class UntypedObjectDeserializer
8 | extends org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer
9 | { }
10 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/impl/UnwrappedPropertyHandler.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.impl;
2 |
3 | import java.io.IOException;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.JsonParser;
7 | import org.codehaus.jackson.JsonProcessingException;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 | import org.codehaus.jackson.map.deser.SettableBeanProperty;
10 | import org.codehaus.jackson.util.TokenBuffer;
11 |
12 | /**
13 | * Object that is responsible for handling acrobatics related to
14 | * deserializing "unwrapped" values; sets of properties that are
15 | * embedded (inlined) as properties of parent JSON object.
16 | *
17 | * @since 1.9
18 | */
19 | public class UnwrappedPropertyHandler
20 | {
21 | protected final ArrayList _properties = new ArrayList();
22 |
23 | public UnwrappedPropertyHandler() { }
24 |
25 | public void addProperty(SettableBeanProperty property) {
26 | _properties.add(property);
27 | }
28 |
29 | public Object processUnwrapped(JsonParser originalParser, DeserializationContext ctxt, Object bean,
30 | TokenBuffer buffered)
31 | throws IOException, JsonProcessingException
32 | {
33 | for (int i = 0, len = _properties.size(); i < len; ++i) {
34 | SettableBeanProperty prop = _properties.get(i);
35 | JsonParser jp = buffered.asParser();
36 | jp.nextToken();
37 | prop.deserializeAndSet(jp, ctxt, bean);
38 | }
39 | return bean;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/impl/ValueInjector.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.impl;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.map.BeanProperty;
6 | import org.codehaus.jackson.map.DeserializationContext;
7 | import org.codehaus.jackson.map.introspect.AnnotatedMember;
8 | import org.codehaus.jackson.map.util.Annotations;
9 | import org.codehaus.jackson.type.JavaType;
10 |
11 | /**
12 | * Class that encapsulates details of value injection that occurs before
13 | * deserialization of a POJO. Details include information needed to find
14 | * injectable value (logical id) as well as method used for assigning
15 | * value (setter or field)
16 | *
17 | * @since 1.9
18 | */
19 | public class ValueInjector
20 | extends BeanProperty.Std
21 | {
22 | /**
23 | * Identifier used for looking up value to inject
24 | */
25 | protected final Object _valueId;
26 |
27 | public ValueInjector(String propertyName, JavaType type,
28 | Annotations contextAnnotations, AnnotatedMember mutator,
29 | Object valueId)
30 | {
31 | super(propertyName, type, contextAnnotations, mutator);
32 | _valueId = valueId;
33 | }
34 |
35 | public Object findValue(DeserializationContext context, Object beanInstance)
36 | {
37 | return context.findInjectableValue(_valueId, this, beanInstance);
38 | }
39 |
40 | public void inject(DeserializationContext context, Object beanInstance)
41 | throws IOException
42 | {
43 | _member.setValue(beanInstance, findValue(context, beanInstance));
44 | }
45 | }
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains those implementation classes of deserialization part of
3 | * data binding that are not considered part of public or semi-public
4 | * interfaces. Use of these classes by non-core classes is discouraged,
5 | * although occasionally this may be necessary.
6 | * Note that backwards-compatibility of these classes is not guaranteed
7 | * between minor releases (but is between patch releases).
8 | */
9 | package org.codehaus.jackson.map.deser.impl;
10 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains implementation classes of deserialization part of
3 | * data binding.
4 | */
5 | package org.codehaus.jackson.map.deser;
6 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/AtomicBooleanDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 | import java.util.concurrent.atomic.AtomicBoolean;
5 |
6 | import org.codehaus.jackson.JsonParser;
7 | import org.codehaus.jackson.JsonProcessingException;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 |
10 | public class AtomicBooleanDeserializer
11 | extends StdScalarDeserializer
12 | {
13 | public AtomicBooleanDeserializer() { super(AtomicBoolean.class); }
14 |
15 | @Override
16 | public AtomicBoolean deserialize(JsonParser jp, DeserializationContext ctxt)
17 | throws IOException, JsonProcessingException
18 | {
19 | // 16-Dec-2010, tatu: Should we actually convert null to null AtomicBoolean?
20 | return new AtomicBoolean(_parseBooleanPrimitive(jp, ctxt));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/CalendarDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 | import java.util.Calendar;
5 | import java.util.Date;
6 |
7 | import org.codehaus.jackson.JsonParser;
8 | import org.codehaus.jackson.JsonProcessingException;
9 | import org.codehaus.jackson.map.DeserializationContext;
10 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
11 |
12 | @JacksonStdImpl
13 | public class CalendarDeserializer
14 | extends StdScalarDeserializer
15 | {
16 | /**
17 | * We may know actual expected type; if so, it will be
18 | * used for instantiation.
19 | */
20 | protected final Class extends Calendar> _calendarClass;
21 |
22 | public CalendarDeserializer() { this(null); }
23 | public CalendarDeserializer(Class extends Calendar> cc) {
24 | super(Calendar.class);
25 | _calendarClass = cc;
26 | }
27 |
28 | @Override
29 | public Calendar deserialize(JsonParser jp, DeserializationContext ctxt)
30 | throws IOException, JsonProcessingException
31 | {
32 | Date d = _parseDate(jp, ctxt);
33 | if (d == null) {
34 | return null;
35 | }
36 | if (_calendarClass == null) {
37 | return ctxt.constructCalendar(d);
38 | }
39 | try {
40 | Calendar c = _calendarClass.newInstance();
41 | c.setTimeInMillis(d.getTime());
42 | return c;
43 | } catch (Exception e) {
44 | throw ctxt.instantiationException(_calendarClass, e);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/ClassDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonParser;
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.JsonToken;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
10 | import org.codehaus.jackson.map.util.ClassUtil;
11 |
12 | /**
13 | *
14 | * @since 1.9 (renamed from 'org.codehaus.jackson.map.deser.StdDeserializer#ClassDeserializer')
15 | */
16 | @JacksonStdImpl
17 | public class ClassDeserializer
18 | extends StdScalarDeserializer>
19 | {
20 | public ClassDeserializer() { super(Class.class); }
21 |
22 | @Override
23 | public Class> deserialize(JsonParser jp, DeserializationContext ctxt)
24 | throws IOException, JsonProcessingException
25 | {
26 | JsonToken curr = jp.getCurrentToken();
27 | // Currently will only accept if given simple class name
28 | if (curr == JsonToken.VALUE_STRING) {
29 | String className = jp.getText();
30 | try {
31 | return ClassUtil.findClass(className);
32 | } catch (ClassNotFoundException e) {
33 | throw ctxt.instantiationException(_valueClass, e);
34 | }
35 | }
36 | throw ctxt.mappingException(_valueClass, curr);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/ContainerDeserializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import org.codehaus.jackson.map.JsonDeserializer;
4 | import org.codehaus.jackson.type.JavaType;
5 |
6 | /**
7 | * Intermediate base deserializer class that adds more shared accessor
8 | * so that other classes can access information about contained (value)
9 | * types
10 | *
11 | * @since 1.9 (renamed from 'org.codehaus.jackson.map.deser.ContainerDeserializer')
12 | */
13 | public abstract class ContainerDeserializerBase
14 | extends StdDeserializer
15 | {
16 | protected ContainerDeserializerBase(Class> selfType)
17 | {
18 | super(selfType);
19 | }
20 |
21 | /*
22 | /**********************************************************
23 | /* Extended API
24 | /**********************************************************
25 | */
26 |
27 | /**
28 | * Accessor for declared type of contained value elements; either exact
29 | * type, or one of its supertypes.
30 | */
31 | public abstract JavaType getContentType();
32 |
33 | /**
34 | * Accesor for deserializer use for deserializing content values.
35 | */
36 | public abstract JsonDeserializer getContentDeserializer();
37 | }
38 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/DateDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 | import java.util.Date;
5 |
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.JsonParser;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 |
10 | /**
11 | * Simple deserializer for handling {@link java.util.Date} values.
12 | *
13 | * One way to customize Date formats accepted is to override method
14 | * {@link DeserializationContext#parseDate} that this basic
15 | * deserializer calls.
16 | *
17 | * @since 1.9 (moved from higher-level package)
18 | */
19 | public class DateDeserializer
20 | extends StdScalarDeserializer
21 | {
22 | public DateDeserializer() { super(Date.class); }
23 |
24 | @Override
25 | public java.util.Date deserialize(JsonParser jp, DeserializationContext ctxt)
26 | throws IOException, JsonProcessingException
27 | {
28 | return _parseDate(jp, ctxt);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/JavaTypeDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonParser;
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.JsonToken;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 | import org.codehaus.jackson.type.JavaType;
10 |
11 | /**
12 | * @since 1.9
13 | */
14 | public class JavaTypeDeserializer
15 | extends StdScalarDeserializer
16 | {
17 | public JavaTypeDeserializer() { super(JavaType.class); }
18 |
19 | @Override
20 | public JavaType deserialize(JsonParser jp, DeserializationContext ctxt)
21 | throws IOException, JsonProcessingException
22 | {
23 | JsonToken curr = jp.getCurrentToken();
24 | // Usually should just get string value:
25 | if (curr == JsonToken.VALUE_STRING) {
26 | String str = jp.getText().trim();
27 | if (str.length() == 0) {
28 | return getEmptyValue();
29 | }
30 | return ctxt.getTypeFactory().constructFromCanonical(str);
31 | }
32 | // or occasionally just embedded object maybe
33 | if (curr == JsonToken.VALUE_EMBEDDED_OBJECT) {
34 | return (JavaType) jp.getEmbeddedObject();
35 | }
36 | throw ctxt.mappingException(_valueClass);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/StdScalarDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonParser;
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.map.DeserializationContext;
8 | import org.codehaus.jackson.map.TypeDeserializer;
9 | import org.codehaus.jackson.type.JavaType;
10 |
11 | /**
12 | * Base class for deserializers that handle types that are serialized
13 | * as JSON scalars (non-structured, i.e. non-Object, non-Array, values).
14 | *
15 | * @since 1.9 (moved from higher-level package)
16 | */
17 | public abstract class StdScalarDeserializer extends StdDeserializer
18 | {
19 | protected StdScalarDeserializer(Class> vc) {
20 | super(vc);
21 | }
22 |
23 | protected StdScalarDeserializer(JavaType valueType) {
24 | super(valueType);
25 | }
26 |
27 | @Override
28 | public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt,
29 | TypeDeserializer typeDeserializer)
30 | throws IOException, JsonProcessingException
31 | {
32 | return typeDeserializer.deserializeTypedFromScalar(jp, ctxt);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/TimestampDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 | import java.sql.Timestamp;
5 |
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.JsonParser;
8 | import org.codehaus.jackson.map.DeserializationContext;
9 |
10 | /**
11 | * Simple deserializer for handling {@link java.sql.Timestamp} values.
12 | *
13 | * One way to customize Timestamp formats accepted is to override method
14 | * {@link DeserializationContext#parseDate} that this basic
15 | * deserializer calls.
16 | *
17 | * @since 1.9 (moved from higher-level package)
18 | */
19 | public class TimestampDeserializer
20 | extends StdScalarDeserializer
21 | {
22 | public TimestampDeserializer() { super(Timestamp.class); }
23 |
24 | @Override
25 | public java.sql.Timestamp deserialize(JsonParser jp, DeserializationContext ctxt)
26 | throws IOException, JsonProcessingException
27 | {
28 | return new Timestamp(_parseDate(jp, ctxt).getTime());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/TokenBufferDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser.std;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonParser;
6 | import org.codehaus.jackson.JsonProcessingException;
7 | import org.codehaus.jackson.map.DeserializationContext;
8 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
9 | import org.codehaus.jackson.util.TokenBuffer;
10 |
11 | /**
12 | * We also want to directly support deserialization of
13 | * {@link TokenBuffer}.
14 | *
15 | * Note that we use scalar deserializer base just because we claim
16 | * to be of scalar for type information inclusion purposes; actual
17 | * underlying content can be of any (Object, Array, scalar) type.
18 | *
19 | * @since 1.9 (moved from higher-level package)
20 | */
21 | @JacksonStdImpl
22 | public class TokenBufferDeserializer
23 | extends StdScalarDeserializer
24 | {
25 | public TokenBufferDeserializer() { super(TokenBuffer.class); }
26 |
27 | @Override
28 | public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt)
29 | throws IOException, JsonProcessingException
30 | {
31 | TokenBuffer tb = new TokenBuffer(jp.getCodec());
32 | // quite simple, given that TokenBuffer is a JsonGenerator:
33 | tb.copyCurrentStructure(jp);
34 | return tb;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/deser/std/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains public standard implementations of abstraction that
3 | * Jackson uses. This means that they are not merely implementation
4 | * details, but part of semi-public interface where project
5 | * tries to maintain backwards compatibility at higher level
6 | * than for 'impl' types (although less so than with fully
7 | * public interfaces).
8 | *
9 | * Note that since this package was only added relatively late
10 | * in development cycle, not all classes that belong here are
11 | * included. Plan is to move more classes over time.
12 | *
13 | * @since 1.9
14 | */
15 | package org.codehaus.jackson.map.deser.std;
16 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ext/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | Contains extended support for "external" packages: things that
3 | may or may not be present in runtime environment, but that are
4 | commonly enough used so that explicit support can be added.
5 |
6 | Currently supported extensions include:
7 |
8 | Support for Java 1.5 core XML datatypes: the reason these are
9 | considered "external" is that some platforms that claim to be 1.5 conformant
10 | are only partially so (Google Android, GAE) and do not included these
11 | types.
12 |
13 | Joda time. This package has superior date/time handling functionality,
14 | and is thus supported. However, to minimize forced dependencies this
15 | support is added as extension so that Joda is not needed by Jackson
16 | itself: but if it is present, its core types are supported to some
17 | degree
18 |
19 |
20 |
21 | */
22 |
23 | package org.codehaus.jackson.map.ext;
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/introspect/MethodFilter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.introspect;
2 |
3 | import java.lang.reflect.Method;
4 |
5 | /**
6 | * Simple interface that defines API used to filter out irrelevant
7 | * methods
8 | */
9 | public interface MethodFilter
10 | {
11 | public boolean includeMethod(Method m);
12 | }
13 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/introspect/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Functionality needed for Bean introspection, required for detecting
3 | * accessors and mutators for Beans, as well as locating and handling
4 | * method annotations.
5 | *
6 | * Beyond collecting annotations, additional "method annotation inheritance"
7 | * is also supported: whereas regular JDK classes do not add annotations
8 | * from overridden methods in any situation. But code in this package does.
9 | * Similarly class-annotations are inherited properly from interfaces, in
10 | * addition to abstract and concrete classes.
11 | */
12 | package org.codehaus.jackson.map.introspect;
13 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/NamedType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype;
2 |
3 | /**
4 | * Simple container class for types with optional logical name, used
5 | * as external identifier
6 | *
7 | * @author tatu
8 | * @since 1.5
9 | */
10 | public final class NamedType
11 | {
12 | protected final Class> _class;
13 | protected final int _hashCode;
14 |
15 | protected String _name;
16 |
17 | public NamedType(Class> c) { this(c, null); }
18 |
19 | public NamedType(Class> c, String name)
20 | {
21 | _class = c;
22 | _hashCode = c.getName().hashCode();
23 | setName(name);
24 | }
25 |
26 | public Class> getType() { return _class; }
27 | public String getName() { return _name; }
28 | public void setName(String name) {
29 | _name = (name == null || name.length() == 0) ? null : name;
30 | }
31 |
32 | public boolean hasName() { return _name != null; }
33 |
34 | /**
35 | * Equality is defined based on class only, not on name
36 | */
37 | @Override
38 | public boolean equals(Object o)
39 | {
40 | if (o == this) return true;
41 | if (o == null) return false;
42 | if (o.getClass() != getClass()) return false;
43 | return _class == ((NamedType) o)._class;
44 | }
45 |
46 | @Override
47 | public int hashCode() { return _hashCode; }
48 |
49 | @Override
50 | public String toString() {
51 | return "[NamedType, class "+_class.getName()+", name: "+(_name == null ? "null" :("'"+_name+"'"))+"]";
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/SubtypeResolver.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype;
2 |
3 | import java.util.Collection;
4 |
5 | import org.codehaus.jackson.map.AnnotationIntrospector;
6 | import org.codehaus.jackson.map.MapperConfig;
7 | import org.codehaus.jackson.map.introspect.AnnotatedClass;
8 | import org.codehaus.jackson.map.introspect.AnnotatedMember;
9 |
10 | /**
11 | * Helper object used for handling registration on resolving of supertypes
12 | * to subtypes.
13 | *
14 | * @since 1.5
15 | */
16 | public abstract class SubtypeResolver
17 | {
18 | /**
19 | * Method for registering specified subtypes (possibly including type
20 | * names); for type entries without name, non-qualified class name
21 | * as used as name (unless overridden by annotation).
22 | */
23 | public abstract void registerSubtypes(NamedType... types);
24 |
25 | public abstract void registerSubtypes(Class>... classes);
26 |
27 | /**
28 | * Method for finding out all reachable subtypes for a property specified
29 | * by given element (method or field)
30 | */
31 | public abstract Collection collectAndResolveSubtypes(AnnotatedMember property,
32 | MapperConfig> config, AnnotationIntrospector ai);
33 |
34 | /**
35 | * Method for finding out all reachable subtypes for given type.
36 | */
37 | public abstract Collection collectAndResolveSubtypes(AnnotatedClass basetype,
38 | MapperConfig> config, AnnotationIntrospector ai);
39 | }
40 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/impl/AsExternalTypeDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype.impl;
2 |
3 | import org.codehaus.jackson.annotate.JsonTypeInfo.As;
4 | import org.codehaus.jackson.map.BeanProperty;
5 | import org.codehaus.jackson.map.jsontype.TypeIdResolver;
6 | import org.codehaus.jackson.type.JavaType;
7 |
8 | /**
9 | * Type deserializer used with {@link As#EXTERNAL_PROPERTY} inclusion mechanism.
10 | * Actual implementation may look bit strange since it depends on comprehensive
11 | * pre-processing done by {@link org.codehaus.jackson.map.deser.BeanDeserializer}
12 | * to basically transform external type id into structure that looks more like
13 | * "wrapper-array" style inclusion. This intermediate form is chosen to allow
14 | * supporting all possible JSON structures.
15 | *
16 | * @since 1.9
17 | */
18 | public class AsExternalTypeDeserializer extends AsArrayTypeDeserializer
19 | {
20 | protected final String _typePropertyName;
21 |
22 | public AsExternalTypeDeserializer(JavaType bt, TypeIdResolver idRes, BeanProperty property,
23 | Class> defaultImpl,
24 | String typePropName)
25 | {
26 | super(bt, idRes, property, defaultImpl);
27 | _typePropertyName = typePropName;
28 | }
29 |
30 | @Override
31 | public As getTypeInclusion() {
32 | return As.EXTERNAL_PROPERTY;
33 | }
34 |
35 | @Override
36 | public String getPropertyName() { return _typePropertyName; }
37 | }
38 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/impl/TypeIdResolverBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype.impl;
2 |
3 | import org.codehaus.jackson.map.jsontype.TypeIdResolver;
4 | import org.codehaus.jackson.map.type.TypeFactory;
5 | import org.codehaus.jackson.type.JavaType;
6 |
7 | public abstract class TypeIdResolverBase
8 | implements TypeIdResolver
9 | {
10 | protected final TypeFactory _typeFactory;
11 |
12 | /**
13 | * Common base type for all polymorphic instances handled.
14 | */
15 | protected final JavaType _baseType;
16 |
17 | protected TypeIdResolverBase(JavaType baseType, TypeFactory typeFactory)
18 | {
19 | _baseType = baseType;
20 | _typeFactory = typeFactory;
21 | }
22 |
23 | @Override
24 | public void init(JavaType bt) {
25 | /* Standard type id resolvers do not need this;
26 | * only useful for custom ones.
27 | */
28 | }
29 |
30 | /**
31 | * @since 1.9.4
32 | */
33 | public String idFromBaseType()
34 | {
35 | return idFromValueAndType(null, _baseType.getRawClass());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/impl/TypeSerializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype.impl;
2 |
3 | import org.codehaus.jackson.annotate.JsonTypeInfo;
4 | import org.codehaus.jackson.map.BeanProperty;
5 | import org.codehaus.jackson.map.TypeSerializer;
6 | import org.codehaus.jackson.map.jsontype.TypeIdResolver;
7 |
8 | /**
9 | * @since 1.5
10 | */
11 | public abstract class TypeSerializerBase extends TypeSerializer
12 | {
13 | protected final TypeIdResolver _idResolver;
14 |
15 | protected final BeanProperty _property;
16 |
17 | protected TypeSerializerBase(TypeIdResolver idRes, BeanProperty property)
18 | {
19 | _idResolver = idRes;
20 | _property = property;
21 | }
22 |
23 | @Override
24 | public abstract JsonTypeInfo.As getTypeInclusion();
25 |
26 | @Override
27 | public String getPropertyName() { return null; }
28 |
29 | @Override
30 | public TypeIdResolver getTypeIdResolver() { return _idResolver; }
31 | }
32 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains standard implementations for
3 | * {@link org.codehaus.jackson.map.jsontype.TypeResolverBuilder}
4 | * and
5 | * {@link org.codehaus.jackson.map.jsontype.TypeIdResolver}.
6 | *
7 | * @since 1.5
8 | */
9 | package org.codehaus.jackson.map.jsontype.impl;
10 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/jsontype/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains interfaces that define how to implement
3 | * functionality for dynamically resolving type during deserialization.
4 | * This is needed for complete handling of polymorphic types, where
5 | * actual type can not be determined statically (declared type is
6 | * a supertype of actual polymorphic serialized types).
7 | *
8 | * @since 1.5
9 | */
10 | package org.codehaus.jackson.map.jsontype;
11 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/module/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains classes and interfaces to help implement
3 | * custom extension {@link org.codehaus.jackson.map.Module}s
4 | * (which are registered using
5 | * {@link org.codehaus.jackson.map.ObjectMapper#registerModule}.
6 | *
7 | * Note that classes in the package only support registering
8 | * handlers for non-generic types (types without type
9 | * parameterization) -- hence "simple" -- which works for
10 | * many cases, but not all. So if you will need to register
11 | * handlers for generic types, you will usually need to either
12 | * sub-class handlers, or implement/extend base types directly.
13 | *
14 | * @since 1.7
15 | */
16 | package org.codehaus.jackson.map.module;
17 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | Contains basic mapper (conversion) functionality that
3 | allows for converting between regular streaming json content and
4 | Java objects (beans or Tree Model: support for both is via
5 | {@link org.codehaus.jackson.map.ObjectMapper} class, as well
6 | as convenience methods included in
7 | {@link org.codehaus.jackson.JsonParser}
8 |
9 | Object mapper will convert Json content to ant from
10 | basic Java wrapper types (Integer, Boolean, Double),
11 | Collection types (List, Map), Java Beans,
12 | Strings and nulls.
13 |
14 | Tree mapper builds dynamically typed tree of JsonNode
s
15 | from Json content (and writes such trees as Json),
16 | similar to how DOM model works with xml.
17 | Main benefits over Object mapping are:
18 |
19 | No null checks are needed (dummy
20 | nodes are created as necessary to represent "missing" Object fields
21 | and Array elements)
22 |
23 | No type casts are usually needed: all public access methods are defined
24 | in basic JsonNode class, and when "incompatible" method (such as Array
25 | element access on, say, Boolean node) is used, returned node is
26 | virtual "missing" node.
27 |
28 |
29 | Because of its dynamic nature, Tree mapping is often convenient
30 | for basic path access and tree navigation, where structure of
31 | the resulting tree is known in advance.
32 | */
33 |
34 | package org.codehaus.jackson.map;
35 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/ArraySerializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.StdArraySerializers}
5 | */
6 | @Deprecated
7 | public class ArraySerializers extends org.codehaus.jackson.map.ser.std.StdArraySerializers { }
8 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/BeanPropertyFilter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.JsonGenerator;
4 | import org.codehaus.jackson.map.SerializerProvider;
5 |
6 | /**
7 | * Interface that defines API for filter objects use (as configured
8 | * using {@link org.codehaus.jackson.map.annotate.JsonFilter})
9 | * for filtering bean properties to serialize.
10 | *
11 | * @since 1.7
12 | */
13 | public interface BeanPropertyFilter
14 | {
15 | /**
16 | * Method called by {@link BeanSerializer} to let filter decide what to do with
17 | * given bean property value: the usual choices are to either filter out (i.e.
18 | * do nothing) or write using given {@link BeanPropertyWriter}, although filters
19 | * can choose other to do something different altogether.
20 | *
21 | * @param bean Bean of which property value to serialize
22 | * @param jgen Generator use for serializing value
23 | * @param prov Provider that can be used for accessing dynamic aspects of serialization
24 | * processing
25 | * @param writer Default bean property serializer to use
26 | */
27 | public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider prov,
28 | BeanPropertyWriter writer)
29 | throws Exception;
30 | }
31 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/ContainerSerializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.StdContainerSerializers} instead
5 | */
6 | @Deprecated
7 | public class ContainerSerializers
8 | extends org.codehaus.jackson.map.ser.std.StdContainerSerializers { }
9 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/EnumSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
4 | import org.codehaus.jackson.map.util.EnumValues;
5 |
6 | /**
7 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.EnumSerializer}
8 | */
9 | @Deprecated
10 | @JacksonStdImpl
11 | public class EnumSerializer
12 | extends org.codehaus.jackson.map.ser.std.EnumSerializer
13 | {
14 | public EnumSerializer(EnumValues v) {
15 | super(v);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/FilterProvider.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * Interface for objects that providers instances of {@link BeanPropertyFilter}
5 | * that match given ids. A provider is configured to be used during serialization,
6 | * to find filter to used based on id specified by {@link org.codehaus.jackson.map.annotate.JsonFilter}
7 | * annotation on bean class.
8 | *
9 | * @since 1.7
10 | */
11 | public abstract class FilterProvider
12 | {
13 | /**
14 | * Lookup method used to find {@link BeanPropertyFilter} that has specified id.
15 | * Note that id is typically a {@link java.lang.String}, but is not necessarily
16 | * limited to that; that is, while standard components use String, custom
17 | * implementation can choose other kinds of keys.
18 | *
19 | * @return Filter registered with specified id, if one defined; null if
20 | * none found.
21 | */
22 | public abstract BeanPropertyFilter findFilter(Object filterId);
23 | }
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/JdkSerializers.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.StdJdkSerializers}
5 | */
6 | @Deprecated
7 | public class JdkSerializers
8 | extends org.codehaus.jackson.map.ser.std.StdJdkSerializers
9 | {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/ScalarSerializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.SerializerBase} instead.
5 | */
6 | @Deprecated
7 | public abstract class ScalarSerializerBase
8 | extends org.codehaus.jackson.map.ser.std.SerializerBase
9 | {
10 | protected ScalarSerializerBase(Class t) {
11 | super(t);
12 | }
13 |
14 | @SuppressWarnings("unchecked")
15 | protected ScalarSerializerBase(Class> t, boolean dummy) {
16 | super((Class) t);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/SerializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.type.JavaType;
4 |
5 | /**
6 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.SerializerBase}
7 | */
8 | @Deprecated
9 | public abstract class SerializerBase
10 | extends org.codehaus.jackson.map.ser.std.SerializerBase
11 | {
12 | protected SerializerBase(Class t) {
13 | super(t);
14 | }
15 |
16 | protected SerializerBase(JavaType type) {
17 | super(type);
18 | }
19 |
20 | protected SerializerBase(Class> t, boolean dummy) {
21 | super(t, dummy);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/StdKeySerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | /**
4 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.StdKeySerializer} instead
5 | */
6 | @Deprecated
7 | public final class StdKeySerializer
8 | extends org.codehaus.jackson.map.ser.std.StdKeySerializer
9 | {
10 | final static StdKeySerializer instace = new StdKeySerializer();
11 | }
12 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/ToStringSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
4 |
5 | /**
6 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.ToStringSerializer}
7 | */
8 | @Deprecated
9 | @JacksonStdImpl
10 | public final class ToStringSerializer
11 | extends org.codehaus.jackson.map.ser.std.ToStringSerializer
12 | {
13 | public final static ToStringSerializer instance = new ToStringSerializer();
14 | }
15 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/impl/FailingSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.impl;
2 |
3 | import java.io.IOException;
4 | import java.lang.reflect.Type;
5 |
6 | import org.codehaus.jackson.JsonGenerationException;
7 | import org.codehaus.jackson.JsonGenerator;
8 | import org.codehaus.jackson.JsonNode;
9 | import org.codehaus.jackson.map.JsonMappingException;
10 | import org.codehaus.jackson.map.SerializerProvider;
11 | import org.codehaus.jackson.map.ser.std.SerializerBase;
12 |
13 | /**
14 | * Special bogus "serializer" that will throw
15 | * {@link JsonGenerationException} if its {@link #serialize}
16 | * gets invoked. Most commonly registered as handler for unknown types,
17 | * as well as for catching unintended usage (like trying to use null
18 | * as Map/Object key).
19 | */
20 | public final class FailingSerializer
21 | extends SerializerBase
22 | {
23 | final String _msg;
24 |
25 | public FailingSerializer(String msg) {
26 | super(Object.class);
27 | _msg = msg;
28 | }
29 |
30 | @Override
31 | public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider)
32 | throws IOException, JsonGenerationException
33 | {
34 | throw new JsonGenerationException(_msg);
35 | }
36 |
37 | @Override
38 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
39 | throws JsonMappingException
40 | {
41 | return null;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains implementation classes of serialization part of
3 | * data binding.
4 | */
5 | package org.codehaus.jackson.map.ser.impl;
6 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains implementation classes of serialization part of
3 | * data binding.
4 | */
5 | package org.codehaus.jackson.map.ser;
6 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/DateSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.io.IOException;
4 | import java.lang.reflect.Type;
5 | import java.util.Date;
6 |
7 | import org.codehaus.jackson.JsonGenerationException;
8 | import org.codehaus.jackson.JsonGenerator;
9 | import org.codehaus.jackson.JsonNode;
10 | import org.codehaus.jackson.map.SerializationConfig;
11 | import org.codehaus.jackson.map.SerializerProvider;
12 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
13 |
14 | /**
15 | * For efficiency, we will serialize Dates as longs, instead of
16 | * potentially more readable Strings.
17 | *
18 | * @since 1.9 (moved from 'org.codehaus.jackson.map.ser.StdSerializers#UtilDateSerializer}
19 | */
20 | @JacksonStdImpl
21 | public class DateSerializer
22 | extends ScalarSerializerBase
23 | {
24 | public static DateSerializer instance = new DateSerializer();
25 |
26 | public DateSerializer() { super(Date.class); }
27 |
28 | @Override
29 | public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider)
30 | throws IOException, JsonGenerationException
31 | {
32 | provider.defaultSerializeDateValue(value, jgen);
33 | }
34 |
35 | @Override
36 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
37 | {
38 | //todo: (ryan) add a format for the date in the schema?
39 | return createSchemaNode(provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)
40 | ? "number" : "string", true);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/NonTypedScalarSerializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonGenerationException;
6 | import org.codehaus.jackson.JsonGenerator;
7 | import org.codehaus.jackson.map.SerializerProvider;
8 | import org.codehaus.jackson.map.TypeSerializer;
9 |
10 | /**
11 | * Intermediate base class for limited number of scalar types
12 | * that should never include type information. These are "native"
13 | * types that are default mappings for corresponding JSON scalar
14 | * types: {@link java.lang.String}, {@link java.lang.Integer},
15 | * {@link java.lang.Double} and {@link java.lang.Boolean}.
16 | *
17 | * @since 1.9 (refactored from 'org.codehaus.jackson.map.StdSerializers#NontTypedScalarSerializer')
18 | */
19 | public abstract class NonTypedScalarSerializerBase
20 | extends ScalarSerializerBase
21 | {
22 | protected NonTypedScalarSerializerBase(Class t) {
23 | super(t);
24 | }
25 |
26 | @Override
27 | public final void serializeWithType(T value, JsonGenerator jgen, SerializerProvider provider,
28 | TypeSerializer typeSer)
29 | throws IOException, JsonGenerationException
30 | {
31 | // no type info, just regular serialization
32 | serialize(value, jgen, provider);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/NullSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.lang.reflect.Type;
4 | import java.io.IOException;
5 |
6 | import org.codehaus.jackson.*;
7 | import org.codehaus.jackson.map.*;
8 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
9 |
10 | /**
11 | * This is a simple dummy serializer that will just output literal
12 | * JSON null value whenever serialization is requested.
13 | * Used as the default "null serializer" (which is used for serializing
14 | * null object references unless overridden), as well as for some
15 | * more exotic types (java.lang.Void).
16 | */
17 | @JacksonStdImpl
18 | public class NullSerializer
19 | extends SerializerBase
20 | {
21 | public final static NullSerializer instance = new NullSerializer();
22 |
23 | private NullSerializer() { super(Object.class); }
24 |
25 | @Override
26 | public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider)
27 | throws IOException, JsonGenerationException
28 | {
29 | jgen.writeNull();
30 | }
31 |
32 | @Override
33 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
34 | throws JsonMappingException
35 | {
36 | return createSchemaNode("null");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/StaticListSerializerBase.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.lang.reflect.Type;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.JsonNode;
7 | import org.codehaus.jackson.map.BeanProperty;
8 | import org.codehaus.jackson.map.SerializerProvider;
9 | import org.codehaus.jackson.node.ObjectNode;
10 |
11 | /**
12 | * Intermediate base class for Lists, Collections and Arrays
13 | * that contain static (non-dynamic) value types.
14 | *
15 | * @since 1.7
16 | */
17 | public abstract class StaticListSerializerBase>
18 | extends SerializerBase
19 | {
20 | /**
21 | * Property that contains String List to serialize, if known.
22 | */
23 | protected final BeanProperty _property;
24 |
25 | protected StaticListSerializerBase(Class> cls, BeanProperty property)
26 | {
27 | super(cls, false);
28 | _property = property;
29 | }
30 |
31 | @Override
32 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
33 | {
34 | ObjectNode o = createSchemaNode("array", true);
35 | o.put("items", contentSchema());
36 | return o;
37 | }
38 |
39 | /*
40 | /**********************************************************
41 | /* Abstract methods for sub-classes to implement
42 | /**********************************************************
43 | */
44 |
45 | protected abstract JsonNode contentSchema();
46 | }
47 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/StdKeySerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.io.IOException;
4 | import java.lang.reflect.Type;
5 | import java.util.Date;
6 |
7 | import org.codehaus.jackson.JsonGenerationException;
8 | import org.codehaus.jackson.JsonGenerator;
9 | import org.codehaus.jackson.JsonNode;
10 | import org.codehaus.jackson.map.SerializerProvider;
11 | import org.codehaus.jackson.map.JsonMappingException;
12 | import org.codehaus.jackson.map.ser.std.SerializerBase;
13 |
14 | /**
15 | * Specialized serializer that can be used as the generic key
16 | * serializer, when serializing {@link java.util.Map}s to JSON
17 | * Objects.
18 | */
19 | public class StdKeySerializer
20 | extends SerializerBase
21 | {
22 | final static StdKeySerializer instace = new StdKeySerializer();
23 |
24 | public StdKeySerializer() { super(Object.class); }
25 |
26 | @Override
27 | public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider)
28 | throws IOException, JsonGenerationException
29 | {
30 | if (value instanceof Date) {
31 | provider.defaultSerializeDateKey((Date) value, jgen);
32 | } else {
33 | jgen.writeFieldName(value.toString());
34 | }
35 | }
36 |
37 | @Override
38 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
39 | throws JsonMappingException
40 | {
41 | return createSchemaNode("string");
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/StringSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.io.IOException;
4 | import java.lang.reflect.Type;
5 |
6 | import org.codehaus.jackson.JsonGenerationException;
7 | import org.codehaus.jackson.JsonGenerator;
8 | import org.codehaus.jackson.JsonNode;
9 | import org.codehaus.jackson.map.SerializerProvider;
10 | import org.codehaus.jackson.map.annotate.JacksonStdImpl;
11 |
12 | /**
13 | * This is the special serializer for regular {@link java.lang.String}s.
14 | *
15 | * Since this is one of "native" types, no type information is ever
16 | * included on serialization (unlike for most scalar types as of 1.5)
17 | */
18 | @JacksonStdImpl
19 | public final class StringSerializer
20 | extends NonTypedScalarSerializerBase
21 | {
22 | public StringSerializer() { super(String.class); }
23 |
24 | @Override
25 | public void serialize(String value, JsonGenerator jgen, SerializerProvider provider)
26 | throws IOException, JsonGenerationException
27 | {
28 | jgen.writeString(value);
29 | }
30 |
31 | @Override
32 | public JsonNode getSchema(SerializerProvider provider, Type typeHint)
33 | {
34 | return createSchemaNode("string", true);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/ser/std/TimeZoneSerializer.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser.std;
2 |
3 | import java.io.IOException;
4 | import java.util.TimeZone;
5 |
6 | import org.codehaus.jackson.JsonGenerationException;
7 | import org.codehaus.jackson.JsonGenerator;
8 | import org.codehaus.jackson.map.SerializerProvider;
9 | import org.codehaus.jackson.map.TypeSerializer;
10 |
11 | /**
12 | * @since 1.8
13 | */
14 | public class TimeZoneSerializer
15 | extends ScalarSerializerBase
16 | {
17 | public final static TimeZoneSerializer instance = new TimeZoneSerializer();
18 |
19 | public TimeZoneSerializer() { super(TimeZone.class); }
20 |
21 | @Override
22 | public void serialize(TimeZone value, JsonGenerator jgen, SerializerProvider provider)
23 | throws IOException, JsonGenerationException
24 | {
25 | jgen.writeString(value.getID());
26 | }
27 |
28 | @Override
29 | public void serializeWithType(TimeZone value, JsonGenerator jgen, SerializerProvider provider,
30 | TypeSerializer typeSer)
31 | throws IOException, JsonGenerationException
32 | {
33 | // Better ensure we don't use specific sub-classes:
34 | typeSer.writeTypePrefixForScalar(value, jgen, TimeZone.class);
35 | serialize(value, jgen, provider);
36 | typeSer.writeTypeSuffixForScalar(value, jgen);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/type/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains concrete implementations of
3 | * {@link org.codehaus.jackson.type.JavaType}, as
4 | * well as the factory ({@link org.codehaus.jackson.map.type.TypeFactory}) for
5 | * constructing instances from various input data types
6 | * (like {@link java.lang.Class}, {@link java.lang.reflect.Type})
7 | * and programmatically (for structured types, arrays,
8 | * {@link java.util.List}s and {@link java.util.Map}s).
9 | */
10 | package org.codehaus.jackson.map.type;
11 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/Annotations.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | import java.lang.annotation.Annotation;
4 |
5 | /**
6 | * Interface that defines interface for collection of annotations.
7 | *
8 | * Standard mutable implementation is {@link org.codehaus.jackson.map.introspect.AnnotationMap}
9 | *
10 | * @since 1.7
11 | */
12 | public interface Annotations
13 | {
14 | /**
15 | * Main access method used to find value for given annotation.
16 | */
17 | public A get(Class cls);
18 |
19 | /**
20 | * Returns number of annotation entries in this collection.
21 | */
22 | public int size();
23 | }
24 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/LRUMap.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | import java.util.LinkedHashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * Helper for simple bounded LRU maps used for reusing lookup values.
8 | *
9 | * @since 1.7
10 | */
11 | @SuppressWarnings("serial")
12 | public class LRUMap extends LinkedHashMap
13 | {
14 | protected final int _maxEntries;
15 |
16 | public LRUMap(int initialEntries, int maxEntries)
17 | {
18 | super(initialEntries, 0.8f, true);
19 | _maxEntries = maxEntries;
20 | }
21 |
22 | @Override
23 | protected boolean removeEldestEntry(Map.Entry eldest)
24 | {
25 | return size() > _maxEntries;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/LinkedNode.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | /**
4 | * Node of a forward-only linked list.
5 | *
6 | * @author tatu
7 | *
8 | * @param Type of contained object
9 | */
10 | public final class LinkedNode
11 | {
12 | final T _value;
13 | final LinkedNode _next;
14 |
15 | public LinkedNode(T value, LinkedNode next)
16 | {
17 | _value = value;
18 | _next = next;
19 | }
20 |
21 | public LinkedNode next() { return _next; }
22 |
23 | public T value() { return _value; }
24 |
25 | /**
26 | * Convenience method that can be used to check if a linked list
27 | * with given head node (which may be null to indicate empty list)
28 | * contains given value
29 | *
30 | * @param Type argument that defines contents of the linked list parameter
31 | * @param node Head node of the linked list
32 | * @param value Value to look for
33 | * @return True if linked list contains the value, false otherwise
34 | */
35 | public static boolean contains(LinkedNode node, ST value)
36 | {
37 | while (node != null) {
38 | if (node.value() == value) {
39 | return true;
40 | }
41 | node = node.next();
42 | }
43 | return false;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/Named.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | /**
4 | * Simple tag interface mostly to allow sorting by name
5 | *
6 | * @since 1.9
7 | */
8 | public interface Named {
9 | public String getName();
10 | }
11 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/Provider.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | import java.util.*;
4 |
5 | /**
6 | * Simple helper class used for decoupling instantiation of
7 | * optionally loaded handlers, like deserializers and deserializers
8 | * for libraries that are only present on some platforms.
9 | *
10 | * @author tatu
11 | *
12 | * @param Type of objects provided
13 | */
14 | public interface Provider
15 | {
16 | /**
17 | * Method used to request provider to provide entries it has
18 | */
19 | public Collection provide();
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/map/util/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Utility classes for Mapper package.
3 | */
4 | package org.codehaus.jackson.map.util;
5 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/node/NullNode.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.node;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.*;
6 | import org.codehaus.jackson.map.SerializerProvider;
7 |
8 | /**
9 | * This singleton value class is used to contain explicit JSON null
10 | * value.
11 | */
12 | public final class NullNode
13 | extends ValueNode
14 | {
15 | // // Just need a fly-weight singleton
16 |
17 | public final static NullNode instance = new NullNode();
18 |
19 | private NullNode() { }
20 |
21 | public static NullNode getInstance() { return instance; }
22 |
23 | @Override public JsonToken asToken() { return JsonToken.VALUE_NULL; }
24 |
25 | @Override
26 | public boolean isNull() { return true; }
27 |
28 | @Override
29 | public String asText() {
30 | return "null";
31 | }
32 |
33 | @Override
34 | public int asInt(int defaultValue) {
35 | return 0;
36 | }
37 | @Override
38 | public long asLong(long defaultValue) {
39 | return 0L;
40 | }
41 | @Override
42 | public double asDouble(double defaultValue) {
43 | return 0.0;
44 | }
45 |
46 | @Override
47 | public final void serialize(JsonGenerator jg, SerializerProvider provider)
48 | throws IOException, JsonProcessingException
49 | {
50 | jg.writeNull();
51 | }
52 |
53 | @Override
54 | public boolean equals(Object o)
55 | {
56 | return (o == this);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/node/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains concrete {@link org.codehaus.jackson.JsonNode} implementations
3 | * Jackson uses for the Tree model.
4 | * These classes are public since concrete type will be needed
5 | * for most operations that modify node trees. For read-only access concrete
6 | * types are usually not needed.
7 | */
8 | package org.codehaus.jackson.node;
9 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/schema/SchemaAware.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.schema;
2 |
3 | import org.codehaus.jackson.JsonNode;
4 | import org.codehaus.jackson.map.SerializerProvider;
5 | import org.codehaus.jackson.map.JsonMappingException;
6 |
7 | import java.lang.reflect.Type;
8 |
9 | /**
10 | * Marker interface for schema-aware serializers.
11 | *
12 | * @author Ryan Heaton
13 | */
14 | public interface SchemaAware
15 | {
16 | /**
17 | * Get the representation of the schema to which this serializer will conform.
18 | *
19 | * @param provider The serializer provider.
20 | * @param typeHint A hint about the type.
21 | * @return Json-schema for this serializer.
22 | */
23 | JsonNode getSchema(SerializerProvider provider, Type typeHint)
24 | throws JsonMappingException;
25 | }
26 |
--------------------------------------------------------------------------------
/src/mapper/java/org/codehaus/jackson/schema/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Classes needed for JSON schema support (currently just ability
3 | * to generate schemas using serialization part of data mapping)
4 | */
5 | package org.codehaus.jackson.schema;
6 |
--------------------------------------------------------------------------------
/src/maven/jackson-core-asl.pom:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 4.0.0
7 | org.codehaus.jackson
8 | jackson-core-asl
9 | jar
10 | Jackson
11 | @VERSION@
12 | Jackson is a high-performance JSON processor (parser, generator)
13 |
14 |
15 |
16 |
17 | http://jackson.codehaus.org
18 |
19 | http://xircles.codehaus.org/projects/jackson/repos/primary/repo
20 |
21 |
22 | http://jira.codehaus.org/browse/JACKSON
23 |
24 |
25 |
26 | cowtowncoder
27 | Tatu Saloranta
28 | tatu@fasterxml.com
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | The Apache Software License, Version 2.0
42 | http://www.apache.org/licenses/LICENSE-2.0.txt
43 | repo
44 |
45 |
46 |
47 |
48 | FasterXML
49 | http://fasterxml.com
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/maven/jackson-core-lgpl.pom:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 4.0.0
7 | org.codehaus.jackson
8 | jackson-core-lgpl
9 | jar
10 | Jackson
11 | @VERSION@
12 | Jackson is a high-performance JSON processor (parser, generator)
13 |
14 |
15 |
16 | http://jackson.codehaus.org
17 |
18 | http://xircles.codehaus.org/projects/jackson/repos/primary/repo
19 |
20 |
21 | http://jira.codehaus.org/browse/JACKSON
22 |
23 |
24 |
25 | cowtowncoder
26 | Tatu Saloranta
27 | tatu@fasterxml.com
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | GNU Lesser General Public License (LGPL), Version 2.1
41 | http://www.fsf.org/licensing/licenses/lgpl.txt
42 | repo
43 |
44 |
45 |
46 |
47 | FasterXML
48 | http://fasterxml.com
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/mrbean/java/org/codehaus/jackson/mrbean/MrBeanModule.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.mrbean;
2 |
3 | import org.codehaus.jackson.Version;
4 | import org.codehaus.jackson.map.Module;
5 | import org.codehaus.jackson.mrbean.AbstractTypeMaterializer;
6 |
7 | public class MrBeanModule extends Module
8 | {
9 | private final String NAME = "MrBeanModule";
10 |
11 | // TODO: externalize
12 | private final static Version VERSION = new Version(1, 8, 0, null);
13 |
14 | /**
15 | * Configured materializer instance to register with deserializer factory.
16 | */
17 | protected AbstractTypeMaterializer _materializer;
18 |
19 | /*
20 | /**********************************************************
21 | /* Life-cycle
22 | /**********************************************************
23 | */
24 |
25 | public MrBeanModule() {
26 | this(new AbstractTypeMaterializer());
27 | }
28 |
29 | public MrBeanModule(AbstractTypeMaterializer materializer) {
30 | _materializer = materializer;
31 | }
32 |
33 | @Override public String getModuleName() { return NAME; }
34 | @Override public Version version() { return VERSION; }
35 |
36 | @Override
37 | public void setupModule(SetupContext context)
38 | {
39 | // All we really need to for now is to register materializer:
40 | context.addAbstractTypeResolver(_materializer);
41 | }
42 |
43 | /*
44 | /**********************************************************
45 | /* Extended API, configuration
46 | /**********************************************************
47 | */
48 | }
49 |
--------------------------------------------------------------------------------
/src/mrbean/java/org/codehaus/jackson/mrbean/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that implements "interface materializer" functionality, whereby
3 | * abstract classes and interfaces can be used as-is, and framework constructs
4 | * implementations as needed.
5 | */
6 | package org.codehaus.jackson.mrbean;
7 |
--------------------------------------------------------------------------------
/src/sample/sample/UserSerializationExample.java:
--------------------------------------------------------------------------------
1 | package sample;
2 | // no package, i.e. at root of sample/extra
3 |
4 | import java.io.*;
5 |
6 | import org.codehaus.jackson.map.*;
7 |
8 | /**
9 | * A very simple example of full Jackson serialization.
10 | */
11 | public class UserSerializationExample
12 | {
13 | public static void main(String[] args)
14 | throws Exception
15 | {
16 | ObjectMapper mapper = new ObjectMapper();
17 | StringWriter sw = new StringWriter();
18 | mapper.writeValue(sw, new User());
19 | System.out.println("--- JSON ---");
20 | System.out.println(sw.toString());
21 | System.out.println("--- /JSON ---");
22 | }
23 | }
24 |
25 | class User {
26 | public enum Gender { MALE, FEMALE };
27 |
28 | public Name getName() { return new Name(); }
29 | public Address getAddress() { return new Address(); }
30 | public boolean isVerified() { return true; }
31 | public Gender getGender() { return Gender.MALE; }
32 | public byte[] getUserImage() throws Exception { return "Foobar!".getBytes(); }
33 | }
34 |
35 | class Name {
36 | public Name() { }
37 | public String getFirst() { return "Santa"; }
38 | public String getLast() { return "Claus"; }
39 | }
40 |
41 | class Address {
42 | public Address() { }
43 | public String getStreet() { return "1 Deadend Street"; }
44 | public String getCity() { return "Mercer Island"; }
45 | public String getState() { return "WA"; }
46 | public int getZip() { return 98040; }
47 | public String getCountry() { return "US"; }
48 | }
49 |
--------------------------------------------------------------------------------
/src/smile/java/org/codehaus/jackson/smile/SmileUtil.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.smile;
2 |
3 | /**
4 | * Class for miscellaneous helper methods.
5 | */
6 | public class SmileUtil
7 | {
8 | public static int zigzagEncode(int input) {
9 | // Canonical version:
10 | //return (input << 1) ^ (input >> 31);
11 | // but this is even better
12 | if (input < 0) {
13 | return (input << 1) ^ -1;
14 | }
15 | return (input << 1);
16 | }
17 |
18 | public static int zigzagDecode(int encoded) {
19 | // canonical:
20 | //return (encoded >>> 1) ^ (-(encoded & 1));
21 | if ((encoded & 1) == 0) { // positive
22 | return (encoded >>> 1);
23 | }
24 | // negative
25 | return (encoded >>> 1) ^ -1;
26 | }
27 |
28 | public static long zigzagEncode(long input) {
29 | // Canonical version
30 | //return (input << 1) ^ (input >> 63);
31 | if (input < 0L) {
32 | return (input << 1) ^ -1L;
33 | }
34 | return (input << 1);
35 | }
36 |
37 | public static long zigzagDecode(long encoded) {
38 | // canonical:
39 | //return (encoded >>> 1) ^ (-(encoded & 1));
40 | if ((encoded & 1) == 0) { // positive
41 | return (encoded >>> 1);
42 | }
43 | // negative
44 | return (encoded >>> 1) ^ -1L;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/smile/java/org/codehaus/jackson/smile/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains experimental implementation of
3 | * "Binary-Encoded JSON-Like" data format handlers (parser,
4 | * generator, factory produce both, supporting constants).
5 | *
6 | * See Smile format specification for more details.
7 | *
8 | * @since 1.6
9 | */
10 | package org.codehaus.jackson.smile;
11 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/failing/TestGenericsBounded.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.failing;
2 |
3 | import java.util.*;
4 |
5 | import org.codehaus.jackson.map.*;
6 |
7 | public class TestGenericsBounded
8 | extends BaseMapTest
9 | {
10 | protected static abstract class Base {
11 | public T inconsequential = null;
12 | }
13 |
14 | protected static abstract class BaseData {
15 | public T dataObj;
16 | }
17 |
18 | protected static class Child extends Base {
19 | public static class ChildData extends BaseData> { }
20 | }
21 |
22 | /*
23 | /*******************************************************
24 | /* Unit tests
25 | /*******************************************************
26 | */
27 |
28 | // Reproducing issue 743
29 | public void testIssue743() throws Exception
30 | {
31 | String s3 = "{\"dataObj\" : [ \"one\", \"two\", \"three\" ] }";
32 | ObjectMapper m = new ObjectMapper();
33 |
34 | Child.ChildData d = m.readValue(s3, Child.ChildData.class);
35 | assertNotNull(d.dataObj);
36 | assertEquals(3, d.dataObj.size());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/impl/TestUtf8Generator.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.impl;
2 |
3 | import java.io.ByteArrayOutputStream;
4 |
5 | import org.codehaus.jackson.JsonGenerator;
6 | import org.codehaus.jackson.io.IOContext;
7 | import org.codehaus.jackson.util.BufferRecycler;
8 |
9 | import main.BaseTest;
10 |
11 | public class TestUtf8Generator
12 | extends BaseTest
13 | {
14 | public void testUtf8Issue462() throws Exception
15 | {
16 | ByteArrayOutputStream bytes = new ByteArrayOutputStream();
17 | IOContext ioc = new IOContext(new BufferRecycler(), bytes, true);
18 | JsonGenerator gen = new Utf8Generator(ioc, 0, null, bytes);
19 | String str = "Natuurlijk is alles gelukt en weer een tevreden klant\uD83D\uDE04";
20 | int length = 4000 - 38;
21 |
22 | for (int i = 1; i <= length; ++i) {
23 | gen.writeNumber(1);
24 | }
25 | gen.writeString(str);
26 | gen.flush();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/BaseJaxbTest.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import org.codehaus.jackson.map.*;
4 | import org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector;
5 | import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
6 |
7 | public abstract class BaseJaxbTest
8 | extends org.codehaus.jackson.map.BaseMapTest
9 | {
10 | protected BaseJaxbTest() { }
11 |
12 | /*
13 | **************************************************************
14 | * Helper methods
15 | **************************************************************
16 | */
17 |
18 | protected ObjectMapper getJaxbMapper()
19 | {
20 | ObjectMapper mapper = new ObjectMapper();
21 | AnnotationIntrospector intr = new JaxbAnnotationIntrospector();
22 | mapper.setAnnotationIntrospector(intr);
23 | return mapper;
24 | }
25 |
26 | protected ObjectMapper getJaxbAndJacksonMapper()
27 | {
28 | ObjectMapper mapper = new ObjectMapper();
29 | AnnotationIntrospector intr = new AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(),
30 | new JacksonAnnotationIntrospector());
31 | mapper.setAnnotationIntrospector(intr);
32 | return mapper;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/CommonAttributes.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import javax.xml.bind.annotation.XmlAccessType;
4 | import javax.xml.bind.annotation.XmlAccessorType;
5 | import javax.xml.bind.annotation.XmlAnyAttribute;
6 | import javax.xml.bind.annotation.XmlAttribute;
7 | import java.net.URI;
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * Attributes common across all atom types
13 | *
14 | * @author Bill Burke
15 | * @version $Revision$
16 | */
17 | @XmlAccessorType(XmlAccessType.PROPERTY)
18 | public class CommonAttributes
19 | {
20 | private String language;
21 | private URI base;
22 |
23 |
24 | private Map,?> extensionAttributes = new HashMap();
25 |
26 | @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
27 | public String getLanguage()
28 | {
29 | return language;
30 | }
31 |
32 | public void setLanguage(String language)
33 | {
34 | this.language = language;
35 | }
36 |
37 | @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
38 | public URI getBase()
39 | {
40 | return base;
41 | }
42 |
43 | public void setBase(URI base)
44 | {
45 | this.base = base;
46 | }
47 |
48 | @XmlAnyAttribute
49 | public Map,?> getExtensionAttributes()
50 | {
51 | return extensionAttributes;
52 | }
53 | }
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/EntryType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | /**
4 | * @author Ryan Heaton
5 | */
6 | public class EntryType {
7 |
8 | private K key;
9 | private V value;
10 |
11 | public EntryType() {
12 | }
13 |
14 | public EntryType(K key, V value) {
15 | this.key = key;
16 | this.value = value;
17 | }
18 |
19 | public K getKey() {
20 | return key;
21 | }
22 |
23 | public void setKey(K key) {
24 | this.key = key;
25 | }
26 |
27 | public V getValue() {
28 | return value;
29 | }
30 |
31 | public void setValue(V value) {
32 | this.value = value;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/MapAdapter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import javax.xml.bind.annotation.adapters.XmlAdapter;
4 | import java.util.HashMap;
5 | import java.util.LinkedList;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | public class MapAdapter extends XmlAdapter, Map> {
10 | /**
11 | * {@inheritDoc}
12 | */
13 | @Override
14 | public MapType marshal(Map v) throws Exception {
15 |
16 | final List> theEntries = new
17 | LinkedList>();
18 | for (final Map.Entry anEntry : v.entrySet()) {
19 | theEntries.add(new EntryType(anEntry.getKey(), anEntry.getValue()));
20 | }
21 | return new MapType(theEntries);
22 | }
23 |
24 | /**
25 | * {@inheritDoc}
26 | */
27 | @Override
28 | public Map unmarshal(MapType v) throws Exception {
29 | final Map theMap = new HashMap();
30 | for (final EntryType anEntry : v.getEntries()) {
31 | theMap.put(anEntry.getKey(), anEntry.getValue());
32 | }
33 | return theMap;
34 | }
35 | }
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/MapType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import org.codehaus.jackson.jaxb.EntryType;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @author Ryan Heaton
9 | */
10 | public class MapType {
11 |
12 | public List> entries;
13 |
14 | public MapType() {
15 | }
16 |
17 | public MapType(List> theEntries) {
18 | this.entries = theEntries;
19 | }
20 |
21 | public List> getEntries() {
22 | return entries;
23 | }
24 |
25 | public void setEntries(List> entries) {
26 | this.entries = entries;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/ObjectContainingAMap.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
4 | import java.util.Map;
5 |
6 | /**
7 | * @author Ryan Heaton
8 | */
9 | public class ObjectContainingAMap {
10 |
11 | private Map myMap;
12 |
13 | @XmlJavaTypeAdapter( MapAdapter.class )
14 | public Map getMyMap() {
15 | return myMap;
16 | }
17 |
18 | public void setMyMap(Map myMap) {
19 | this.myMap = myMap;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/TestAdaptedMapType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import junit.framework.TestCase;
4 | import org.codehaus.jackson.map.ObjectMapper;
5 | import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
6 |
7 | import java.io.ByteArrayInputStream;
8 | import java.io.ByteArrayOutputStream;
9 | import java.util.HashMap;
10 |
11 | /**
12 | * @author Ryan Heaton
13 | */
14 | public class TestAdaptedMapType extends TestCase {
15 |
16 | public void testJacksonAdaptedMapType() throws Exception {
17 | ObjectContainingAMap obj = new ObjectContainingAMap();
18 | obj.setMyMap(new HashMap());
19 | obj.getMyMap().put("this", "that");
20 | obj.getMyMap().put("how", "here");
21 |
22 | ObjectMapper mapper = new ObjectMapper();
23 | mapper.getDeserializationConfig().withAnnotationIntrospector(new JaxbAnnotationIntrospector());
24 | mapper.getSerializationConfig().withAnnotationIntrospector(new JaxbAnnotationIntrospector());
25 | ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
26 | mapper.writeValue(bytesOut, obj);
27 | obj = mapper.readValue(new ByteArrayInputStream(bytesOut.toByteArray()), ObjectContainingAMap.class);
28 | assertNotNull(obj.getMyMap());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/TestJaxbNullProperties.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import org.codehaus.jackson.map.ObjectMapper;
4 | import org.codehaus.jackson.map.annotate.JsonSerialize;
5 |
6 | /**
7 | * Unit tests to ensure that handling of writing of null properties (or not)
8 | * works when using JAXB annotation introspector.
9 | * Mostly to test out [JACKSON-309].
10 | */
11 | public class TestJaxbNullProperties
12 | extends BaseJaxbTest
13 | {
14 | /*
15 | /**********************************************************
16 | /* Helper beans
17 | /**********************************************************
18 | */
19 |
20 | public static class Bean
21 | {
22 | public String empty;
23 |
24 | public String x = "y";
25 | }
26 |
27 | /*
28 | /**********************************************************
29 | /* Unit tests
30 | /**********************************************************
31 | */
32 |
33 | // Testing [JACKSON-309]
34 | public void testNullProps() throws Exception
35 | {
36 | ObjectMapper mapper = getJaxbMapper();
37 | mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
38 | assertEquals("{\"x\":\"y\"}", mapper.writeValueAsString(new Bean()));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/TestJaxbTypeCoercion.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import javax.xml.bind.annotation.XmlElement;
4 |
5 | import org.codehaus.jackson.map.ObjectMapper;
6 |
7 | public class TestJaxbTypeCoercion extends BaseJaxbTest
8 | {
9 | /*
10 | /**********************************************************
11 | /* Helper beans
12 | /**********************************************************
13 | */
14 |
15 | /**
16 | * Unit test related to [JACKSON-416]
17 | */
18 | static class Jackson416Bean
19 | {
20 | @XmlElement(type=Jackson416Base.class)
21 | public Jackson416Base value = new Jackson416Sub();
22 | }
23 |
24 | static class Jackson416Base
25 | {
26 | public String foo = "foo";
27 | }
28 |
29 | static class Jackson416Sub extends Jackson416Base
30 | {
31 | public String bar = "bar";
32 | }
33 |
34 | /*
35 | /**********************************************************
36 | /* Unit tests
37 | /**********************************************************
38 | */
39 |
40 | public void testIssue416() throws Exception
41 | {
42 | ObjectMapper mapper = getJaxbAndJacksonMapper();
43 | Jackson416Bean bean = new Jackson416Bean();
44 | String json = mapper.writeValueAsString(bean);
45 | assertEquals("{\"value\":{\"foo\":\"foo\"}}", json);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/TestRootName.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxb;
2 |
3 | import javax.xml.bind.annotation.XmlRootElement;
4 |
5 | import org.codehaus.jackson.map.ObjectMapper;
6 | import org.codehaus.jackson.map.SerializationConfig;
7 |
8 | public class TestRootName extends BaseJaxbTest
9 | {
10 | /*
11 | /**********************************************************
12 | /* Helper beans
13 | /**********************************************************
14 | */
15 |
16 | @XmlRootElement(name="rooty")
17 | static class MyType
18 | {
19 | public int value = 37;
20 | }
21 |
22 | /*
23 | /**********************************************************
24 | /* Unit tests
25 | /**********************************************************
26 | */
27 |
28 | public void testRootName() throws Exception
29 | {
30 | ObjectMapper mapper = getJaxbMapper();
31 | mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
32 | assertEquals("{\"rooty\":{\"value\":37}}", mapper.writeValueAsString(new MyType()));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxb/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package info can be used to add "package annotations", so here we are...
3 | */
4 | @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters({
5 | @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(
6 | type = javax.xml.namespace.QName.class,
7 | value = org.codehaus.jackson.jaxb.TestJaxbAnnotationIntrospector.QNameAdapter.class
8 | )
9 | })
10 | package org.codehaus.jackson.jaxb;
11 |
12 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxrs/TestCanSerialize.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import java.io.*;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.map.ObjectMapper;
7 | import org.codehaus.jackson.annotate.JsonTypeInfo;
8 |
9 | /**
10 | * Unit test to check [JACKSON-540]
11 | */
12 | public class TestCanSerialize extends main.BaseTest
13 | {
14 | static class Simple {
15 | protected List list;
16 |
17 | public List getList( ) { return list; }
18 | public void setList(List l) { list = l; }
19 | }
20 |
21 | public void testCanSerialize() throws IOException
22 | {
23 | ObjectMapper mapper = new ObjectMapper();
24 | mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_ARRAY);
25 |
26 | // construct test object
27 | List l = new ArrayList();
28 | l.add("foo");
29 | l.add("bar");
30 |
31 | Simple s = new Simple();
32 | s.setList(l);
33 |
34 | // this is fine:
35 | boolean can = mapper.canSerialize(Simple.class);
36 | assertTrue(can);
37 |
38 | // but with problem of [JACKSON-540], we get nasty surprise here...
39 | String json = mapper.writeValueAsString(s);
40 |
41 | Simple result = mapper.readValue(json, Simple.class);
42 | assertNotNull(result.list);
43 | assertEquals(2, result.list.size());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxrs/TestJsonpWrapping.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import java.io.*;
4 | import java.lang.annotation.Annotation;
5 |
6 | import javax.ws.rs.core.MediaType;
7 |
8 | public class TestJsonpWrapping
9 | extends main.BaseTest
10 | {
11 | public void testSimple() throws Exception
12 | {
13 | JacksonJsonProvider prov = new JacksonJsonProvider();
14 | Object bean = new Integer[] { 1, 2, 3 };
15 |
16 | // First: no JSONP wrapping:
17 | ByteArrayOutputStream out = new ByteArrayOutputStream();
18 | prov.writeTo(bean, bean.getClass(), bean.getClass(), new Annotation[0], MediaType.APPLICATION_JSON_TYPE, null, out);
19 | assertEquals("[1,2,3]", out.toString("UTF-8"));
20 |
21 | // then with wrapping:
22 | prov.setJSONPFunctionName("addAll");
23 | out = new ByteArrayOutputStream();
24 | prov.writeTo(bean, bean.getClass(), bean.getClass(), new Annotation[0], MediaType.APPLICATION_JSON_TYPE, null, out);
25 | assertEquals("addAll([1,2,3])", out.toString("UTF-8"));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxrs/TestLoading.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import org.codehaus.jackson.map.ObjectMapper;
4 |
5 | /**
6 | * Trivially simple test to ensure that JAX-RS piece can be loaded
7 | * in.
8 | */
9 | public class TestLoading extends main.BaseTest
10 | {
11 | final static class Bean {
12 | public int x = 3;
13 | }
14 |
15 | /**
16 | * Test for ensuring loading works ok, without needing XC module
17 | * (which means JUnit setup has to be ensure those classes
18 | * are not in...)
19 | */
20 | public void testLoading() throws Exception
21 | {
22 | JacksonJsonProvider prov = new JacksonJsonProvider();
23 | // alas, can not map 'real' MediaType, due to some deps within jax-rs api impl
24 | ObjectMapper m = prov.locateMapper(Bean.class, null);
25 | assertNotNull(m);
26 | }
27 |
28 | public void testEnsureXcMissing() throws Exception
29 | {
30 | /* 01-Sep-2010, tatus: Skip if not running from Ant/cli:
31 | */
32 | if (runsFromAnt()) {
33 | JacksonJaxbJsonProvider prov = new JacksonJaxbJsonProvider();
34 | try {
35 | // should fail here...
36 | prov.locateMapper(Bean.class, null);
37 | fail("Expected exception due to missing 'xc' module");
38 | } catch (NoClassDefFoundError e) {
39 | // as per [JACKSON-243], JVM messages differ here, should still have class name tho:
40 | verifyException(e, "JaxbAnnotationIntrospector");
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/jaxrs/TestRootType.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.jaxrs;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.lang.annotation.Annotation;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import javax.ws.rs.core.MediaType;
9 |
10 | import org.codehaus.jackson.annotate.*;
11 | import org.codehaus.jackson.annotate.JsonTypeInfo.As;
12 | import org.codehaus.jackson.annotate.JsonTypeInfo.Id;
13 | import org.codehaus.jackson.type.TypeReference;
14 |
15 | public class TestRootType
16 | extends main.BaseTest
17 | {
18 | @JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT, property="type")
19 | @JsonTypeName("bean")
20 | static class Bean {
21 | public int a = 3;
22 | }
23 |
24 | public void testRootType() throws Exception
25 | {
26 | JacksonJsonProvider prov = new JacksonJsonProvider();
27 | TypeReference> ref = new TypeReference>(){};
28 |
29 | Bean bean = new Bean();
30 | ArrayList list = new ArrayList();
31 | list.add(bean);
32 | ByteArrayOutputStream out = new ByteArrayOutputStream();
33 | prov.writeTo(list, List.class, ref.getType(), new Annotation[0], MediaType.APPLICATION_JSON_TYPE, null, out);
34 |
35 | String json = out.toString("UTF-8");
36 | assertEquals("[{\"bean\":{\"a\":3}}]", json);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/main/TestUnicode.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.main;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.*;
6 |
7 | public class TestUnicode extends main.BaseTest
8 | {
9 | public void testSurrogates() throws Exception
10 | {
11 | JsonFactory f = new JsonFactory();
12 | _testSurrogates(f, true);
13 | _testSurrogates(f, false);
14 | }
15 |
16 | /*
17 | /**********************************************************
18 | /* Helper methods
19 | /**********************************************************
20 | */
21 |
22 | private void _testSurrogates(JsonFactory f, boolean checkText) throws IOException
23 | {
24 | byte[] json = "{\"text\":\"\uD83D\uDE03\"}".getBytes("UTF-8");
25 | // first
26 | JsonParser jp = f.createJsonParser(json);
27 | assertToken(JsonToken.START_OBJECT, jp.nextToken());
28 | assertToken(JsonToken.FIELD_NAME, jp.nextToken());
29 | if (checkText) {
30 | assertEquals("text", jp.getText());
31 | }
32 | assertToken(JsonToken.VALUE_STRING, jp.nextToken());
33 | if (checkText) {
34 | assertEquals("\uD83D\uDE03", jp.getText());
35 | }
36 | assertToken(JsonToken.END_OBJECT, jp.nextToken());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/BrokenStringReader.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.io.*;
4 |
5 | public class BrokenStringReader
6 | extends FilterReader
7 | {
8 | final String _message;
9 |
10 | public BrokenStringReader(String content, String msg)
11 | {
12 | super(new StringReader(content));
13 | _message = msg;
14 | }
15 |
16 | @Override
17 | public int read(char[] cbuf, int off, int len)
18 | throws IOException
19 | {
20 | int i = super.read(cbuf, off, len);
21 | if (i < 0) {
22 | throw new IOException(_message);
23 | }
24 | return i;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/BrokenStringWriter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.io.*;
4 |
5 | public class BrokenStringWriter
6 | extends FilterWriter
7 | {
8 | final String _message;
9 |
10 | public BrokenStringWriter(String msg) {
11 | super(new StringWriter());
12 | _message = msg;
13 | }
14 |
15 | @Override
16 | public void write(char[] cbuf, int off, int len) throws IOException
17 | {
18 | throw new IOException(_message);
19 | }
20 |
21 | @Override
22 | public void write(int c) throws IOException
23 | {
24 | throw new IOException(_message);
25 | }
26 |
27 | @Override
28 | public void write(String str, int off, int len) throws IOException
29 | {
30 | throw new IOException(_message);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/TestStdDateFormat.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map;
2 |
3 | import java.util.*;
4 |
5 | import org.codehaus.jackson.map.util.StdDateFormat;
6 |
7 | public class TestStdDateFormat
8 | extends BaseMapTest
9 | {
10 | public void testFactories() {
11 | assertNotNull(StdDateFormat.getBlueprintISO8601Format());
12 | assertNotNull(StdDateFormat.getBlueprintRFC1123Format());
13 | TimeZone tz = TimeZone.getTimeZone("GMT");
14 | assertNotNull(StdDateFormat.getISO8601Format(tz));
15 | assertNotNull(StdDateFormat.getRFC1123Format(tz));
16 | }
17 |
18 | public void testInvalid() {
19 | StdDateFormat std = new StdDateFormat();
20 | try {
21 | std.parse("foobar");
22 | } catch (java.text.ParseException e) {
23 | verifyException(e, "Can not parse");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/convert/TestPolymorphicUpdateValue.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.convert;
2 |
3 | import org.codehaus.jackson.annotate.*;
4 |
5 | import org.codehaus.jackson.map.*;
6 |
7 | /**
8 | * Unit tests for verifying handling of update value on polymorphic
9 | * objects.
10 | */
11 | public class TestPolymorphicUpdateValue extends BaseMapTest
12 | {
13 | @JsonTypeInfo(include=JsonTypeInfo.As.WRAPPER_ARRAY //PROPERTY
14 | ,use=JsonTypeInfo.Id.NAME, property="type")
15 | @JsonSubTypes(value={ @JsonSubTypes.Type(value=Child.class)})
16 | abstract static class Parent {
17 | public int x;
18 | public int y;
19 | }
20 |
21 | @JsonTypeName("child")
22 | public static class Child extends Parent {
23 | public int w;
24 | public int h;
25 | }
26 |
27 | /*
28 | /********************************************************
29 | /* Unit tests
30 | /********************************************************
31 | */
32 |
33 | private final ObjectMapper MAPPER = new ObjectMapper();
34 |
35 | public void testPolymorphicTest() throws Exception
36 | {
37 | Child c = new Child();
38 | c.w = 10;
39 | c.h = 11;
40 | MAPPER.readerForUpdating(c).readValue("{\"x\":3,\"y\":4,\"w\":111}");
41 | assertEquals(3, c.x);
42 | assertEquals(4, c.y);
43 | assertEquals(111, c.w);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestAbstract.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.*;
4 | import org.codehaus.jackson.map.*;
5 |
6 | /**
7 | * Tests for checking handling of abstract types.
8 | */
9 | public class TestAbstract
10 | extends BaseMapTest
11 | {
12 | static abstract class Abstract {
13 | public int x;
14 | }
15 |
16 | /*
17 | /**********************************************************
18 | /* Unit tests
19 | /**********************************************************
20 | */
21 |
22 | /**
23 | * Test to verify details of how trying to deserialize into
24 | * abstract type should fail (if there is no way to determine
25 | * actual type information for the concrete type to use)
26 | */
27 | public void testAbstractFailure() throws Exception
28 | {
29 | ObjectMapper m = new ObjectMapper();
30 | try {
31 | m.readValue("{ \"x\" : 3 }", Abstract.class);
32 | fail("Should fail on trying to deserialize abstract type");
33 | } catch (JsonProcessingException e) {
34 | verifyException(e, "can not construct");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestAutoDetect.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.*;
4 | import org.codehaus.jackson.annotate.*;
5 | import org.codehaus.jackson.map.*;
6 |
7 | public class TestAutoDetect
8 | extends BaseMapTest
9 | {
10 | /*
11 | /********************************************************
12 | /* Helper beans
13 | /********************************************************
14 | */
15 |
16 | static class PrivateBean {
17 | String a;
18 |
19 | private PrivateBean() { }
20 |
21 | private PrivateBean(String a) { this.a = a; }
22 | }
23 |
24 | /*
25 | /********************************************************
26 | /* Unit tests
27 | /********************************************************
28 | */
29 |
30 | public void testPrivateCtor() throws Exception
31 | {
32 | // first, default settings, with which construction works ok
33 | ObjectMapper m = new ObjectMapper();
34 | PrivateBean bean = m.readValue("\"abc\"", PrivateBean.class);
35 | assertEquals("abc", bean.a);
36 |
37 | // then by increasing visibility requirement:
38 | m = new ObjectMapper();
39 | m.setVisibilityChecker(m.getVisibilityChecker().withCreatorVisibility
40 | (JsonAutoDetect.Visibility.PUBLIC_ONLY));
41 | try {
42 | m.readValue("\"abc\"", PrivateBean.class);
43 | fail("Expected exception for missing constructor");
44 | } catch (JsonProcessingException e) {
45 | verifyException(e, "no single-String constructor/factory");
46 | }
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestBlocking.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.io.*;
4 |
5 | import org.codehaus.jackson.*;
6 | import org.codehaus.jackson.map.*;
7 |
8 | /**
9 | * Unit test mostly written to cover issue [JACKSON-81]; unintended blocking
10 | * after data binding.
11 | */
12 | public class TestBlocking
13 | extends BaseMapTest
14 | {
15 | /**
16 | * This is an indirect test that should trigger problems if (and only if)
17 | * underlying parser is advanced beyond the only element array.
18 | * Basically, although content is invalid, this should be encountered
19 | * quite yet.
20 | */
21 | public void testEagerAdvance() throws IOException
22 | {
23 | ObjectMapper mapper = new ObjectMapper();
24 | JsonParser jp = createParserUsingReader("[ 1 ");
25 | assertToken(JsonToken.START_ARRAY, jp.nextToken());
26 | assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken());
27 |
28 | // And then try to map just a single entry: shouldn't fail:
29 | Integer I = mapper.readValue(jp, Integer.class);
30 | assertEquals(Integer.valueOf(1), I);
31 |
32 | // and should fail only now:
33 | try {
34 | jp.nextToken();
35 | } catch (IOException ioe) {
36 | verifyException(ioe, "Unexpected end-of-input: expected close marker for ARRAY");
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestGenericSubTyping.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.util.List;
4 |
5 | import org.codehaus.jackson.annotate.JsonProperty;
6 | import org.codehaus.jackson.type.TypeReference;
7 |
8 | import org.codehaus.jackson.map.*;
9 |
10 | public class TestGenericSubTyping extends BaseMapTest
11 | {
12 | // Types for [JACKSON-778]
13 |
14 | static class Document {}
15 | static class Row {}
16 | static class RowWithDoc extends Row {
17 | @JsonProperty("d") D d;
18 | }
19 | static class ResultSet {
20 | @JsonProperty("rows") List rows;
21 | }
22 | static class ResultSetWithDoc extends ResultSet> {}
23 |
24 | static class MyDoc extends Document {}
25 |
26 | /*
27 | /*******************************************************
28 | /* Unit tests
29 | /*******************************************************
30 | */
31 |
32 | public void testIssue778() throws Exception
33 | {
34 | final ObjectMapper mapper = new ObjectMapper();
35 | String json = "{\"rows\":[{\"d\":{}}]}";
36 |
37 | final TypeReference> type = new TypeReference>() {};
38 |
39 | // type passed is correct, but somehow it gets mangled when passed...
40 | ResultSetWithDoc rs = mapper.readValue(json, type);
41 | Document d = rs.rows.iterator().next().d;
42 |
43 | assertEquals(MyDoc.class, d.getClass()); //expected MyDoc but was Document
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestSimpleAtomicTypes.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import java.util.concurrent.atomic.*;
4 |
5 | import org.codehaus.jackson.map.ObjectMapper;
6 |
7 | public class TestSimpleAtomicTypes
8 | extends org.codehaus.jackson.map.BaseMapTest
9 | {
10 | public void testAtomicBoolean() throws Exception
11 | {
12 | ObjectMapper mapper = new ObjectMapper();
13 | AtomicBoolean b = mapper.readValue("true", AtomicBoolean.class);
14 | assertTrue(b.get());
15 | }
16 |
17 | public void testAtomicInt() throws Exception
18 | {
19 | ObjectMapper mapper = new ObjectMapper();
20 | AtomicInteger value = mapper.readValue("13", AtomicInteger.class);
21 | assertEquals(13, value.get());
22 | }
23 |
24 | public void testAtomicLong() throws Exception
25 | {
26 | ObjectMapper mapper = new ObjectMapper();
27 | AtomicLong value = mapper.readValue("12345678901", AtomicLong.class);
28 | assertEquals(12345678901L, value.get());
29 | }
30 |
31 | public void testAtomicReference() throws Exception
32 | {
33 | ObjectMapper mapper = new ObjectMapper();
34 | AtomicReference value = mapper.readValue("[1,2]",
35 | new org.codehaus.jackson.type.TypeReference>() { });
36 | Object ob = value.get();
37 | assertNotNull(ob);
38 | assertEquals(long[].class, ob.getClass());
39 | long[] longs = (long[]) ob;
40 | assertNotNull(longs);
41 | assertEquals(2, longs.length);
42 | assertEquals(1, longs[0]);
43 | assertEquals(2, longs[1]);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/deser/TestStatics.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.deser;
2 |
3 | import org.codehaus.jackson.annotate.*;
4 | import org.codehaus.jackson.map.*;
5 |
6 | /**
7 | * Tests for checking that static methods are not recognized as accessors
8 | * for properties
9 | */
10 | public class TestStatics
11 | extends BaseMapTest
12 | {
13 | static class Bean
14 | {
15 | int _x;
16 |
17 | public static void setX(int value) { throw new Error("Should NOT call static method"); }
18 |
19 | @JsonProperty("x") public void assignX(int x) { _x = x; }
20 | }
21 |
22 | /*
23 | /**********************************************************
24 | /* Test methods
25 | /**********************************************************
26 | */
27 |
28 | public void testSimpleIgnore() throws Exception
29 | {
30 | ObjectMapper m = new ObjectMapper();
31 | // should not care about static setter...
32 | Bean result = m.readValue("{ \"x\":3}", Bean.class);
33 | assertEquals(3, result._x);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/jsontype/TestNoTypeInfo.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.jsontype;
2 |
3 | import org.codehaus.jackson.annotate.*;
4 | import org.codehaus.jackson.map.*;
5 | import org.codehaus.jackson.map.annotate.JsonDeserialize;
6 |
7 | public class TestNoTypeInfo extends BaseMapTest
8 | {
9 | @JsonTypeInfo(use=JsonTypeInfo.Id.NONE)
10 | @JsonDeserialize(as=NoType.class)
11 | private static interface NoTypeInterface {
12 | }
13 |
14 | private final static class NoType implements NoTypeInterface {
15 | public int a = 3;
16 | }
17 |
18 | /*
19 | /**********************************************************
20 | /* Unit tests
21 | /**********************************************************
22 | */
23 |
24 | // for [JACKSON-746]
25 | public void testWithIdNone() throws Exception
26 | {
27 | final ObjectMapper mapper = new ObjectMapper();
28 | mapper.enableDefaultTyping();
29 | // serialize without type info
30 | String json = mapper.writeValueAsString(new NoType());
31 | assertEquals("{\"a\":3}", json);
32 |
33 | // and deserialize successfully
34 | NoTypeInterface bean = mapper.readValue("{\"a\":6}", NoTypeInterface.class);
35 | assertNotNull(bean);
36 | NoType impl = (NoType) bean;
37 | assertEquals(6, impl.a);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/ser/TestExceptionSerialization.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.map.BaseMapTest;
4 |
5 | import java.util.*;
6 |
7 | import org.codehaus.jackson.map.*;
8 |
9 | /**
10 | * Unit tests for verifying that simple exceptions can be serialized.
11 | */
12 | public class TestExceptionSerialization
13 | extends BaseMapTest
14 | {
15 | /*
16 | ///////////////////////////////////////////////////
17 | // Tests
18 | ///////////////////////////////////////////////////
19 | */
20 |
21 | public void testSimple() throws Exception
22 | {
23 | ObjectMapper mapper = new ObjectMapper();
24 | String TEST = "test exception";
25 | Map result = writeAndMap(mapper, new Exception(TEST));
26 | assertEquals(4, result.size());
27 | assertEquals(TEST, result.get("message"));
28 | assertNull(result.get("cause"));
29 | assertEquals(TEST, result.get("localizedMessage"));
30 |
31 | // hmmh. what should we get for stack traces?
32 | Object traces = result.get("stackTrace");
33 | if (!(traces instanceof List>)) {
34 | fail("Expected a List for exception member 'stackTrace', got: "+traces);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/ser/TestJsonSerialize3.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import java.io.IOException;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.*;
7 | import org.codehaus.jackson.map.*;
8 | import org.codehaus.jackson.map.annotate.JsonSerialize;
9 |
10 | public class TestJsonSerialize3 extends BaseMapTest
11 | {
12 | // [JACKSON-829]
13 | static class FooToBarSerializer extends JsonSerializer {
14 | @Override
15 | public void serialize(String value, JsonGenerator jgen, SerializerProvider provider)
16 | throws IOException {
17 | if ("foo".equals(value)) {
18 | jgen.writeString("bar");
19 | } else {
20 | jgen.writeString(value);
21 | }
22 | }
23 | }
24 |
25 | static class MyObject {
26 | @JsonSerialize(contentUsing = FooToBarSerializer.class)
27 | List list;
28 | }
29 | /*
30 | /**********************************************************
31 | /* Test methods
32 | /**********************************************************
33 | */
34 |
35 | public void testCustomContentSerializer() throws Exception
36 | {
37 | ObjectMapper m = new ObjectMapper();
38 | MyObject object = new MyObject();
39 | object.list = Arrays.asList("foo");
40 | String json = m.writeValueAsString(object);
41 | assertEquals("{\"list\":[\"bar\"]}", json);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/ser/TestObjectWriter.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import java.util.*;
4 |
5 | import org.codehaus.jackson.map.*;
6 |
7 | /**
8 | * Unit tests for checking features added to {@link ObjectWriter}, such
9 | * as adding of explicit pretty printer.
10 | *
11 | * @since 1.6
12 | */
13 | public class TestObjectWriter
14 | extends BaseMapTest
15 | {
16 | public void testPrettyPrinter() throws Exception
17 | {
18 | ObjectMapper mapper = new ObjectMapper();
19 | ObjectWriter writer = mapper.writer();
20 | HashMap data = new HashMap();
21 | data.put("a", 1);
22 |
23 | // default: no indentation
24 | assertEquals("{\"a\":1}", writer.writeValueAsString(data));
25 |
26 | // and then with standard
27 | writer = writer.withDefaultPrettyPrinter();
28 | assertEquals("{\n \"a\" : 1\n}", writer.writeValueAsString(data));
29 |
30 | // and finally, again without indentation
31 | writer = writer.withPrettyPrinter(null);
32 | assertEquals("{\"a\":1}", writer.writeValueAsString(data));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/ser/TestSerializerProvider.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import org.codehaus.jackson.map.*;
4 |
5 | public class TestSerializerProvider
6 | extends org.codehaus.jackson.map.BaseMapTest
7 | {
8 | static class MyBean {
9 | public int getX() { return 3; }
10 | }
11 |
12 | public void testFindExplicit() throws JsonMappingException
13 | {
14 | ObjectMapper mapper = new ObjectMapper();
15 | SerializationConfig config = mapper.getSerializationConfig();
16 | SerializerFactory f = new BeanSerializerFactory(null);
17 | StdSerializerProvider prov = new StdSerializerProvider().createInstance(config, f);
18 |
19 | // Should have working default key and null key serializers
20 | assertNotNull(prov.findKeySerializer(null, null));
21 | assertNotNull(prov.getNullKeySerializer());
22 | // as well as 'unknown type' one (throws exception)
23 | assertNotNull(prov.getUnknownTypeSerializer(getClass()));
24 |
25 | assertTrue(prov.hasSerializerFor(config, String.class, f));
26 | // call twice to verify it'll be cached (second code path)
27 | assertTrue(prov.hasSerializerFor(config, String.class, f));
28 |
29 | assertTrue(prov.hasSerializerFor(config, MyBean.class, f));
30 | assertTrue(prov.hasSerializerFor(config, MyBean.class, f));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/ser/TestSimpleAtomicTypes.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.ser;
2 |
3 | import java.util.concurrent.atomic.*;
4 |
5 | import org.codehaus.jackson.map.BaseMapTest;
6 | import org.codehaus.jackson.map.ObjectMapper;
7 |
8 | /**
9 | * Unit tests for verifying serialization of simple basic non-structured
10 | * types; primitives (and/or their wrappers), Strings.
11 | */
12 | public class TestSimpleAtomicTypes
13 | extends BaseMapTest
14 | {
15 | public void testAtomicBoolean() throws Exception
16 | {
17 | ObjectMapper mapper = new ObjectMapper();
18 | assertEquals("true", serializeAsString(mapper, new AtomicBoolean(true)));
19 | assertEquals("false", serializeAsString(mapper, new AtomicBoolean(false)));
20 | }
21 |
22 | public void testAtomicInteger() throws Exception
23 | {
24 | ObjectMapper mapper = new ObjectMapper();
25 | assertEquals("1", serializeAsString(mapper, new AtomicInteger(1)));
26 | assertEquals("-9", serializeAsString(mapper, new AtomicInteger(-9)));
27 | }
28 |
29 | public void testAtomicLong() throws Exception
30 | {
31 | ObjectMapper mapper = new ObjectMapper();
32 | assertEquals("0", serializeAsString(mapper, new AtomicLong(0)));
33 | }
34 |
35 | public void testAtomicReference() throws Exception
36 | {
37 | ObjectMapper mapper = new ObjectMapper();
38 | String[] strs = new String[] { "abc" };
39 | assertEquals("[\"abc\"]", serializeAsString(mapper, new AtomicReference(strs)));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/map/util/ISO8601DateFormatTest.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.map.util;
2 |
3 | import java.text.DateFormat;
4 | import java.util.*;
5 |
6 | import org.codehaus.jackson.map.BaseMapTest;
7 |
8 | /**
9 | * @see ISO8601DateFormat
10 | */
11 | public class ISO8601DateFormatTest extends BaseMapTest
12 | {
13 | private ISO8601DateFormat df;
14 | private Date date;
15 |
16 | @Override
17 | public void setUp()
18 | {
19 | Calendar cal = new GregorianCalendar(2007, 8 - 1, 13, 19, 51, 23);
20 | cal.setTimeZone(TimeZone.getTimeZone("GMT"));
21 | cal.set(Calendar.MILLISECOND, 0);
22 | date = cal.getTime();
23 | df = new ISO8601DateFormat();
24 | }
25 |
26 | public void testFormat() {
27 | String result = df.format(date);
28 | assertEquals("2007-08-13T19:51:23Z", result);
29 | }
30 |
31 | public void testParse() throws Exception {
32 | Date result = df.parse("2007-08-13T19:51:23Z");
33 | assertEquals(date, result);
34 | }
35 |
36 | public void testCloneObject() throws Exception {
37 | DateFormat clone = (DateFormat)df.clone();
38 | assertSame(df, clone);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/mrbean/TestAbstractClasses.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.mrbean;
2 |
3 | import org.codehaus.jackson.map.BaseMapTest;
4 | import org.codehaus.jackson.map.ObjectMapper;
5 |
6 | public class TestAbstractClasses
7 | extends BaseMapTest
8 | {
9 | /*
10 | /**********************************************************
11 | /* Test classes, enums
12 | /**********************************************************
13 | */
14 |
15 | public abstract static class Bean
16 | {
17 | int y;
18 |
19 | protected Bean() { }
20 |
21 | public abstract String getX();
22 |
23 | public String getFoo() { return "Foo!"; }
24 | public void setY(int value) { y = value; }
25 | }
26 |
27 | /*
28 | /**********************************************************
29 | /* Unit tests
30 | /**********************************************************
31 | */
32 |
33 | public void testSimpleInteface() throws Exception
34 | {
35 | ObjectMapper mapper = new ObjectMapper();
36 | mapper.registerModule(new MrBeanModule());
37 | Bean bean = mapper.readValue("{ \"x\" : \"abc\", \"y\" : 13 }", Bean.class);
38 | assertNotNull(bean);
39 | assertEquals("abc", bean.getX());
40 | assertEquals(13, bean.y);
41 | assertEquals("Foo!", bean.getFoo());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/mrbean/TestGenericTypes.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.mrbean;
2 |
3 | import java.util.*;
4 |
5 | import org.codehaus.jackson.map.BaseMapTest;
6 | import org.codehaus.jackson.map.ObjectMapper;
7 |
8 | public class TestGenericTypes
9 | extends BaseMapTest
10 | {
11 | /*
12 | /**********************************************************
13 | /* Test classes, enums
14 | /**********************************************************
15 | */
16 |
17 | public interface ListBean {
18 | public List getLeaves();
19 | }
20 |
21 | public static class LeafBean {
22 | public String value;
23 | }
24 |
25 | /*
26 | /**********************************************************
27 | /* Unit tests
28 | /**********************************************************
29 | */
30 |
31 | /**
32 | * Test simple leaf-level bean with 2 implied _beanProperties
33 | */
34 | public void testSimpleInteface() throws Exception
35 | {
36 | ObjectMapper mapper = new ObjectMapper();
37 | mapper.registerModule(new MrBeanModule());
38 | ListBean bean = mapper.readValue("{\"leaves\":[{\"value\":\"foo\"}] }", ListBean.class);
39 | assertNotNull(bean);
40 | List leaves = bean.getLeaves();
41 | assertNotNull(leaves);
42 | assertEquals(1, leaves.size());
43 | Object ob = leaves.get(0);
44 | assertSame(LeafBean.class, ob.getClass());
45 | assertEquals("foo", leaves.get(0).value);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/smile/TestMapper.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.smile;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.map.ObjectMapper;
6 | import org.junit.Assert;
7 |
8 | public class TestMapper extends SmileTestBase
9 | {
10 | static class BytesBean {
11 | public byte[] bytes;
12 |
13 | public BytesBean() { }
14 | public BytesBean(byte[] b) { bytes = b; }
15 | }
16 |
17 | // [JACKSON-733]
18 | public void testBinary() throws IOException
19 | {
20 | byte[] input = new byte[] { 1, 2, 3, -1, 8, 0, 42 };
21 | ObjectMapper mapper = smileMapper();
22 | byte[] smile = mapper.writeValueAsBytes(new BytesBean(input));
23 | BytesBean result = mapper.readValue(smile, BytesBean.class);
24 |
25 | assertNotNull(result.bytes);
26 | Assert.assertArrayEquals(input, result.bytes);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/smile/TestSmileAsTree.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.smile;
2 |
3 | import org.junit.Assert;
4 |
5 | import org.codehaus.jackson.JsonNode;
6 | import org.codehaus.jackson.map.*;
7 | import org.codehaus.jackson.node.*;
8 |
9 | public class TestSmileAsTree extends SmileTestBase
10 | {
11 | public void testSimple() throws Exception
12 | {
13 | // create the serialized JSON with byte array
14 | ObjectMapper mapper = new ObjectMapper(new SmileFactory());
15 |
16 | ObjectNode top1 = mapper.createObjectNode();
17 | ObjectNode foo1 = top1.putObject("foo");
18 | foo1.put("bar", "baz");
19 | final String TEXT = "Caf\u00e9 1\u20ac";
20 | final byte[] TEXT_BYTES = TEXT.getBytes("UTF-8");
21 | foo1.put("dat", TEXT_BYTES);
22 |
23 | byte[] doc = mapper.writeValueAsBytes(top1);
24 | // now, deserialize
25 | JsonNode top2 = mapper.readValue(doc, JsonNode.class);
26 | JsonNode foo2 = top2.get("foo");
27 | assertEquals("baz", foo2.get("bar").getTextValue());
28 |
29 | JsonNode datNode = foo2.get("dat");
30 | if (!datNode.isBinary()) {
31 | fail("Expected binary node; got "+datNode.getClass().getName());
32 | }
33 | byte[] bytes = datNode.getBinaryValue();
34 | Assert.assertArrayEquals(TEXT_BYTES, bytes);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/smile/TestSmileFeatures.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.smile;
2 |
3 | import org.codehaus.jackson.map.*;
4 | import org.codehaus.jackson.smile.SmileFactory;
5 |
6 | public class TestSmileFeatures
7 | extends SmileTestBase
8 | {
9 | /*
10 | /**********************************************************
11 | /* Helper types
12 | /**********************************************************
13 | */
14 |
15 | static class Bean {
16 | public int value;
17 | }
18 |
19 | /*
20 | /**********************************************************
21 | /* Unit tests
22 | /**********************************************************
23 | */
24 | // Let's ensure indentation doesn't break anything (should be NOP)
25 | public void testIndent() throws Exception
26 | {
27 | ObjectMapper mapper = new ObjectMapper(new SmileFactory());
28 | mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
29 | Bean bean = new Bean();
30 | bean.value = 42;
31 |
32 | byte[] smile = mapper.writeValueAsBytes(bean);
33 | Bean result = mapper.readValue(smile, 0, smile.length, Bean.class);
34 | assertEquals(42, result.value);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/smile/TestSmileParserUnicode.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.smile;
2 |
3 | import java.io.IOException;
4 |
5 | import org.codehaus.jackson.JsonToken;
6 |
7 | public class TestSmileParserUnicode extends SmileTestBase
8 | {
9 | // [Issue-2]: probs with Surrogate handling
10 | public void testLongUnicodeWithSurrogates() throws IOException
11 | {
12 | final String SURROGATE_CHARS = "\ud834\udd1e";
13 | StringBuilder sb = new StringBuilder(300);
14 | while (sb.length() < 300) {
15 | sb.append(SURROGATE_CHARS);
16 | }
17 | final String TEXT = sb.toString();
18 | byte[] data = _smileDoc(quote(TEXT));
19 |
20 | SmileParser p = _smileParser(data);
21 | assertNull(p.getCurrentToken());
22 | assertToken(JsonToken.VALUE_STRING, p.nextToken());
23 | assertEquals(TEXT, p.getText());
24 | assertNull(p.nextToken());
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/util/TestCharTypes.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.util;
2 |
3 | public class TestCharTypes
4 | extends main.BaseTest
5 | {
6 | public void testQuoting()
7 | {
8 | StringBuilder sb = new StringBuilder();
9 | CharTypes.appendQuoted(sb, "\n");
10 | assertEquals("\\n", sb.toString());
11 | sb = new StringBuilder();
12 | CharTypes.appendQuoted(sb, "\u0000");
13 | assertEquals("\\u0000", sb.toString());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/util/TestDelegates.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.util;
2 |
3 | import java.io.*;
4 |
5 | import org.codehaus.jackson.*;
6 |
7 | public class TestDelegates extends main.BaseTest
8 | {
9 | /**
10 | * Test default, non-overridden parser delegate.
11 | */
12 | public void testParserDelegate() throws IOException
13 | {
14 | JsonParser jp = new JsonFactory().createJsonParser("[ 1, true ]");
15 | assertNull(jp.getCurrentToken());
16 | assertToken(JsonToken.START_ARRAY, jp.nextToken());
17 | assertEquals("[", jp.getText());
18 | assertToken(JsonToken.VALUE_NUMBER_INT, jp.nextToken());
19 | assertEquals(1, jp.getIntValue());
20 | assertToken(JsonToken.VALUE_TRUE, jp.nextToken());
21 | assertTrue(jp.getBooleanValue());
22 | assertToken(JsonToken.END_ARRAY, jp.nextToken());
23 | jp.close();
24 | assertTrue(jp.isClosed());
25 | }
26 |
27 | /**
28 | * Test default, non-overridden generator delegate.
29 | */
30 | public void testGeneratorDelegate() throws IOException
31 | {
32 | StringWriter sw = new StringWriter();
33 | JsonGenerator jg = new JsonFactory().createJsonGenerator(sw);
34 | jg.writeStartArray();
35 | jg.writeNumber(13);
36 | jg.writeNull();
37 | jg.writeBoolean(false);
38 | jg.writeEndArray();
39 | jg.close();
40 | assertTrue(jg.isClosed());
41 | assertEquals("[13,null,false]", sw.toString());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/org/codehaus/jackson/util/TestVersionUtil.java:
--------------------------------------------------------------------------------
1 | package org.codehaus.jackson.util;
2 |
3 | import org.codehaus.jackson.Version;
4 |
5 | public class TestVersionUtil extends main.BaseTest
6 | {
7 | public void testVersionPartParsing()
8 | {
9 | assertEquals(13, VersionUtil.parseVersionPart("13"));
10 | assertEquals(27, VersionUtil.parseVersionPart("27.8"));
11 | assertEquals(0, VersionUtil.parseVersionPart("-3"));
12 | }
13 |
14 | public void testVersionParsing()
15 | {
16 | assertEquals(new Version(1, 2, 15, "foo"), VersionUtil.parseVersion("1.2.15-foo"));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/tools/TestGenerator.java:
--------------------------------------------------------------------------------
1 |
2 |
3 | import java.io.*;
4 | import java.math.BigDecimal;
5 |
6 | import org.codehaus.jackson.*;
7 |
8 | public class TestGenerator
9 | {
10 | private TestGenerator() { }
11 |
12 | public static void main(String[] args)
13 | throws Exception
14 | {
15 | StringWriter strw = new StringWriter();
16 | JsonGenerator jg = new JsonFactory().createJsonGenerator(strw);
17 |
18 | jg.writeStartObject();
19 | jg.writeFieldName("pi");
20 | //jg.writeNumber(new BigDecimal("1.23"));
21 | jg.writeNumber(new BigDecimal("1.23"));
22 | jg.writeFieldName("binary");
23 | byte[] data = "Test string!".getBytes("UTF-8");
24 | jg.writeBinary(data);
25 |
26 | // what happens if we leave this out?
27 | //jg.writeEndObject();
28 |
29 | jg.close();
30 |
31 | System.out.println("Result: <"+strw.toString()+">");
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/src/tools/TestObjectMapper.java:
--------------------------------------------------------------------------------
1 | import java.io.*;
2 |
3 | import org.codehaus.jackson.*;
4 | import org.codehaus.jackson.map.*;
5 |
6 | public class TestObjectMapper
7 | {
8 | private TestObjectMapper() { }
9 |
10 | public static void main(String[] args)
11 | throws Exception
12 | {
13 | if (args.length != 1) {
14 | System.err.println("Usage: java test.TestObjectMapper ");
15 | System.exit(1);
16 | }
17 | FileInputStream in = new FileInputStream(new File(args[0]));
18 | JsonFactory f = new JsonFactory();
19 | JsonParser jp = f.createJsonParser(in);
20 | ObjectMapper map = new ObjectMapper();
21 | // 06-Jan-2009, tatu: This will mean "untyped" mapping
22 | Object result = map.readValue(jp, Object.class);
23 | jp.close();
24 | System.out.println("Read result ("+(result.getClass())+"): <"+result+">");
25 |
26 | StringWriter sw = new StringWriter();
27 | JsonGenerator jg = f.createJsonGenerator(sw);
28 | try {
29 | map.writeValue(jg, result);
30 | } catch (Exception e) {
31 | try { jg.flush(); } catch (IOException ioe) { }
32 | System.err.println("Error, intermediate result = |"+sw+"|");
33 | throw e;
34 | }
35 | jg.close();
36 |
37 | System.out.println("Write result: <"+sw.toString()+">");
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/src/tools/TestSerializationError.java:
--------------------------------------------------------------------------------
1 | import java.io.*;
2 | import java.util.*;
3 |
4 | import org.codehaus.jackson.map.*;
5 |
6 | public class TestSerializationError
7 | {
8 | final static class OkBean {
9 | ArrayList _beans;
10 |
11 | public OkBean() {
12 | _beans = new ArrayList();
13 | _beans.add(new NonBean[] { new NonBean() });;
14 | }
15 |
16 | public List getNonBeans() { return _beans; }
17 | }
18 |
19 | final static class NonBean {
20 | public NonBean() { }
21 | }
22 |
23 | public static void main(String[] args)
24 | throws Exception
25 | {
26 | ObjectMapper mapper = new ObjectMapper();
27 | ArrayList list = new ArrayList();
28 | list.add(new OkBean());
29 | HashMap map = new HashMap();
30 | map.put("foo", list);
31 | // should error out, but what do we see there?
32 | StringWriter sw = new StringWriter();
33 | mapper.writeValue(sw, map);
34 |
35 | System.out.println("Odd, didn't fail, got: "+sw.toString());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/xc/java/org/codehaus/jackson/xc/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Package that contains XML Compatibility functionality for Jackson, such
3 | * as handlers for JAXB annotations
4 | */
5 | package org.codehaus.jackson.xc;
6 |
--------------------------------------------------------------------------------