Skip to content

Commit

Permalink
Add JacksonPluginConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Sep 8, 2024
1 parent cf343a4 commit 5081338
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bosk-jackson/src/main/java/works/bosk/jackson/JacksonPlugin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package works.bosk.jackson;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
Expand Down Expand Up @@ -67,13 +66,23 @@
import static works.bosk.ListingEntry.LISTING_ENTRY;
import static works.bosk.ReferenceUtils.rawClass;
import static works.bosk.ReferenceUtils.theOnlyConstructorFor;
import static works.bosk.jackson.JacksonPluginConfiguration.defaultConfiguration;

/**
* Provides JSON serialization/deserialization using Jackson.
* @see SerializationPlugin
*/
public final class JacksonPlugin extends SerializationPlugin {
private final JacksonCompiler compiler = new JacksonCompiler(this);
private final JacksonPluginConfiguration config;

public JacksonPlugin() {
this(defaultConfiguration());
}

public JacksonPlugin(JacksonPluginConfiguration config) {
this.config = config;
}

public BoskJacksonModule moduleFor(BoskInfo<?> boskInfo) {
return new BoskJacksonModule() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package works.bosk.jackson;

public record JacksonPluginConfiguration(
boolean useLinkedEntries
) {
public static JacksonPluginConfiguration defaultConfiguration() {
return new JacksonPluginConfiguration(false);
}
}

0 comments on commit 5081338

Please sign in to comment.