├── yasson-jmh ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── yasson │ │ └── jmh │ │ ├── model │ │ ├── CollectionsData.java │ │ └── ScalarData.java │ │ └── TenPropertySerializationTest.java └── README.md ├── yasson-tck └── .gitignore ├── .gitignore ├── src ├── main │ ├── resources │ │ └── META-INF │ │ │ ├── services │ │ │ └── jakarta.json.bind.spi.JsonbProvider │ │ │ └── native-image │ │ │ └── org.eclipse │ │ │ └── yasson │ │ │ └── native-image.properties │ └── java │ │ ├── org │ │ └── eclipse │ │ │ └── yasson │ │ │ ├── internal │ │ │ ├── model │ │ │ │ ├── ModulesUtil.java │ │ │ │ └── ReverseTreeMap.java │ │ │ ├── serializer │ │ │ │ ├── AbstractSerializer.java │ │ │ │ └── types │ │ │ │ │ ├── LongSerializer.java │ │ │ │ │ ├── ByteSerializer.java │ │ │ │ │ ├── DoubleSerializer.java │ │ │ │ │ ├── ShortSerializer.java │ │ │ │ │ ├── IntegerSerializer.java │ │ │ │ │ ├── BigDecimalSerializer.java │ │ │ │ │ ├── BigIntegerSerializer.java │ │ │ │ │ ├── NumberSerializer.java │ │ │ │ │ ├── BooleanSerializer.java │ │ │ │ │ ├── CharSerializer.java │ │ │ │ │ ├── FloatSerializer.java │ │ │ │ │ ├── UriSerializer.java │ │ │ │ │ ├── UrlSerializer.java │ │ │ │ │ └── UuidSerializer.java │ │ │ ├── deserializer │ │ │ │ └── types │ │ │ │ │ ├── ByteDeserializer.java │ │ │ │ │ ├── FloatDeserializer.java │ │ │ │ │ ├── ShortDeserializer.java │ │ │ │ │ ├── DoubleDeserializer.java │ │ │ │ │ ├── BigDecimalDeserializer.java │ │ │ │ │ ├── BigIntegerDeserializer.java │ │ │ │ │ ├── CharDeserializer.java │ │ │ │ │ ├── UriDeserializer.java │ │ │ │ │ ├── UuidDeserializer.java │ │ │ │ │ ├── ZoneIdDeserializer.java │ │ │ │ │ ├── PeriodDeserializer.java │ │ │ │ │ ├── PathDeserializer.java │ │ │ │ │ ├── NumberDeserializer.java │ │ │ │ │ ├── EnumDeserializer.java │ │ │ │ │ ├── ZoneOffsetDeserializer.java │ │ │ │ │ └── DurationDeserializer.java │ │ │ └── components │ │ │ │ └── DefaultConstructorCreator.java │ │ │ ├── JsonBindingProvider.java │ │ │ └── ImplementationClass.java │ │ └── module-info.java └── test │ ├── resources │ ├── jndi.properties │ ├── META-INF │ │ └── beans.xml │ ├── logging.properties │ ├── yasson-messages_cs.properties │ └── test.policy │ └── java │ └── org │ └── eclipse │ └── yasson │ ├── customization │ ├── model │ │ ├── Animal.java │ │ ├── JsonbNillableInterfaceBaseOne.java │ │ ├── packagelevelannotations │ │ │ ├── package-info.java │ │ │ ├── JsonbNillablePackageLevel.java │ │ │ └── PackageLevelOverriddenWithClassLevel.java │ │ ├── InheritedAnnotationsPojo.java │ │ ├── JsonbNillableInterfaceBase.java │ │ ├── FieldOrder.java │ │ ├── FieldCustomOrderWrapper.java │ │ ├── JsonbNillableOverridesInterface.java │ │ ├── JsonbNillableInterfaceBaseTwo.java │ │ ├── InterfacedPojoA.java │ │ ├── InterfacedPojoB.java │ │ ├── InterfacedPojoC.java │ │ ├── CreatorIncompatibleTypePojo.java │ │ ├── ImplementationClassPojo.java │ │ ├── InheritsNillableRecursion.java │ │ ├── FieldSpecificOrder.java │ │ ├── JsonbNillableOverridesClass.java │ │ ├── FieldOrderNameAnnotation.java │ │ ├── FieldCustomOrder.java │ │ ├── CollectionsWithFormatters.java │ │ ├── InterfacedPojoAbsImpl.java │ │ ├── Dog.java │ │ ├── InterfacedPojoImpl.java │ │ ├── InheritsNillable.java │ │ ├── JsonbNillableClassFirstLevel.java │ │ ├── InheritsJsonbProperty.java │ │ ├── JsonbNillableClassSecondLevel.java │ │ ├── JsonbNillableValue.java │ │ ├── CreatorWithoutJavabeanProperty.java │ │ └── CreatorMultipleDeclarationErrorPojo.java │ └── transients │ │ └── models │ │ ├── TransientGetterNoField.java │ │ ├── TransientGetterPlusCustomizationAnnotatedFieldContainer.java │ │ ├── TransientSetterPlusCustomizationAnnotatedFieldContainer.java │ │ └── TransientSetterPlusCustomizationAnnotatedGetterContainer.java │ ├── defaultmapping │ ├── generics │ │ └── model │ │ │ ├── AbstractMember.java │ │ │ ├── FinalGenericWrapper.java │ │ │ ├── TypeContainer.java │ │ │ ├── MiddleGenericWrapper.java │ │ │ ├── ColoredCircle.java │ │ │ ├── WildCardClass.java │ │ │ ├── ExtendedGenericTestClass.java │ │ │ ├── MultiLevelExtendedGenericTestClass.java │ │ │ ├── AnotherGenericTestClass.java │ │ │ ├── CyclicSubClass.java │ │ │ ├── MyCyclicGenericClass.java │ │ │ ├── GenericArrayClass.java │ │ │ ├── PropagatedGenericClass.java │ │ │ ├── GenericWithUnboundedWildcardClass.java │ │ │ ├── TreeTypeContainer.java │ │ │ ├── Shape.java │ │ │ ├── Circle.java │ │ │ ├── BoundedGenericClass.java │ │ │ ├── TreeContainer.java │ │ │ ├── WildcardMultipleBoundsClass.java │ │ │ ├── ScalarValueWrapper.java │ │ │ ├── MultipleBoundsContainer.java │ │ │ ├── LowerBoundTypeVariableWithCollectionAttributeClass.java │ │ │ └── GenericTestClass.java │ ├── modifiers │ │ └── model │ │ │ ├── PackagePrivateParent.java │ │ │ ├── Person.java │ │ │ ├── ChildOfPackagePrivateParent.java │ │ │ ├── PrivateConstructorClass.java │ │ │ └── ProtectedConstructorClass.java │ ├── typeConvertors │ │ └── model │ │ │ ├── StringWrapper.java │ │ │ ├── ByteArrayWrapper.java │ │ │ ├── CalendarWrapper.java │ │ │ ├── BigDecimalWrapper.java │ │ │ └── BigIntegerWrapper.java │ ├── collections │ │ └── Language.java │ ├── specific │ │ └── model │ │ │ ├── ClassWithUnsupportedFields.java │ │ │ ├── CustomUnsupportedInterface.java │ │ │ ├── OptionalWrapper.java │ │ │ └── StreetWithPrimitives.java │ ├── inheritance │ │ └── model │ │ │ ├── generics │ │ │ ├── GenericInterface.java │ │ │ ├── AnotherGenericInterface.java │ │ │ ├── ExtendsExtendsPropagatedGenericClass.java │ │ │ ├── ExtendsPropagatedGenericClass.java │ │ │ ├── SecondLevelGeneric.java │ │ │ └── AbstractZeroLevelGeneric.java │ │ │ ├── AbstractZeroLevel.java │ │ │ ├── PartialOverride.java │ │ │ ├── PartialOverrideBase.java │ │ │ └── PropertyOrderFirst.java │ ├── lambda │ │ ├── Addressable.java │ │ ├── Pet.java │ │ ├── Cat.java │ │ └── Robot.java │ ├── dates │ │ └── model │ │ │ ├── CollectionDatePojo.java │ │ │ ├── ClassLevelDateAnnotationParent.java │ │ │ ├── DateWithZonePojo.java │ │ │ ├── DatePojo.java │ │ │ ├── InstantPojo.java │ │ │ ├── LocalTimePojo.java │ │ │ ├── LocalDatePojo.java │ │ │ ├── OffsetTimePojo.java │ │ │ ├── CalendarPojo.java │ │ │ ├── LocalDateTimePojo.java │ │ │ ├── OffsetDateTimePojo.java │ │ │ ├── ZonedDateTimePojo.java │ │ │ └── ClassLevelDateAnnotation.java │ ├── jsonp │ │ └── model │ │ │ └── JsonpPojo.java │ ├── anonymous │ │ └── OuterPojo.java │ └── basic │ │ └── model │ │ ├── BigDecimalInNumber.java │ │ └── BooleanModel.java │ ├── records │ ├── CarWithoutAnnotations.java │ ├── CarWithExtraMethod.java │ ├── Car.java │ ├── CarWithDefaultConstructor.java │ ├── CarWithMultipleConstructors.java │ ├── CarWithMultipleConstructorsAndCreator.java │ └── CarWithCreator.java │ ├── adapters │ └── model │ │ ├── MultilevelAdapterClass.java │ │ ├── MultiinterfaceAdapter.java │ │ ├── JsonObjectPojo.java │ │ ├── BoxToCratePropagatedTypeArgsAdapter.java │ │ ├── Foo.java │ │ ├── ReturnNullAdapter.java │ │ ├── NumberAdapter.java │ │ ├── SerializableAdapter.java │ │ ├── FirstNameAdapter.java │ │ ├── FooSerializer.java │ │ ├── UUIDMapperClsBased.java │ │ ├── UUIDMapperIfcBased.java │ │ ├── Author.java │ │ ├── AdaptedPojo.java │ │ └── FooAdapter.java │ ├── internal │ └── cdi │ │ ├── IHelloService.java │ │ ├── MethodCalledEvent.java │ │ ├── MockJndiContextFactory.java │ │ ├── NonCdiAdapter.java │ │ ├── AdaptedPojo.java │ │ ├── MockInjectionTargetFactory.java │ │ ├── Hello1.java │ │ └── Hello2.java │ ├── serializers │ └── model │ │ ├── ImplicitJsonbSerializer.java │ │ ├── Box.java │ │ ├── ExplicitJsonbSerializer.java │ │ ├── StringWrapper.java │ │ ├── GenericPropertyPojo.java │ │ ├── AnnotatedGenericWithSerializerType.java │ │ ├── AnnotatedWithSerializerType.java │ │ ├── NumberSerializer.java │ │ ├── BoxWithAnnotations.java │ │ ├── CrateInner.java │ │ ├── NumberDeserializer.java │ │ ├── SimpleContainer.java │ │ ├── StringPaddingSerializer.java │ │ └── ContaineeSerializer.java │ ├── TestTypeToken.java │ ├── logger │ └── JsonbLoggerFormatter.java │ └── jsonstructure │ ├── InnerPojo.java │ └── InnerPojoSerializer.java ├── .github └── ISSUE_TEMPLATE │ ├── other-issue.md │ ├── bug_report.md │ └── feature_request.md └── etc ├── copyright-exclude.txt ├── copyright.txt ├── delivery-checks.sh ├── copyright.sh └── checkstyle-suppressions.xml /yasson-jmh/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | -------------------------------------------------------------------------------- /yasson-tck/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /target-tck/ 3 | .classpath 4 | .project 5 | .idea/ 6 | .settings/ 7 | /.DS_Store 8 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/jakarta.json.bind.spi.JsonbProvider: -------------------------------------------------------------------------------- 1 | org.eclipse.yasson.JsonBindingProvider -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other issue 3 | about: Not a bug or a feature request 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /etc/copyright-exclude.txt: -------------------------------------------------------------------------------- 1 | .iml 2 | .apt 3 | .args 4 | .bundle 5 | .class 6 | .ddl 7 | .exe 8 | .gif 9 | .gitignore 10 | .ico 11 | .jar 12 | .jks 13 | .jpg 14 | .json 15 | .mm 16 | .ods 17 | .png 18 | .svg 19 | .war 20 | .zip 21 | .dat 22 | .md 23 | .p12 24 | .txt 25 | .mf 26 | .pem 27 | .p8 28 | .pkcs8.pem 29 | .p12 30 | .bin 31 | .vm 32 | .policy 33 | -------------------------------------------------------------------------------- /etc/copyright.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) YYYY Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ -------------------------------------------------------------------------------- /src/test/resources/jndi.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0 which is available at 6 | # http://www.eclipse.org/legal/epl-2.0, 7 | # or the Eclipse Distribution License v. 1.0 which is available at 8 | # http://www.eclipse.org/org/documents/edl-v10.php. 9 | # 10 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | # 12 | 13 | java.naming.factory.initial=org.eclipse.yasson.internal.cdi.MockJndiContextFactory 14 | -------------------------------------------------------------------------------- /etc/delivery-checks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v. 2.0 which is available at 7 | # http://www.eclipse.org/legal/epl-2.0, 8 | # or the Eclipse Distribution License v. 1.0 which is available at 9 | # http://www.eclipse.org/org/documents/edl-v10.php. 10 | # 11 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 12 | # 13 | 14 | mvn checkstyle:checkstyle && \ 15 | etc/copyright.sh && \ 16 | echo "Completed normally" 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/Animal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | public interface Animal { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/native-image/org.eclipse/yasson/native-image.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0 which is available at 6 | # http://www.eclipse.org/legal/epl-2.0, 7 | # or the Eclipse Distribution License v. 1.0 which is available at 8 | # http://www.eclipse.org/org/documents/edl-v10.php. 9 | # 10 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | # 12 | 13 | # This adds command line options to native image tool 14 | Args=-H:IncludeResourceBundles=yasson-messages -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/AbstractMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | public class AbstractMember { 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithoutAnnotations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | public record CarWithoutAnnotations(String type, String color) { 16 | } 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. If there is an Exception, please include the full stack trace. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the bug 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **System information:** 20 | - OS: [e.g. Linux, Windows, Mac] 21 | - Java Version: [e.g. 8, 11] 22 | - Yasson Version: [e.g. 1.0.5] 23 | 24 | **Additional context** 25 | Add any other context about the problem here. 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/MultilevelAdapterClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | public abstract class MultilevelAdapterClass implements MultiinterfaceAdapter { 16 | } 17 | -------------------------------------------------------------------------------- /yasson-jmh/src/main/java/org/eclipse/yasson/jmh/model/CollectionsData.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.yasson.jmh.model; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | public class CollectionsData { 7 | 8 | private List listData; 9 | 10 | private Set setData; 11 | 12 | public List getListData() { 13 | return listData; 14 | } 15 | 16 | public void setListData(List listData) { 17 | this.listData = listData; 18 | } 19 | 20 | public Set getSetData() { 21 | return setData; 22 | } 23 | 24 | public void setSetData(Set setData) { 25 | this.setData = setData; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0 which is available at 6 | # http://www.eclipse.org/legal/epl-2.0, 7 | # or the Eclipse Distribution License v. 1.0 which is available at 8 | # http://www.eclipse.org/org/documents/edl-v10.php. 9 | # 10 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | # 12 | 13 | handlers=java.util.logging.ConsoleHandler 14 | .level=INFO 15 | 16 | java.util.logging.ConsoleHandler.level=INFO 17 | java.util.logging.ConsoleHandler.formatter=org.eclipse.yasson.logger.JsonbLoggerFormatter 18 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/FinalGenericWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | public class FinalGenericWrapper extends MiddleGenericWrapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/IHelloService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public interface IHelloService { 19 | 20 | void sayHello(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TypeContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | public interface TypeContainer { 16 | T getInstance(); 17 | void setInstance(T instance); 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithExtraMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | public record CarWithExtraMethod(String type, String color) { 16 | 17 | public String type() { 18 | return type; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/ImplicitJsonbSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | /** 16 | * Implicit serializer. 17 | */ 18 | public class ImplicitJsonbSerializer extends AbstractJsonbSerializer { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MiddleGenericWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | public abstract class MiddleGenericWrapper extends AbstractGenericWrapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/PackagePrivateParent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.modifiers.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | class PackagePrivateParent { 19 | 20 | public int id; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | 17 | public record Car(@JsonbProperty("typeChanged") String type, @JsonbProperty("colorChanged") String color) { 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBaseOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public interface JsonbNillableInterfaceBaseOne extends JsonbNillableInterfaceBase { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ColoredCircle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class ColoredCircle extends Circle { 19 | 20 | public String color; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/StringWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.typeConvertors.model; 14 | 15 | /** 16 | * Created by David Kral. 17 | */ 18 | public class StringWrapper { 19 | 20 | public String string; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/WildCardClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class WildCardClass { 19 | 20 | public T number; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.modifiers.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class Person { 19 | 20 | public String name; 21 | 22 | public Person child; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/ByteArrayWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.typeConvertors.model; 14 | 15 | /** 16 | * Created by David Kral. 17 | */ 18 | public class ByteArrayWrapper { 19 | 20 | public byte[] array; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /** 14 | * @author Roman Grigoriadi 15 | */ 16 | @JsonbNillable 17 | package org.eclipse.yasson.customization.model.packagelevelannotations; 18 | 19 | import jakarta.json.bind.annotation.JsonbNillable; 20 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ExtendedGenericTestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class ExtendedGenericTestClass extends GenericTestClass { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithDefaultConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | public record CarWithDefaultConstructor(String type, String color) { 16 | 17 | public CarWithDefaultConstructor() { 18 | this("some", "other"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /yasson-jmh/README.md: -------------------------------------------------------------------------------- 1 | #JMH performance tests for Yasson. 2 | 3 | Binaries for performance testing should never be uploaded into Maven repository. 4 | 5 | Use of JMH dependency is approved for testing purposes only as "Works with" CQ type, see: 6 | 7 | [jmh-core CQ](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18908), 8 | [jmh-generator-annprocess CQ](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18909) 9 | 10 | To run tests: 11 | - build it with maven 12 | - run from commandline 13 | 14 | For all JMH options available: 15 | ``` 16 | java -jar target/yasson-jmh.jar -h 17 | ``` 18 | 19 | Run examples: 20 | ``` 21 | java -jar target/yasson-jmh.jar 22 | java -jar target/yasson-jmh.jar -i 3 -t 5 -f 3 -prof stack 23 | java -jar target/yasson-jmh.jar ScalarDataTest.testDeserialize 24 | ``` -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/Box.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class Box { 19 | 20 | public String boxStr; 21 | 22 | public Crate crate; 23 | 24 | public String secondBoxStr; 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MultiLevelExtendedGenericTestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class MultiLevelExtendedGenericTestClass extends ExtendedGenericTestClass { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | public record CarWithMultipleConstructors(String type, String color) { 16 | 17 | public CarWithMultipleConstructors(String type) { 18 | this(type, "red"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/MultiinterfaceAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | import java.io.Serializable; 17 | 18 | interface MultiinterfaceAdapter extends Serializable, JsonbAdapter { 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/collections/Language.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.collections; 14 | 15 | /** 16 | * Test enumeration. 17 | * 18 | * @author Dmitry Kornilov 19 | */ 20 | public enum Language { 21 | English, 22 | Russian, 23 | Slovak, 24 | Czech 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/specific/model/ClassWithUnsupportedFields.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.specific.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class ClassWithUnsupportedFields { 19 | public CustomUnsupportedInterface customInterface; 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/AnotherGenericTestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class AnotherGenericTestClass { 19 | 20 | public T1 field1; 21 | 22 | public T2 field2; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/ChildOfPackagePrivateParent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.modifiers.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class ChildOfPackagePrivateParent extends PackagePrivateParent { 19 | 20 | public String name; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/CalendarWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.typeConvertors.model; 14 | 15 | import java.util.Calendar; 16 | 17 | /** 18 | * Created by David Kral. 19 | */ 20 | public class CalendarWrapper { 21 | 22 | public Calendar calendar; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/yasson-messages_cs.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0 which is available at 6 | # http://www.eclipse.org/legal/epl-2.0, 7 | # or the Eclipse Distribution License v. 1.0 which is available at 8 | # http://www.eclipse.org/org/documents/edl-v10.php. 9 | # 10 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | # 12 | 13 | processFromJson = Zpracovávám třídu: {0} z jsonu za použití convertoru: {1} 14 | processToJson = Zpracovávám třídu: {0} do jsonu za použití convertoru: {1} 15 | 16 | diacriticsTest=p\u0159\u00edli\u0161,\u017elu\u0165ou\u010dk\u00fd,k\u016f\u0148,\u00fap\u011bl,\u010f\u00e1belsk\u00e9,\u00f3dy 17 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InheritedAnnotationsPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | @InheritsNillableRecursion 19 | public class InheritedAnnotationsPojo { 20 | 21 | @InheritsJsonbProperty 22 | public String property; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/BigDecimalWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.typeConvertors.model; 14 | 15 | import java.math.BigDecimal; 16 | 17 | /** 18 | * Created by David Kral. 19 | */ 20 | public class BigDecimalWrapper { 21 | 22 | public BigDecimal bigDecimal; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/typeConvertors/model/BigIntegerWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.typeConvertors.model; 14 | 15 | import java.math.BigInteger; 16 | 17 | /** 18 | * Created by David Kral. 19 | */ 20 | public class BigIntegerWrapper { 21 | 22 | public BigInteger bigInteger; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/PrivateConstructorClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.modifiers.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class PrivateConstructorClass { 19 | 20 | public String randomField; 21 | 22 | private PrivateConstructorClass(){ 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/ExplicitJsonbSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | 17 | /** 18 | * Explicit serializer. 19 | */ 20 | public class ExplicitJsonbSerializer extends AbstractJsonbSerializer implements JsonbSerializer { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/model/ModulesUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.model; 14 | 15 | import java.lang.invoke.MethodHandles; 16 | 17 | class ModulesUtil { 18 | 19 | private ModulesUtil() { 20 | } 21 | 22 | static MethodHandles.Lookup lookup(){ 23 | return MethodHandles.publicLookup(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/GenericInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public interface GenericInterface { 19 | 20 | T getGenericValue(); 21 | 22 | void setGenericValue(T value); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/modifiers/model/ProtectedConstructorClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.modifiers.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class ProtectedConstructorClass { 19 | 20 | public String randomField; 21 | 22 | protected ProtectedConstructorClass(){ 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /etc/copyright.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | # 3 | # Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v. 2.0 which is available at 7 | # http://www.eclipse.org/legal/epl-2.0, 8 | # or the Eclipse Distribution License v. 1.0 which is available at 9 | # http://www.eclipse.org/org/documents/edl-v10.php. 10 | # 11 | # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 12 | # 13 | 14 | die(){ echo "${1}" ; exit 1 ;} 15 | 16 | readonly RESULT_FILE="target/copyright-check.txt" 17 | mkdir target 18 | 19 | mvn -q validate -Pcopyright \ 20 | > ${RESULT_FILE} || (cat ${RESULT_FILE}; die "Error running the Maven command") 21 | 22 | grep -i "copyright" ${RESULT_FILE} \ 23 | && die "COPYRIGHT ERROR" || echo "COPYRIGHT OK" 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/CyclicSubClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class CyclicSubClass extends MyCyclicGenericClass { 19 | public String subField; 20 | 21 | public CyclicSubClass() { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | 17 | /** 18 | * All extending classes should be nillable. 19 | * @author Roman Grigoriadi 20 | */ 21 | @JsonbNillable 22 | public interface JsonbNillableInterfaceBase { 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MyCyclicGenericClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class MyCyclicGenericClass> { 19 | public T field1; 20 | 21 | public MyCyclicGenericClass() { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/StringWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeSerializer; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class StringWrapper { 21 | 22 | @JsonbTypeSerializer(StringPaddingSerializer.class) 23 | public String strField; 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/FieldOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class FieldOrder { 19 | 20 | public String aField = "aValue"; 21 | public String dField = "dValue"; 22 | public String bField = "bValue"; 23 | public String cField = "cValue"; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/transients/models/TransientGetterNoField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.transients.models; 14 | 15 | import jakarta.json.bind.annotation.JsonbTransient; 16 | 17 | public class TransientGetterNoField { 18 | 19 | @JsonbTransient 20 | public String getFooString() { 21 | return ""; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/AnotherGenericInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public interface AnotherGenericInterface { 19 | 20 | T getAnotherGenericValue(); 21 | 22 | void setAnotherGenericValue(T value); 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/FieldCustomOrderWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author David Kral 17 | */ 18 | public class FieldCustomOrderWrapper { 19 | 20 | public String stringField = "stringValue"; 21 | public int intField = 1; 22 | public FieldCustomOrder fieldCustomOrder = new FieldCustomOrder(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericArrayClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class GenericArrayClass { 19 | public T[] genericArray; 20 | public U[] anotherGenericArray; 21 | public GenericTestClass propagatedGenericArray; 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/ExtendsExtendsPropagatedGenericClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | import java.math.BigDecimal; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class ExtendsExtendsPropagatedGenericClass extends ExtendsPropagatedGenericClass { 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/lambda/Addressable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.lambda; 14 | 15 | /** 16 | * A functional interface with no default properties. 17 | */ 18 | public interface Addressable { 19 | 20 | /** 21 | * Public readable property. 22 | * 23 | * @return name to be addressed with 24 | */ 25 | String getName(); 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/specific/model/CustomUnsupportedInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.specific.model; 14 | 15 | /** 16 | * Unmarhsalling to this interface is not supported. 17 | * 18 | * @author Roman Grigoriadi 19 | */ 20 | public interface CustomUnsupportedInterface { 21 | 22 | String getValue(); 23 | 24 | void setValue(String value); 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/JsonObjectPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeAdapter; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class JsonObjectPojo { 21 | 22 | @JsonbTypeAdapter(BoxToJsonObjectAdapter.class) 23 | public Box box; 24 | 25 | public GenericBox genericBox; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/PropagatedGenericClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class PropagatedGenericClass { 21 | public List, X>> genericList; 22 | public GenericTestClass genericTestClass; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableOverridesInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | @JsonbNillable(false) 21 | public class JsonbNillableOverridesInterface implements JsonbNillableInterfaceBaseTwo { 22 | public String nillableField; 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericWithUnboundedWildcardClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class GenericWithUnboundedWildcardClass { 21 | public List wildcardList; 22 | 23 | public GenericWithUnboundedWildcardClass() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TreeTypeContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author James R. Perkins 19 | */ 20 | public interface TreeTypeContainer> { 21 | 22 | List getChildren(); 23 | 24 | void setChildren(List children); 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/ExtendsPropagatedGenericClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | import org.eclipse.yasson.defaultmapping.generics.model.PropagatedGenericClass; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class ExtendsPropagatedGenericClass extends PropagatedGenericClass { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/AbstractSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer; 14 | 15 | /** 16 | * Abstract model serializer with delegate. 17 | */ 18 | abstract class AbstractSerializer implements ModelSerializer { 19 | 20 | final ModelSerializer delegate; 21 | 22 | AbstractSerializer(ModelSerializer delegate) { 23 | this.delegate = delegate; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/TestTypeToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson; 14 | 15 | import java.lang.reflect.ParameterizedType; 16 | import java.lang.reflect.Type; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public abstract class TestTypeToken { 22 | public Type getType() { 23 | return ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/BoxToCratePropagatedTypeArgsAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | import java.util.List; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public abstract class BoxToCratePropagatedTypeArgsAdapter implements JsonbAdapter, GenericCrate>>> { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | public class Foo { 16 | 17 | private String bar; 18 | 19 | public Foo(String bar) { 20 | this.bar = bar; 21 | } 22 | 23 | public String getBar() { 24 | return bar; 25 | } 26 | 27 | public void setBar(String bar) { 28 | this.bar = bar; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableInterfaceBaseTwo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | 17 | /** 18 | * Overrides super interface nillable value. 19 | * 20 | * @author Roman Grigoriadi 21 | */ 22 | @JsonbNillable(false) 23 | public interface JsonbNillableInterfaceBaseTwo extends JsonbNillableInterfaceBase { 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public interface InterfacedPojoA { 21 | 22 | 23 | @JsonbProperty("propA") 24 | String getPropertyA(); 25 | 26 | @JsonbProperty("propA") 27 | void setPropertyA(String property); 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/CollectionDatePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.util.Date; 17 | import java.util.List; 18 | 19 | /** 20 | * @author Roman Grigoriadi 21 | */ 22 | public class CollectionDatePojo { 23 | 24 | @JsonbDateFormat("HH:mm:ss | dd-MM-yyyy") 25 | public List dates; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/AbstractZeroLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public abstract class AbstractZeroLevel { 19 | 20 | protected String inZeroOverriddenInFirst; 21 | 22 | abstract String getInZeroOverriddenInFirst(); 23 | 24 | abstract void setInZeroOverriddenInFirst(String value); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/lambda/Pet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.lambda; 14 | 15 | /** 16 | * A functional interface with one default property. 17 | */ 18 | public interface Pet extends Addressable { 19 | 20 | /** 21 | * Public readable property with default value. 22 | * 23 | * @return pet's age in months 24 | */ 25 | default int getAge() { 26 | return 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/Shape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class Shape { 19 | private Double area; 20 | 21 | public Shape() { 22 | } 23 | 24 | public Double getArea() { 25 | return area; 26 | } 27 | 28 | public void setArea(Double area) { 29 | this.area = area; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/MethodCalledEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class MethodCalledEvent { 19 | 20 | private final String methodName; 21 | 22 | public MethodCalledEvent(String methodName) { 23 | this.methodName = methodName; 24 | } 25 | 26 | public String getMethodName() { 27 | return methodName; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/logger/JsonbLoggerFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.logger; 14 | 15 | import java.util.logging.LogRecord; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class JsonbLoggerFormatter extends java.util.logging.Formatter { 21 | @Override 22 | public String format(LogRecord record) { 23 | return String.format("%-8s",record.getLevel()) + " => " + record.getMessage()+"\n"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /etc/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public interface InterfacedPojoB extends InterfacedPojoA { 21 | 22 | @JsonbProperty("propB") 23 | String getPropertyB(); 24 | 25 | @JsonbProperty("propB") 26 | void setPropertyB(String propertyB); 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoC.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public interface InterfacedPojoC extends InterfacedPojoB { 21 | 22 | @JsonbProperty("propC") 23 | String getPropertyC(); 24 | 25 | @JsonbProperty("propC") 26 | void setPropertyC(String propertyC); 27 | } 28 | -------------------------------------------------------------------------------- /yasson-jmh/src/main/java/org/eclipse/yasson/jmh/model/ScalarData.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.yasson.jmh.model; 2 | 3 | public class ScalarData { 4 | 5 | private String stringValue; 6 | 7 | private Integer integerValue; 8 | 9 | public ScalarData(String stringValue, Integer integerValue) { 10 | this.stringValue = stringValue; 11 | this.integerValue = integerValue; 12 | } 13 | 14 | public ScalarData() { 15 | this.stringValue = "Short string"; 16 | this.integerValue = 10; 17 | } 18 | 19 | public String getStringValue() { 20 | return stringValue; 21 | } 22 | 23 | public void setStringValue(String stringValue) { 24 | this.stringValue = stringValue; 25 | } 26 | 27 | public Integer getIntegerValue() { 28 | return integerValue; 29 | } 30 | 31 | public void setIntegerValue(Integer integerValue) { 32 | this.integerValue = integerValue; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/jsonp/model/JsonpPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.jsonp.model; 14 | 15 | import jakarta.json.*; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class JsonpPojo { 21 | 22 | public JsonObject jsonObject; 23 | 24 | public JsonArray jsonArray; 25 | 26 | public JsonNumber jsonNumber; 27 | 28 | public JsonString jsonString; 29 | 30 | public JsonValue jsonValue; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/CreatorIncompatibleTypePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbCreator; 16 | import java.io.Serializable; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class CreatorIncompatibleTypePojo { 22 | 23 | public String s1; 24 | 25 | @JsonbCreator 26 | public static Serializable getInstance() { 27 | return null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/test.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | //needed to be able to read all files including META-INF entries 3 | permission "java.io.FilePermission" "<>", "read"; 4 | 5 | permission "java.lang.reflect.ReflectPermission" "suppressAccessChecks"; 6 | permission "java.lang.RuntimePermission" "accessDeclaredMembers"; 7 | 8 | permission "java.lang.RuntimePermission" "createSecurityManager"; 9 | permission java.lang.RuntimePermission "setSecurityManager"; 10 | permission "java.lang.RuntimePermission" "getProtectionDomain"; 11 | permission "java.lang.RuntimePermission" "getClassLoader"; 12 | permission "java.util.PropertyPermission" "*", "write"; 13 | 14 | permission "java.util.PropertyPermission" "jsonb.creator-parameters-required", "read"; 15 | permission "java.util.PropertyPermission" "yasson.time-in-millis-as-a-string", "read"; 16 | permission "java.util.PropertyPermission" "jakarta.json.provider", "read"; 17 | }; -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/JsonBindingProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson; 14 | 15 | import jakarta.json.bind.JsonbBuilder; 16 | import jakarta.json.bind.spi.JsonbProvider; 17 | 18 | import org.eclipse.yasson.internal.JsonBindingBuilder; 19 | 20 | /** 21 | * JsonbProvider implementation. 22 | */ 23 | public class JsonBindingProvider extends JsonbProvider { 24 | 25 | @Override 26 | public JsonbBuilder create() { 27 | return new JsonBindingBuilder(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/ImplementationClassPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import org.eclipse.yasson.ImplementationClass; 16 | 17 | public class ImplementationClassPojo { 18 | 19 | @ImplementationClass(Dog.class) 20 | private Animal animal; 21 | 22 | public Animal getAnimal() { 23 | return animal; 24 | } 25 | 26 | public void setAnimal(Animal animal) { 27 | this.animal = animal; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | import jakarta.json.bind.annotation.JsonbCreator; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | 18 | public record CarWithMultipleConstructorsAndCreator(String type, String color) { 19 | 20 | @JsonbCreator 21 | public CarWithMultipleConstructorsAndCreator(@JsonbProperty("type") String type) { 22 | this(type, "red"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InheritsNillableRecursion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | import static java.lang.annotation.ElementType.*; 20 | 21 | @InheritsNillable 22 | @Retention(RetentionPolicy.RUNTIME) 23 | @Target({ANNOTATION_TYPE, TYPE, PACKAGE}) 24 | public @interface InheritsNillableRecursion { 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/records/CarWithCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.records; 14 | 15 | import jakarta.json.bind.annotation.JsonbCreator; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | 18 | public record CarWithCreator(String type, String color) { 19 | 20 | @JsonbCreator 21 | public static CarWithCreator create(@JsonbProperty("type") String type, @JsonbProperty("color") String color) { 22 | return new CarWithCreator(type, color); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/ReturnNullAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | 17 | public class ReturnNullAdapter implements JsonbAdapter { 18 | @Override 19 | public String adaptToJson(Number obj) throws Exception { 20 | return null; 21 | } 22 | 23 | @Override 24 | public Number adaptFromJson(String obj) throws Exception { 25 | return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/FieldSpecificOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbPropertyOrder; 16 | 17 | /** 18 | * @author David Kral 19 | */ 20 | @JsonbPropertyOrder({"aField", "dField"}) 21 | public class FieldSpecificOrder { 22 | 23 | public String aField = "aValue"; 24 | public String dField = "dValue"; 25 | public String bField = "bValue"; 26 | public String cField = "cValue"; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableOverridesClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | @JsonbNillable 22 | public class JsonbNillableOverridesClass extends JsonbNillableOverridesInterface { 23 | @JsonbProperty("overridesNillableInParent") 24 | public String nillableField; 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/Circle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class Circle extends Shape { 19 | public Double radius; 20 | 21 | public Circle() { 22 | super(); 23 | } 24 | 25 | public Double getRadius() { 26 | return radius; 27 | } 28 | 29 | public void setRadius(double radius) { 30 | this.radius = radius; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/lambda/Cat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.lambda; 14 | 15 | /** 16 | * Class used to control serialization of lambda expression generated from functional interfaces with defaults. 17 | */ 18 | public class Cat implements Pet { 19 | 20 | private String name; 21 | 22 | Cat(String name) { 23 | this.name = name; 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return this.name; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/FieldOrderNameAnnotation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | 17 | /** 18 | * @author David Kral 19 | */ 20 | public class FieldOrderNameAnnotation { 21 | 22 | @JsonbProperty(value = "zField") 23 | public String aField = "aValue"; 24 | public String dField = "dValue"; 25 | public String bField = "bValue"; 26 | public String cField = "cValue"; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/GenericPropertyPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeSerializer; 16 | 17 | @JsonbTypeSerializer(GenericPropertyPojoSerializer.class) 18 | public class GenericPropertyPojo { 19 | private T property; 20 | 21 | public T getProperty() { 22 | return property; 23 | } 24 | 25 | public void setProperty(T property) { 26 | this.property = property; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/FieldCustomOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbPropertyOrder; 16 | 17 | /** 18 | * @author David Kral 19 | */ 20 | @JsonbPropertyOrder({"aField", "cField", "dField" ,"bField"}) 21 | public class FieldCustomOrder { 22 | 23 | public String aField = "aValue"; 24 | public String dField = "dValue"; 25 | public String bField = "bValue"; 26 | public String cField = "cValue"; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ClassLevelDateAnnotationParent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.LocalDateTime; 17 | import java.util.Date; 18 | 19 | /** 20 | * @author Roman Grigoriadi 21 | */ 22 | @JsonbDateFormat("dd-MM-yyyy HH:mm:ss") 23 | public class ClassLevelDateAnnotationParent { 24 | 25 | public Date date; 26 | 27 | public LocalDateTime localDateTime; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/lambda/Robot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.lambda; 14 | 15 | /** 16 | * Class used to control serialization of lambda expression generated from functional interfaces with no defaults. 17 | */ 18 | public class Robot implements Addressable { 19 | 20 | private String name; 21 | 22 | Robot(String name) { 23 | this.name = name; 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return this.name; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/AnnotatedGenericWithSerializerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeDeserializer; 16 | import jakarta.json.bind.annotation.JsonbTypeSerializer; 17 | 18 | @JsonbTypeSerializer(AnnotatedGenericWithSerializerTypeSerializer.class) 19 | @JsonbTypeDeserializer(AnnotatedGenericWithSerializerTypeDeserializer.class) 20 | public class AnnotatedGenericWithSerializerType { 21 | 22 | public T value; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/ByteDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | /** 16 | * Deserializer of the {@link Byte} type. 17 | */ 18 | class ByteDeserializer extends AbstractNumberDeserializer { 19 | 20 | ByteDeserializer(TypeDeserializerBuilder builder) { 21 | super(builder, true); 22 | } 23 | 24 | @Override 25 | Byte parseNumberValue(String value) { 26 | return Byte.parseByte(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/BoundedGenericClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.util.List; 16 | import java.util.Set; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class BoundedGenericClass, U> { 22 | public List upperBoundedList; 23 | public List lowerBoundedList; 24 | public T boundedSet; 25 | 26 | public BoundedGenericClass() { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/FloatDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | /** 16 | * Deserializer of the {@link Float} type. 17 | */ 18 | class FloatDeserializer extends AbstractNumberDeserializer { 19 | 20 | FloatDeserializer(TypeDeserializerBuilder builder) { 21 | super(builder, false); 22 | } 23 | 24 | @Override 25 | Float parseNumberValue(String value) { 26 | return Float.parseFloat(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/ShortDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | /** 16 | * Deserializer of the {@link Short} type. 17 | */ 18 | class ShortDeserializer extends AbstractNumberDeserializer { 19 | 20 | ShortDeserializer(TypeDeserializerBuilder builder) { 21 | super(builder, true); 22 | } 23 | 24 | @Override 25 | Short parseNumberValue(String value) { 26 | return Short.parseShort(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/CollectionsWithFormatters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import java.util.List; 16 | 17 | import jakarta.json.bind.annotation.JsonbNumberFormat; 18 | 19 | @JsonbNumberFormat(value = "000.000", locale = "en-us") 20 | public class CollectionsWithFormatters { 21 | 22 | public List doubleList; 23 | 24 | @JsonbNumberFormat(locale = "da-da") 25 | public List doubleList2; 26 | 27 | public List doubleList3; 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/DateWithZonePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import java.util.Date; 16 | 17 | /** 18 | * @author Dennis Kriechel 19 | */ 20 | public class DateWithZonePojo extends AbstractDateTimePojo { 21 | 22 | public DateWithZonePojo() { 23 | } 24 | 25 | public DateWithZonePojo(Date dateObj) { 26 | super(dateObj); 27 | this.dateWithZone = dateObj; 28 | } 29 | 30 | public Date dateWithZone; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoAbsImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public abstract class InterfacedPojoAbsImpl implements InterfacedPojoA { 19 | 20 | private String propertyA; 21 | 22 | @Override 23 | public String getPropertyA() { 24 | return propertyA; 25 | } 26 | 27 | @Override 28 | public void setPropertyA(String property) { 29 | this.propertyA = property; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/TreeContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 Red Hat, Inc. and/or its affiliates. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author James R. Perkins 17 | */ 18 | public class TreeContainer> { 19 | 20 | private TreeTypeContainer tree; 21 | 22 | public TreeTypeContainer getTree() { 23 | return tree; 24 | } 25 | 26 | public void setTree(final TreeTypeContainer tree) { 27 | this.tree = tree; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/DoubleDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | /** 16 | * Deserializer of the {@link Double} type. 17 | */ 18 | class DoubleDeserializer extends AbstractNumberDeserializer { 19 | 20 | DoubleDeserializer(TypeDeserializerBuilder builder) { 21 | super(builder, false); 22 | } 23 | 24 | @Override 25 | Double parseNumberValue(String value) { 26 | return Double.parseDouble(value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/AnnotatedWithSerializerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeDeserializer; 16 | import jakarta.json.bind.annotation.JsonbTypeSerializer; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | @JsonbTypeSerializer(AnnotatedWithSerializerTypeSerializer.class) 22 | @JsonbTypeDeserializer(AnnotatedWithSerializerTypeDeserializer.class) 23 | public class AnnotatedWithSerializerType { 24 | 25 | public String value; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/Dog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | public class Dog implements Animal { 16 | 17 | private String dogProperty; 18 | 19 | public Dog() { 20 | } 21 | 22 | public Dog(String dogProperty) { 23 | this.dogProperty = dogProperty; 24 | } 25 | 26 | public String getDogProperty() { 27 | return dogProperty; 28 | } 29 | 30 | public void setDogProperty(String dogProperty) { 31 | this.dogProperty = dogProperty; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InterfacedPojoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class InterfacedPojoImpl extends InterfacedPojoAbsImpl implements InterfacedPojoB { 19 | 20 | private String propertyB; 21 | 22 | @Override 23 | public String getPropertyB() { 24 | return propertyB; 25 | } 26 | 27 | @Override 28 | public void setPropertyB(String propertyB) { 29 | this.propertyB = propertyB; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/LongSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | /** 18 | * Serializer of the {@link Long} type. 19 | */ 20 | class LongSerializer extends AbstractNumberSerializer { 21 | 22 | LongSerializer(TypeSerializerBuilder builder) { 23 | super(builder); 24 | } 25 | 26 | @Override 27 | void writeValue(Long value, JsonGenerator generator) { 28 | generator.write(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/NumberAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | 17 | public class NumberAdapter implements JsonbAdapter { 18 | @Override 19 | public String adaptToJson(Number obj) throws Exception { 20 | return Integer.valueOf(((Integer)obj) + 1).toString(); 21 | } 22 | 23 | @Override 24 | public Number adaptFromJson(String obj) throws Exception { 25 | return Integer.parseInt(obj) - 1; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/ByteSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | /** 18 | * Serializer of the {@link Byte} type. 19 | */ 20 | class ByteSerializer extends AbstractNumberSerializer { 21 | 22 | ByteSerializer(TypeSerializerBuilder builder) { 23 | super(builder); 24 | } 25 | 26 | @Override 27 | void writeValue(Byte value, JsonGenerator generator) { 28 | generator.write(value); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/DoubleSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | /** 18 | * Serializer of the {@link Double} type. 19 | */ 20 | class DoubleSerializer extends AbstractNumberSerializer { 21 | 22 | DoubleSerializer(TypeSerializerBuilder builder) { 23 | super(builder); 24 | } 25 | 26 | @Override 27 | void writeValue(Double value, JsonGenerator generator) { 28 | generator.write(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/ShortSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | /** 18 | * Serializer of the {@link Short} type. 19 | */ 20 | class ShortSerializer extends AbstractNumberSerializer { 21 | 22 | ShortSerializer(TypeSerializerBuilder builder) { 23 | super(builder); 24 | } 25 | 26 | @Override 27 | void writeValue(Short value, JsonGenerator generator) { 28 | generator.write(value); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/WildcardMultipleBoundsClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.io.Serializable; 16 | import java.util.List; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class WildcardMultipleBoundsClass> { 22 | 23 | public T wildcardField; 24 | 25 | public GenericTestClass genericTestClassPropagatedWildCard; 26 | 27 | public List propagatedWildcardList; 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/SecondLevelGeneric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class SecondLevelGeneric extends FirstLevelGeneric { 19 | 20 | private S inSecondLevel; 21 | 22 | public S getInSecondLevel() { 23 | return inSecondLevel; 24 | } 25 | 26 | public void setInSecondLevel(S inSecondLevel) { 27 | this.inSecondLevel = inSecondLevel; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/NumberSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | import jakarta.json.bind.serializer.SerializationContext; 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | public class NumberSerializer implements JsonbSerializer { 20 | @Override 21 | public void serialize(Number obj, JsonGenerator generator, SerializationContext ctx) { 22 | generator.write(Integer.valueOf(obj.intValue() + 1).toString()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InheritsNillable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.RetentionPolicy; 18 | import java.lang.annotation.Target; 19 | 20 | import static java.lang.annotation.ElementType.*; 21 | 22 | @JsonbNillable() 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Target({ANNOTATION_TYPE, TYPE, PACKAGE}) 25 | public @interface InheritsNillable { 26 | String value() default "abc"; 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/specific/model/OptionalWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.specific.model; 14 | 15 | import java.util.Optional; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class OptionalWrapper { 21 | 22 | private Optional streetOptional; 23 | 24 | public Optional getStreetOptional() { 25 | return streetOptional; 26 | } 27 | 28 | public void setStreetOptional(Optional streetOptional) { 29 | this.streetOptional = streetOptional; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/MockJndiContextFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import javax.naming.Context; 16 | import javax.naming.NamingException; 17 | import javax.naming.spi.InitialContextFactory; 18 | import java.util.Hashtable; 19 | 20 | /** 21 | * @author Roman Grigoriadi 22 | */ 23 | public class MockJndiContextFactory implements InitialContextFactory { 24 | @Override 25 | public Context getInitialContext(Hashtable environment) throws NamingException { 26 | return new MockJndiContext(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/NonCdiAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | public class NonCdiAdapter implements JsonbAdapter { 21 | @Override 22 | public Integer adaptToJson(String obj) throws Exception { 23 | return Integer.valueOf(obj); 24 | } 25 | 26 | @Override 27 | public String adaptFromJson(Integer obj) throws Exception { 28 | return String.valueOf(obj); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/IntegerSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | /** 18 | * Serializer of the {@link Integer} type. 19 | */ 20 | class IntegerSerializer extends AbstractNumberSerializer { 21 | 22 | IntegerSerializer(TypeSerializerBuilder builder) { 23 | super(builder); 24 | } 25 | 26 | @Override 27 | void writeValue(Integer value, JsonGenerator generator) { 28 | generator.write(value); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/ScalarValueWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class ScalarValueWrapper { 19 | 20 | private T value; 21 | 22 | public ScalarValueWrapper() { 23 | } 24 | 25 | public ScalarValueWrapper(T value) { 26 | this.value = value; 27 | } 28 | 29 | public T getValue() { 30 | return value; 31 | } 32 | 33 | public void setValue(T value) { 34 | this.value = value; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/AdaptedPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeAdapter; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | 21 | public class AdaptedPojo { 22 | 23 | @JsonbTypeAdapter(CdiDependentAdapter.class) 24 | public String adaptedValue1 = "1111"; 25 | 26 | @JsonbTypeAdapter(CdiDependentAdapter.class) 27 | public String adaptedValue2 = "1001"; 28 | 29 | @JsonbTypeAdapter(NonCdiAdapter.class) 30 | public String adaptedValue3 = "1010"; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/MockInjectionTargetFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import jakarta.enterprise.inject.spi.Bean; 16 | import jakarta.enterprise.inject.spi.InjectionTarget; 17 | import jakarta.enterprise.inject.spi.InjectionTargetFactory; 18 | 19 | /** 20 | * TODO javadoc 21 | */ 22 | public class MockInjectionTargetFactory implements InjectionTargetFactory { 23 | @Override 24 | public InjectionTarget createInjectionTarget(Bean bean) { 25 | return (InjectionTarget) new MockInjectionTarget(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/BoxWithAnnotations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeDeserializer; 16 | import jakarta.json.bind.annotation.JsonbTypeSerializer; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class BoxWithAnnotations { 22 | 23 | public String boxStr; 24 | 25 | @JsonbTypeSerializer(CrateSerializerWithConversion.class) 26 | @JsonbTypeDeserializer(CrateDeserializer.class) 27 | public Crate crate; 28 | 29 | 30 | public String secondBoxStr; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/BigDecimalDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.math.BigDecimal; 16 | 17 | /** 18 | * Deserializer of the {@link BigDecimal} type. 19 | */ 20 | class BigDecimalDeserializer extends AbstractNumberDeserializer { 21 | 22 | BigDecimalDeserializer(TypeDeserializerBuilder builder) { 23 | super(builder, false); 24 | } 25 | 26 | @Override 27 | BigDecimal parseNumberValue(String value) { 28 | return new BigDecimal(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/BigIntegerDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.math.BigInteger; 16 | 17 | /** 18 | * Deserializer of the {@link BigInteger} type. 19 | */ 20 | class BigIntegerDeserializer extends AbstractNumberDeserializer { 21 | 22 | BigIntegerDeserializer(TypeDeserializerBuilder builder) { 23 | super(builder, true); 24 | } 25 | 26 | @Override 27 | BigInteger parseNumberValue(String value) { 28 | return new BigInteger(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/SerializableAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.adapter.JsonbAdapter; 16 | import java.io.Serializable; 17 | 18 | public class SerializableAdapter implements JsonbAdapter { 19 | @Override 20 | public Integer adaptToJson(Serializable obj) throws Exception { 21 | return Integer.valueOf(obj.toString()) + 1; 22 | } 23 | 24 | @Override 25 | public Serializable adaptFromJson(Integer obj) throws Exception { 26 | return obj - 1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/DatePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.util.Date; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class DatePojo extends AbstractDateTimePojo { 22 | 23 | public DatePojo() { 24 | } 25 | 26 | public DatePojo(Date dateObj) { 27 | super(dateObj); 28 | this.customDate = dateObj; 29 | } 30 | 31 | @JsonbDateFormat("HH:mm:ss | dd-MM-yyyy") 32 | public Date customDate; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/CrateInner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | import java.math.BigDecimal; 18 | import java.util.Date; 19 | 20 | /** 21 | * @author Roman Grigoriadi 22 | */ 23 | @JsonbDateFormat("dd.MM.yyyy || HH:mm:ss") 24 | public class CrateInner { 25 | 26 | @JsonbProperty("crate_inner_str") 27 | public String crateInnerStr; 28 | 29 | public BigDecimal crateInnerBigDec; 30 | 31 | public Date date; 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/NumberDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.serializer.DeserializationContext; 16 | import jakarta.json.bind.serializer.JsonbDeserializer; 17 | import jakarta.json.stream.JsonParser; 18 | import java.lang.reflect.Type; 19 | 20 | public class NumberDeserializer implements JsonbDeserializer { 21 | @Override 22 | public Number deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { 23 | return Integer.valueOf(parser.getString()) - 1; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/SimpleContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /* 14 | * $Id$ 15 | */ 16 | 17 | package org.eclipse.yasson.serializers.model; 18 | 19 | 20 | 21 | public class SimpleContainer { 22 | private String instance = "Test"; 23 | 24 | public SimpleContainer() { 25 | } 26 | 27 | public SimpleContainer(String instance) { 28 | this.instance = instance; 29 | } 30 | 31 | public String getInstance() { 32 | return instance; 33 | } 34 | 35 | public void setInstance(String instance) { 36 | this.instance = instance; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/StringPaddingSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | import jakarta.json.bind.serializer.SerializationContext; 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | /** 20 | * @author Roman Grigoriadi 21 | */ 22 | public class StringPaddingSerializer implements JsonbSerializer { 23 | @Override 24 | public void serialize(String obj, JsonGenerator generator, SerializationContext ctx) { 25 | generator.write(" "+obj); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/model/ReverseTreeMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.model; 14 | 15 | import java.util.Comparator; 16 | import java.util.TreeMap; 17 | 18 | /** 19 | * TreeMap with a reverse ordering by default. 20 | * 21 | * @param comparable key 22 | * @param value 23 | */ 24 | public class ReverseTreeMap, V> extends TreeMap { 25 | 26 | /** 27 | * Default constructor of a TreeMap with reverse order. 28 | */ 29 | public ReverseTreeMap() { 30 | super(Comparator.reverseOrder()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/FirstNameAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.Json; 16 | import jakarta.json.JsonValue; 17 | import jakarta.json.bind.adapter.JsonbAdapter; 18 | 19 | public class FirstNameAdapter implements JsonbAdapter { 20 | @Override 21 | public JsonValue adaptToJson(String firstName) { 22 | return Json.createValue(firstName.subSequence(0,1).toString()); 23 | } 24 | @Override 25 | public String adaptFromJson(JsonValue json) { 26 | return json.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableClassFirstLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * Implements a class with nillable annotation. 17 | * 18 | * @author Roman Grigoriadi 19 | */ 20 | public class JsonbNillableClassFirstLevel implements JsonbNillableInterfaceBaseOne { 21 | 22 | private String classNillable; 23 | 24 | public String getClassNillable() { 25 | return classNillable; 26 | } 27 | 28 | public void setClassNillable(String classNillable) { 29 | this.classNillable = classNillable; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /yasson-jmh/src/main/java/org/eclipse/yasson/jmh/TenPropertySerializationTest.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.yasson.jmh; 2 | 3 | import org.eclipse.yasson.jmh.model.TenPropertyData; 4 | import org.openjdk.jmh.annotations.*; 5 | 6 | import jakarta.json.bind.*; 7 | import java.util.List; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | /** 11 | * Test for serializing a pojo with 10 properties 12 | */ 13 | @BenchmarkMode(Mode.Throughput) 14 | @Timeout(time = 20) 15 | @State(Scope.Benchmark) 16 | @Warmup(iterations = 3) 17 | @OutputTimeUnit(TimeUnit.MILLISECONDS) 18 | public class TenPropertySerializationTest { 19 | private Jsonb json; 20 | private TenPropertyData testData; 21 | 22 | @Setup 23 | public void setup() { 24 | json = JsonbBuilder.create(); 25 | testData = new TenPropertyData("prop1", "prop2", 42, 3.14, new String[] {"props", "propsss", "psssss"}, 26 | List.of(5, 1, 3), "prop7", 800, new int[] {5555, 6666, 7777, 8888}, Long.MAX_VALUE); 27 | } 28 | 29 | @Benchmark 30 | public String testSerialize() { 31 | return json.toJson(testData); 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/InstantPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.Instant; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class InstantPojo extends AbstractDateTimePojo { 22 | 23 | public InstantPojo() { 24 | } 25 | 26 | public InstantPojo(Instant dateObj) { 27 | super(dateObj); 28 | this.instant = dateObj; 29 | } 30 | 31 | @JsonbDateFormat("HH:mm:ss | dd-MM-yyyy") 32 | public Instant instant; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalTimePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.LocalTime; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class LocalTimePojo extends AbstractDateTimePojo { 22 | 23 | public LocalTimePojo() { 24 | } 25 | 26 | public LocalTimePojo(LocalTime date) { 27 | super(date); 28 | this.localTime = date; 29 | } 30 | 31 | @JsonbDateFormat("HH:mm:ss") 32 | public LocalTime localTime; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/FooSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | import jakarta.json.bind.serializer.SerializationContext; 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | public class FooSerializer implements JsonbSerializer{ 20 | 21 | @Override 22 | public void serialize(Foo obj, JsonGenerator generator, SerializationContext ctx) { 23 | generator.writeStartObject(); 24 | generator.write("bar", obj.getBar()); 25 | generator.writeEnd(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/MultipleBoundsContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /* 14 | * $Id$ 15 | */ 16 | 17 | package org.eclipse.yasson.defaultmapping.generics.model; 18 | 19 | import java.util.List; 20 | import java.util.Queue; 21 | 22 | public class MultipleBoundsContainer implements TypeContainer> { 23 | protected List instance; 24 | 25 | @Override 26 | public List getInstance() { 27 | return instance; 28 | } 29 | 30 | @Override 31 | public void setInstance(List instance) { 32 | this.instance = instance; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PartialOverride.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model; 14 | 15 | /** 16 | * Bias property is not readable by putting field and getter in other class than setter. 17 | * 18 | * @author Roman Grigoriadi 19 | */ 20 | public class PartialOverride extends PartialOverrideBase { 21 | 22 | @Override 23 | public void setIntValue(int intValue) { 24 | super.setIntValue(intValue); 25 | } 26 | 27 | @Override 28 | public void setStrValue(String strValue) { 29 | super.setStrValue(strValue); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/Hello1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import jakarta.enterprise.inject.Default; 16 | import jakarta.inject.Qualifier; 17 | import java.lang.annotation.ElementType; 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.RetentionPolicy; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * @author Roman Grigoriadi 24 | */ 25 | @Default 26 | @Qualifier 27 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface Hello1 { 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/internal/cdi/Hello2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.cdi; 14 | 15 | import jakarta.enterprise.inject.Default; 16 | import jakarta.inject.Qualifier; 17 | import java.lang.annotation.ElementType; 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.RetentionPolicy; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * @author Roman Grigoriadi 24 | */ 25 | @Default 26 | @Qualifier 27 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface Hello2 { 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/UUIDMapperClsBased.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import java.util.Optional; 16 | import java.util.UUID; 17 | 18 | public class UUIDMapperClsBased extends MultilevelAdapterClass { 19 | 20 | @Override 21 | public String adaptToJson(UUID obj) throws Exception { 22 | return Optional.ofNullable(obj).map(UUID::toString).orElse(null); 23 | } 24 | 25 | @Override 26 | public UUID adaptFromJson(String obj) throws Exception { 27 | return Optional.ofNullable(obj).map(UUID::fromString).orElse(null); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/UUIDMapperIfcBased.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import java.util.Optional; 16 | import java.util.UUID; 17 | 18 | public class UUIDMapperIfcBased implements MultiinterfaceAdapter { 19 | 20 | @Override 21 | public String adaptToJson(UUID obj) throws Exception { 22 | return Optional.ofNullable(obj).map(UUID::toString).orElse(null); 23 | } 24 | 25 | @Override 26 | public UUID adaptFromJson(String obj) throws Exception { 27 | return Optional.ofNullable(obj).map(UUID::fromString).orElse(null); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/anonymous/OuterPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.anonymous; 14 | 15 | /** 16 | * Test class. 17 | * 18 | * @author Dmitry Kornilov 19 | */ 20 | public class OuterPojo { 21 | private Integer id = 1; 22 | private String name; 23 | 24 | public Integer getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Integer id) { 29 | this.id = id; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | public void setName(String name) { 37 | this.name = name; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalDatePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.LocalDate; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class LocalDatePojo extends AbstractDateTimePojo { 22 | 23 | public LocalDatePojo() { 24 | } 25 | 26 | public LocalDatePojo(LocalDate date) { 27 | super(date); 28 | this.customLocalDate = date; 29 | } 30 | 31 | @JsonbDateFormat("dd-MM-yyyy") 32 | public LocalDate customLocalDate; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/OffsetTimePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.OffsetTime; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class OffsetTimePojo extends AbstractDateTimePojo { 22 | 23 | public OffsetTimePojo() { 24 | } 25 | 26 | public OffsetTimePojo(OffsetTime date) { 27 | super(date); 28 | this.offsetTime = date; 29 | } 30 | 31 | @JsonbDateFormat("HH:mm:ssZ") 32 | public OffsetTime offsetTime; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/BigDecimalSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.math.BigDecimal; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | /** 20 | * Serializer of the {@link BigDecimal} type. 21 | */ 22 | class BigDecimalSerializer extends AbstractNumberSerializer { 23 | 24 | BigDecimalSerializer(TypeSerializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @Override 29 | void writeValue(BigDecimal value, JsonGenerator generator) { 30 | generator.write(value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/BigIntegerSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.math.BigInteger; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | /** 20 | * Serializer of the {@link BigInteger} type. 21 | */ 22 | class BigIntegerSerializer extends AbstractNumberSerializer { 23 | 24 | BigIntegerSerializer(TypeSerializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @Override 29 | void writeValue(BigInteger value, JsonGenerator generator) { 30 | generator.write(value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/JsonbNillablePackageLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model.packagelevelannotations; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class JsonbNillablePackageLevel { 19 | 20 | private String packageLevelNillableField; 21 | 22 | public String getPackageLevelNillableField() { 23 | return packageLevelNillableField; 24 | } 25 | 26 | public void setPackageLevelNillableField(String packageLevelNillableField) { 27 | this.packageLevelNillableField = packageLevelNillableField; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/jsonstructure/InnerPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.jsonstructure; 14 | 15 | public final class InnerPojo { 16 | private String innerFirst; 17 | private String innerSecond; 18 | 19 | public String getInnerFirst() { 20 | return innerFirst; 21 | } 22 | 23 | public void setInnerFirst(String innerFirst) { 24 | this.innerFirst = innerFirst; 25 | } 26 | 27 | public String getInnerSecond() { 28 | return innerSecond; 29 | } 30 | 31 | public void setInnerSecond(String innerSecond) { 32 | this.innerSecond = innerSecond; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/NumberSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.math.BigDecimal; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | /** 20 | * Serializer of the {@link Number} type. 21 | */ 22 | class NumberSerializer extends AbstractNumberSerializer { 23 | 24 | NumberSerializer(TypeSerializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @Override 29 | void writeValue(Number value, JsonGenerator generator) { 30 | generator.write(new BigDecimal(String.valueOf(value))); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/InheritsJsonbProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | import java.lang.annotation.ElementType; 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.RetentionPolicy; 19 | import java.lang.annotation.Target; 20 | 21 | @JsonbProperty("renamedProperty") 22 | @Retention(RetentionPolicy.RUNTIME) 23 | @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) 24 | public @interface InheritsJsonbProperty { 25 | String value() default "abc"; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableClassSecondLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | /** 16 | * Extends a class which implements interface which is nillable. 17 | * 18 | * @author Roman Grigoriadi 19 | */ 20 | public class JsonbNillableClassSecondLevel extends JsonbNillableClassFirstLevel { 21 | 22 | private String subclassNillable; 23 | 24 | public String getSubclassNillable() { 25 | return subclassNillable; 26 | } 27 | 28 | public void setSubclassNillable(String subclassNillable) { 29 | this.subclassNillable = subclassNillable; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/CalendarPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.util.Calendar; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class CalendarPojo extends AbstractDateTimePojo { 22 | 23 | public CalendarPojo() { 24 | } 25 | 26 | public CalendarPojo(Calendar dateObj) { 27 | super(dateObj); 28 | this.customCalendar = dateObj; 29 | } 30 | 31 | @JsonbDateFormat("HH:mm:ss | dd-MM-yyyy, Z") 32 | public Calendar customCalendar; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/basic/model/BigDecimalInNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.basic.model; 14 | 15 | /** 16 | * Encapsulates Number type of field so the serialization and deserialization of number can be tested 17 | * 18 | * @author David Kral 19 | */ 20 | public class BigDecimalInNumber { 21 | 22 | private Number bigDecValue; 23 | 24 | public BigDecimalInNumber(){ 25 | } 26 | 27 | public Number getBigDecValue() { 28 | return bigDecValue; 29 | } 30 | 31 | public void setBigDecValue(Number bigDecValue) { 32 | this.bigDecValue = bigDecValue; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/CharDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | 17 | import org.eclipse.yasson.internal.DeserializationContextImpl; 18 | 19 | /** 20 | * Deserializer of the {@link Character} type. 21 | */ 22 | class CharDeserializer extends TypeDeserializer { 23 | 24 | CharDeserializer(TypeDeserializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @Override 29 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 30 | return value.charAt(0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/JsonbNillableValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | @JsonbNillable 21 | public class JsonbNillableValue { 22 | 23 | private String nillableField; 24 | 25 | private String privateField; 26 | 27 | private static String staticField; 28 | 29 | public String getNillableField() { 30 | return nillableField; 31 | } 32 | 33 | public void setNillableField(String nillableField) { 34 | this.nillableField = nillableField; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/generics/AbstractZeroLevelGeneric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model.generics; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public abstract class AbstractZeroLevelGeneric { 19 | 20 | private Z inZero; 21 | 22 | protected ZF inZeroOverriddenInFirst; 23 | 24 | abstract ZF getInZeroOverriddenInFirst(); 25 | 26 | abstract void setInZeroOverriddenInFirst(ZF value); 27 | 28 | public Z getInZero() { 29 | return inZero; 30 | } 31 | 32 | public void setInZero(Z inZero) { 33 | this.inZero = inZero; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2024 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /** 14 | * Yasson, the implementation of the Jakarta JSON Binding. 15 | */ 16 | module org.eclipse.yasson { 17 | requires jakarta.json; 18 | requires jakarta.json.bind; 19 | requires java.logging; 20 | requires static java.xml; 21 | requires static java.naming; 22 | requires static java.sql; 23 | requires static java.desktop; 24 | requires static jakarta.cdi; 25 | 26 | exports org.eclipse.yasson; 27 | exports org.eclipse.yasson.spi; 28 | provides jakarta.json.bind.spi.JsonbProvider with org.eclipse.yasson.JsonBindingProvider; 29 | uses org.eclipse.yasson.spi.JsonbComponentInstanceCreator; 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/CreatorWithoutJavabeanProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbCreator; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class CreatorWithoutJavabeanProperty { 22 | 23 | private String strField; 24 | 25 | @JsonbCreator 26 | public CreatorWithoutJavabeanProperty(@JsonbProperty("s1") String s1, @JsonbProperty("s2") String s2) { 27 | this.strField = s1 + s2; 28 | } 29 | 30 | public String getStrField() { 31 | return strField; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/transients/models/TransientGetterPlusCustomizationAnnotatedFieldContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.transients.models; 14 | 15 | import jakarta.json.bind.annotation.JsonbProperty; 16 | import jakarta.json.bind.annotation.JsonbTransient; 17 | 18 | public class TransientGetterPlusCustomizationAnnotatedFieldContainer { 19 | @JsonbProperty("instance") 20 | private String instance; 21 | 22 | @JsonbTransient 23 | public String getInstance() { 24 | return instance; 25 | } 26 | 27 | public void setInstance(String instance) { 28 | this.instance = instance; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/basic/model/BooleanModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.basic.model; 14 | 15 | /** 16 | * Encapsulates different types of boolean values as a field so that the boolean value's serialization and 17 | * deserialization could be tested. 18 | * 19 | * @author Ehsan Zaery Moghaddam (zaerymoghaddam@gmail.com) 20 | */ 21 | public class BooleanModel { 22 | public Boolean field1; 23 | public boolean field2; 24 | 25 | public BooleanModel() { 26 | } 27 | 28 | public BooleanModel(boolean field1, Boolean field2) { 29 | this.field2 = field2; 30 | this.field1 = field1; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/LocalDateTimePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.LocalDateTime; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class LocalDateTimePojo extends AbstractDateTimePojo { 22 | 23 | public LocalDateTimePojo() { 24 | } 25 | 26 | public LocalDateTimePojo(LocalDateTime date) { 27 | super(date); 28 | this.customLocalDate = date; 29 | } 30 | 31 | @JsonbDateFormat("dd-MM-yyyy--ss:mm:HH") 32 | public LocalDateTime customLocalDate; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/OffsetDateTimePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.OffsetDateTime; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class OffsetDateTimePojo extends AbstractDateTimePojo { 22 | 23 | public OffsetDateTimePojo() { 24 | } 25 | 26 | public OffsetDateTimePojo(OffsetDateTime date) { 27 | super(date); 28 | this.offsetDateTime = date; 29 | } 30 | 31 | @JsonbDateFormat("Z dd-MM-yyyy--ss:mm:HH") 32 | public OffsetDateTime offsetDateTime; 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ZonedDateTimePojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.ZonedDateTime; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class ZonedDateTimePojo extends AbstractDateTimePojo { 22 | 23 | public ZonedDateTimePojo() { 24 | } 25 | 26 | public ZonedDateTimePojo(ZonedDateTime date) { 27 | super(date); 28 | this.customZonedDate = date; 29 | } 30 | 31 | @JsonbDateFormat("XVV | dd-MM-yyyy--ss:mm:HH") 32 | public ZonedDateTime customZonedDate; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/UriDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.net.URI; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link URI} type. 22 | */ 23 | class UriDeserializer extends TypeDeserializer { 24 | 25 | UriDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return URI.create(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/serializers/model/ContaineeSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.serializers.model; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | import jakarta.json.bind.serializer.SerializationContext; 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | public class ContaineeSerializer implements JsonbSerializer { 20 | 21 | @Override 22 | public void serialize(Containee obj, JsonGenerator generator, SerializationContext ctx) { 23 | generator.writeStartObject(); 24 | generator.write("key", obj.key); 25 | generator.write("value", obj.value); 26 | generator.writeEnd(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/UuidDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.util.UUID; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link UUID} type. 22 | */ 23 | class UuidDeserializer extends TypeDeserializer { 24 | 25 | UuidDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return UUID.fromString(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/BooleanSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | import org.eclipse.yasson.internal.SerializationContextImpl; 18 | 19 | /** 20 | * Serializer of the {@link Boolean} type. 21 | */ 22 | class BooleanSerializer extends TypeSerializer { 23 | 24 | BooleanSerializer(TypeSerializerBuilder serializerBuilder) { 25 | super(serializerBuilder); 26 | } 27 | 28 | @Override 29 | void serializeValue(Boolean value, JsonGenerator generator, SerializationContextImpl context) { 30 | generator.write(value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/ZoneIdDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.time.ZoneId; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link ZoneId} type. 22 | */ 23 | class ZoneIdDeserializer extends TypeDeserializer { 24 | 25 | ZoneIdDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return ZoneId.of(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/CreatorMultipleDeclarationErrorPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbCreator; 16 | import jakarta.json.bind.annotation.JsonbProperty; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class CreatorMultipleDeclarationErrorPojo { 22 | 23 | public String s1; 24 | 25 | @JsonbCreator 26 | public CreatorMultipleDeclarationErrorPojo(@JsonbProperty("val1") String s1) { 27 | this.s1 = s1; 28 | } 29 | 30 | @JsonbCreator 31 | public static CreatorMultipleDeclarationErrorPojo getInstance() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PartialOverrideBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class PartialOverrideBase { 19 | 20 | private int intValue; 21 | private String strValue; 22 | 23 | public int getIntValue() { 24 | return intValue; 25 | } 26 | 27 | public void setIntValue(int intValue) { 28 | this.intValue = intValue; 29 | } 30 | 31 | public String getStrValue() { 32 | return strValue; 33 | } 34 | 35 | public void setStrValue(String strValue) { 36 | this.strValue = strValue; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/PeriodDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.time.Period; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link Period} type. 22 | */ 23 | class PeriodDeserializer extends TypeDeserializer { 24 | 25 | PeriodDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return Period.parse(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/inheritance/model/PropertyOrderFirst.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.inheritance.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class PropertyOrderFirst extends PropertyOrderZero { 19 | 20 | private String first; 21 | 22 | public String getFirst() { 23 | return first; 24 | } 25 | 26 | public void setFirst(String first) { 27 | this.first = first; 28 | } 29 | 30 | @Override 31 | public void setZeroPartiallyOverriddenInFirst(String zeroPartiallyOverriddenInFirst) { 32 | super.setZeroPartiallyOverriddenInFirst(zeroPartiallyOverriddenInFirst); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/jsonstructure/InnerPojoSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.jsonstructure; 14 | 15 | import jakarta.json.bind.serializer.JsonbSerializer; 16 | import jakarta.json.bind.serializer.SerializationContext; 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | public class InnerPojoSerializer implements JsonbSerializer { 20 | 21 | @Override 22 | public void serialize(InnerPojo obj, JsonGenerator generator, SerializationContext ctx) { 23 | generator.writeStartObject(); 24 | generator.write("first", obj.getInnerFirst()); 25 | generator.write("second", obj.getInnerSecond()); 26 | generator.writeEnd(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/PathDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.nio.file.Paths; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link java.nio.file.Path} type. 22 | */ 23 | class PathDeserializer extends TypeDeserializer { 24 | 25 | PathDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return Paths.get(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/Author.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbTypeAdapter; 16 | 17 | public class Author { 18 | @JsonbTypeAdapter(FirstNameAdapter.class) 19 | private String firstName; 20 | private String lastName; 21 | 22 | public String getFirstName() { 23 | return firstName; 24 | } 25 | 26 | public void setFirstName(String firstName) { 27 | this.firstName = firstName; 28 | } 29 | 30 | public String getLastName() { 31 | return lastName; 32 | } 33 | 34 | public void setLastName(String lastName) { 35 | this.lastName = lastName; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/transients/models/TransientSetterPlusCustomizationAnnotatedFieldContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /* 14 | * $Id$ 15 | */ 16 | 17 | package org.eclipse.yasson.customization.transients.models; 18 | 19 | 20 | import jakarta.json.bind.annotation.JsonbProperty; 21 | import jakarta.json.bind.annotation.JsonbTransient; 22 | 23 | public class TransientSetterPlusCustomizationAnnotatedFieldContainer { 24 | @JsonbProperty("instance") 25 | private String instance; 26 | 27 | public String getInstance() { 28 | return instance; 29 | } 30 | 31 | @JsonbTransient 32 | public void setInstance(String instance) { 33 | this.instance = instance; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/dates/model/ClassLevelDateAnnotation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.dates.model; 14 | 15 | import jakarta.json.bind.annotation.JsonbDateFormat; 16 | import java.time.ZonedDateTime; 17 | import java.util.Calendar; 18 | 19 | /** 20 | * @author Roman Grigoriadi 21 | */ 22 | @JsonbDateFormat(value = "X z E MMMM dd-MM-yyyy HH:mm:ss", locale = "fr") 23 | public class ClassLevelDateAnnotation extends ClassLevelDateAnnotationParent { 24 | 25 | public ZonedDateTime zonedDateTime; 26 | 27 | public Calendar calendar; 28 | 29 | @JsonbDateFormat(value = JsonbDateFormat.DEFAULT_FORMAT) 30 | public ZonedDateTime defaultZoned; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/NumberDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.math.BigDecimal; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link Number} type. 22 | */ 23 | class NumberDeserializer extends TypeDeserializer { 24 | 25 | NumberDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return new BigDecimal(value); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/CharSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import jakarta.json.stream.JsonGenerator; 16 | 17 | import org.eclipse.yasson.internal.SerializationContextImpl; 18 | 19 | /** 20 | * Serializer of the {@link Character} type. 21 | */ 22 | class CharSerializer extends TypeSerializer { 23 | 24 | CharSerializer(TypeSerializerBuilder serializerBuilder) { 25 | super(serializerBuilder); 26 | } 27 | 28 | @Override 29 | void serializeValue(Character value, JsonGenerator generator, SerializationContextImpl context) { 30 | generator.write(String.valueOf(value)); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/FloatSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.math.BigDecimal; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | /** 20 | * Serializer of the {@link Float} type. 21 | */ 22 | class FloatSerializer extends AbstractNumberSerializer { 23 | 24 | FloatSerializer(TypeSerializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @Override 29 | void writeValue(Float value, JsonGenerator generator) { 30 | //floats lose precision, after upcasting to doubles in jsonp 31 | generator.write(new BigDecimal(String.valueOf(value))); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/LowerBoundTypeVariableWithCollectionAttributeClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | import java.util.Collection; 16 | 17 | /** 18 | * @author Alessandro Moscatelli 19 | */ 20 | public class LowerBoundTypeVariableWithCollectionAttributeClass { 21 | 22 | private Collection> value; 23 | 24 | public Collection> getValue() { 25 | return value; 26 | } 27 | 28 | public void setValue(Collection> value) { 29 | this.value = value; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/ImplementationClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson; 14 | 15 | import java.lang.annotation.ElementType; 16 | import java.lang.annotation.Retention; 17 | import java.lang.annotation.RetentionPolicy; 18 | import java.lang.annotation.Target; 19 | 20 | /** 21 | * Marks an interface with implementation class, which should be used for deserialiation. 22 | */ 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Target({ElementType.FIELD, ElementType.METHOD}) 25 | public @interface ImplementationClass { 26 | 27 | /** 28 | * Class, which will be used as implementation for annotated member. 29 | * 30 | * @return Serializaer to use. 31 | */ 32 | Class value(); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/EnumDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | 17 | import org.eclipse.yasson.internal.DeserializationContextImpl; 18 | 19 | /** 20 | * Deserializer of the {@link Enum}. 21 | */ 22 | class EnumDeserializer extends TypeDeserializer { 23 | 24 | EnumDeserializer(TypeDeserializerBuilder builder) { 25 | super(builder); 26 | } 27 | 28 | @SuppressWarnings("unchecked") 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return Enum.valueOf((Class) rType, value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/UriSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.net.URI; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | import org.eclipse.yasson.internal.SerializationContextImpl; 20 | 21 | /** 22 | * Serializer of the {@link URI} type. 23 | */ 24 | class UriSerializer extends TypeSerializer { 25 | 26 | UriSerializer(TypeSerializerBuilder serializerBuilder) { 27 | super(serializerBuilder); 28 | } 29 | 30 | @Override 31 | void serializeValue(URI value, JsonGenerator generator, SerializationContextImpl context) { 32 | generator.write(value.toString()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/UrlSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.net.URL; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | import org.eclipse.yasson.internal.SerializationContextImpl; 20 | 21 | /** 22 | * Serializer of the {@link URL} type. 23 | */ 24 | class UrlSerializer extends TypeSerializer { 25 | 26 | UrlSerializer(TypeSerializerBuilder serializerBuilder) { 27 | super(serializerBuilder); 28 | } 29 | 30 | @Override 31 | void serializeValue(URL value, JsonGenerator generator, SerializationContextImpl context) { 32 | generator.write(value.toString()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/ZoneOffsetDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.time.ZoneOffset; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link ZoneOffset} type. 22 | */ 23 | class ZoneOffsetDeserializer extends TypeDeserializer { 24 | 25 | ZoneOffsetDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return ZoneOffset.of(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/AdaptedPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * @author Roman Grigoriadi 20 | */ 21 | public class AdaptedPojo { 22 | public String strField; 23 | public Integer intField; 24 | public Box box; 25 | public GenericBox intBox; 26 | public GenericBox strBox; 27 | public GenericBox tBox; 28 | public List> tGenericBoxList; 29 | public List integerList; 30 | public List stringList; 31 | public Map stringIntegerMap; 32 | public Map tMap; 33 | public T tVar; 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/specific/model/StreetWithPrimitives.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.specific.model; 14 | 15 | /** 16 | * @author Roman Grigoriadi 17 | */ 18 | public class StreetWithPrimitives { 19 | private String name = "defaultName"; 20 | private int number = 11; 21 | 22 | public StreetWithPrimitives() { 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public int getNumber() { 34 | return number; 35 | } 36 | 37 | public void setNumber(int number) { 38 | this.number = number; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/deserializer/types/DurationDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.deserializer.types; 14 | 15 | import java.lang.reflect.Type; 16 | import java.time.Duration; 17 | 18 | import org.eclipse.yasson.internal.DeserializationContextImpl; 19 | 20 | /** 21 | * Deserializer of the {@link Duration} type. 22 | */ 23 | class DurationDeserializer extends TypeDeserializer { 24 | 25 | DurationDeserializer(TypeDeserializerBuilder builder) { 26 | super(builder); 27 | } 28 | 29 | @Override 30 | public Object deserializeStringValue(String value, DeserializationContextImpl context, Type rType) { 31 | return Duration.parse(value); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/serializer/types/UuidSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.serializer.types; 14 | 15 | import java.util.UUID; 16 | 17 | import jakarta.json.stream.JsonGenerator; 18 | 19 | import org.eclipse.yasson.internal.SerializationContextImpl; 20 | 21 | /** 22 | * Serializer of the {@link UUID} type. 23 | */ 24 | class UuidSerializer extends TypeSerializer { 25 | 26 | UuidSerializer(TypeSerializerBuilder serializerBuilder) { 27 | super(serializerBuilder); 28 | } 29 | 30 | @Override 31 | void serializeValue(UUID value, JsonGenerator generator, SerializationContextImpl context) { 32 | generator.write(value.toString()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/adapters/model/FooAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.adapters.model; 14 | 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | import jakarta.json.bind.adapter.JsonbAdapter; 19 | 20 | public class FooAdapter implements JsonbAdapter>{ 21 | 22 | @Override 23 | public Map adaptToJson(Foo obj) throws Exception { 24 | Map map = new HashMap<>(); 25 | map.put("bar", obj.getBar()); 26 | return map; 27 | } 28 | 29 | @Override 30 | public Foo adaptFromJson( Map obj) throws Exception { 31 | return new Foo(obj.get("bar").toString()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/model/packagelevelannotations/PackageLevelOverriddenWithClassLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.customization.model.packagelevelannotations; 14 | 15 | import jakarta.json.bind.annotation.JsonbNillable; 16 | 17 | /** 18 | * @author Roman Grigoriadi 19 | */ 20 | @JsonbNillable(false) 21 | public class PackageLevelOverriddenWithClassLevel { 22 | 23 | private String nillableOverriddenField; 24 | 25 | public String getNillableOverriddenField() { 26 | return nillableOverriddenField; 27 | } 28 | 29 | public void setNillableOverriddenField(String nillableOverriddenField) { 30 | this.nillableOverriddenField = nillableOverriddenField; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/customization/transients/models/TransientSetterPlusCustomizationAnnotatedGetterContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | /* 14 | * $Id$ 15 | */ 16 | 17 | package org.eclipse.yasson.customization.transients.models; 18 | 19 | 20 | import jakarta.json.bind.annotation.JsonbProperty; 21 | import jakarta.json.bind.annotation.JsonbTransient; 22 | 23 | public class TransientSetterPlusCustomizationAnnotatedGetterContainer { 24 | private String instance = "INSTANCE"; 25 | 26 | @JsonbProperty("instance") 27 | public String getInstance() { 28 | return instance; 29 | } 30 | 31 | @JsonbTransient 32 | public void setInstance(String instance) { 33 | this.instance = instance; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/eclipse/yasson/defaultmapping/generics/model/GenericTestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.defaultmapping.generics.model; 14 | 15 | /** 16 | * Test class used in generics tests. 17 | * 18 | * @author Dmitry Kornilov 19 | */ 20 | public class GenericTestClass { 21 | public T field1; 22 | public U field2; 23 | 24 | public GenericTestClass() {} 25 | 26 | public T getField1() { 27 | return field1; 28 | } 29 | 30 | public void setField1(T field1) { 31 | this.field1 = field1; 32 | } 33 | 34 | public U getField2() { 35 | return field2; 36 | } 37 | 38 | public void setField2(U field2) { 39 | this.field2 = field2; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/eclipse/yasson/internal/components/DefaultConstructorCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0, 7 | * or the Eclipse Distribution License v. 1.0 which is available at 8 | * http://www.eclipse.org/org/documents/edl-v10.php. 9 | * 10 | * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 11 | */ 12 | 13 | package org.eclipse.yasson.internal.components; 14 | 15 | import java.io.IOException; 16 | 17 | import org.eclipse.yasson.internal.InstanceCreator; 18 | import org.eclipse.yasson.spi.JsonbComponentInstanceCreator; 19 | 20 | /** 21 | * Creates components instance with default constructor. 22 | */ 23 | public class DefaultConstructorCreator implements JsonbComponentInstanceCreator { 24 | 25 | @Override 26 | public T getOrCreateComponent(Class componentClass) { 27 | return InstanceCreator.createInstance(componentClass); 28 | } 29 | 30 | @Override 31 | public void close() throws IOException { 32 | 33 | } 34 | } 35 | --------------------------------------------------------------------------------