generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix constructor/bean properties and beans with an executable method (#…
…650) * Issue with Bson deserialization * Fix constructor/bean properties and beans with an executable method * Fix any getters --------- Co-authored-by: radovanradic <radicr@gmail.com>
- Loading branch information
1 parent
ecc6a0e
commit 4571c6a
Showing
6 changed files
with
141 additions
and
7 deletions.
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
48 changes: 48 additions & 0 deletions
48
serde-bson/src/test/java/io/micronaut/serde/bson/BookWithConstructor.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,48 @@ | ||
package io.micronaut.serde.bson; | ||
|
||
import io.micronaut.core.annotation.Creator; | ||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.serde.annotation.Serdeable; | ||
import org.bson.types.ObjectId; | ||
|
||
@Serdeable | ||
public class BookWithConstructor { | ||
@NonNull | ||
private ObjectId objectId; | ||
private String title; | ||
private int pages; | ||
|
||
public BookWithConstructor() { | ||
} | ||
|
||
@Creator | ||
public BookWithConstructor(ObjectId objectId, String title, int pages) { | ||
this.objectId = objectId; | ||
this.title = title; | ||
this.pages = pages; | ||
} | ||
|
||
public ObjectId getObjectId() { | ||
return objectId; | ||
} | ||
|
||
public void setObjectId(ObjectId objectId) { | ||
this.objectId = objectId; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public int getPages() { | ||
return pages; | ||
} | ||
|
||
public void setPages(int pages) { | ||
this.pages = pages; | ||
} | ||
} |
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
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
37 changes: 37 additions & 0 deletions
37
serde-tck/src/main/java/io/micronaut/serde/BeanWithExtraMethod.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,37 @@ | ||
/* | ||
* Copyright 2017-2021 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.serde; | ||
|
||
import io.micronaut.context.annotation.Executable; | ||
import io.micronaut.serde.annotation.Serdeable; | ||
|
||
@Serdeable | ||
public class BeanWithExtraMethod { | ||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Executable | ||
public String something() { | ||
return "xyz"; | ||
} | ||
} |