-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implicitly defined serializers fixed (#510)
Signed-off-by: David Kral <david.k.kral@oracle.com>
- Loading branch information
Showing
5 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/test/java/org/eclipse/yasson/serializers/model/AbstractJsonbSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
package org.eclipse.yasson.serializers.model; | ||
|
||
import jakarta.json.Json; | ||
import jakarta.json.JsonStructure; | ||
import jakarta.json.bind.serializer.JsonbSerializer; | ||
import jakarta.json.bind.serializer.SerializationContext; | ||
import jakarta.json.stream.JsonGenerator; | ||
|
||
/** | ||
* Abstract serializer. | ||
*/ | ||
public class AbstractJsonbSerializer<T> implements JsonbSerializer<T> { | ||
@Override | ||
public void serialize(T obj, JsonGenerator generator, SerializationContext ctx) { | ||
JsonStructure json = Json.createObjectBuilder().add("value", "123").build(); | ||
generator.write(json); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/java/org/eclipse/yasson/serializers/model/ExplicitJsonbSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
package org.eclipse.yasson.serializers.model; | ||
|
||
import jakarta.json.bind.serializer.JsonbSerializer; | ||
|
||
/** | ||
* Explicit serializer. | ||
*/ | ||
public class ExplicitJsonbSerializer extends AbstractJsonbSerializer<Box> implements JsonbSerializer<Box> { | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/java/org/eclipse/yasson/serializers/model/ImplicitJsonbSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
package org.eclipse.yasson.serializers.model; | ||
|
||
/** | ||
* Implicit serializer. | ||
*/ | ||
public class ImplicitJsonbSerializer extends AbstractJsonbSerializer<Box> { | ||
} |