- All Known Implementing Classes:
MappingGeneratorImpl
public interface MappingGenerator
Handles writing Json for Objects.
Internally it uses a
JsonGenerator to write JSON
To write JSON-P structure elements you can use the JsonGenerator.-
Method Summary
Modifier and TypeMethodDescriptionwriteObject(Object o, jakarta.json.stream.JsonGenerator generator) Write the given Object o into the current JSON layer.default MappingGeneratorwriteObject(String key, Object o, jakarta.json.stream.JsonGenerator generator)
-
Method Details
-
writeObject
Write the given Object o into the current JSON layer. This will not open a new json layer ('{', '}') but really just write the attributes of o to the currently opened layer. Consider you have a classpublic class Customer { private String firstName; private String lastName; private Address address; ... }then the resulting JSON String will e.g. look like"firstName":"Karl", "lastName":"SomeName", "address":{"street":"mystreet"}- Parameters:
o- the object to writegenerator- the jsonp generator to use- Returns:
- itself, for easier chaining of commands
-
writeObject
default MappingGenerator writeObject(String key, Object o, jakarta.json.stream.JsonGenerator generator)
-