Skip to content

Commit cc26aaa

Browse files
Allow overwriting the name prefix
1 parent 199d49c commit cc26aaa

21 files changed

Lines changed: 178 additions & 148 deletions

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414

1515
publishData {
1616
useEldoNexusRepos(false)
17-
publishingVersion = "2.0.0"
17+
publishingVersion = "2.1.0"
1818
}
1919

2020
group = "dev.chojo"

docs/configuration_creation.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,24 @@ If you want to use one of those you need to also import the desired data format
3434
=== "json"
3535

3636
```kts
37-
implementation("com.fasterxml.jackson.core", "jackson-databind")
37+
implementation("tools.jackson.core", "jackson-databind")
3838
```
39-
4039
=== "yaml"
4140

4241
!!! warning "Minecraft Users"
4342
4443
Be aware that jacksons yaml format depends on snakeyaml, which is bundled in spigot and paper. You need to use relocation in that case and shade the complete jackson library instead of using the library builder. You might also encounter version conflicts, when the server software relies on another snakeyaml version than your jackson dataformat.
4544

4645
```kts
47-
implementation("com.fasterxml.jackson.core", "jackson-databind")
48-
compileOnly("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
46+
implementation("tools.jackson.core", "jackson-databind")
47+
compileOnly("tools.jackson.dataformat", "jackson-dataformat-yaml")
4948
```
5049

5150
=== "toml"
5251

5352
```kts
54-
implementation("com.fasterxml.jackson.core", "jackson-databind")
55-
compileOnly("com.fasterxml.jackson.dataformat", "jackson-dataformat-toml")
53+
implementation("tools.jackson.core", "jackson-databind")
54+
compileOnly("tools.jackson.dataformat", "jackson-dataformat-toml")
5655
```
5756

5857
### Retrieving a data format

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ nav:
1212
- Home: index.md
1313
- 'Create a Configuration': configuration_creation.md
1414
- 'Customise a Configuration': customise.md
15+
- 'Configuration Overrides': overrides.md
1516
- 'Examples':
1617
- 'Jackson Bukkit': examples/jackson_bukkit.md
1718
theme:

src/main/java/dev/chojo/ocular/Configurations.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
package dev.chojo.ocular;
77

88
import com.fasterxml.jackson.annotation.JsonAutoDetect;
9-
import com.fasterxml.jackson.annotation.PropertyAccessor;
10-
import tools.jackson.databind.MapperFeature;
11-
import tools.jackson.databind.ObjectMapper;
12-
import tools.jackson.databind.cfg.MapperBuilder;
13-
import tools.jackson.databind.introspect.VisibilityChecker;
14-
import tools.jackson.databind.type.TypeFactory;
159
import dev.chojo.ocular.components.FileWrapper;
1610
import dev.chojo.ocular.components.Format;
1711
import dev.chojo.ocular.components.Wrapper;
@@ -29,13 +23,17 @@
2923
import org.slf4j.Logger;
3024
import tools.jackson.core.JacksonException;
3125
import tools.jackson.databind.JacksonModule;
26+
import tools.jackson.databind.MapperFeature;
27+
import tools.jackson.databind.ObjectMapper;
28+
import tools.jackson.databind.cfg.MapperBuilder;
29+
import tools.jackson.databind.introspect.VisibilityChecker;
30+
import tools.jackson.databind.type.TypeFactory;
3231

3332
import java.io.IOException;
3433
import java.nio.file.Files;
3534
import java.nio.file.Path;
3635
import java.time.LocalDateTime;
3736
import java.time.format.DateTimeFormatter;
38-
import java.util.ArrayList;
3937
import java.util.Collections;
4038
import java.util.HashMap;
4139
import java.util.HashSet;

src/main/java/dev/chojo/ocular/ConfigurationsBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66
package dev.chojo.ocular;
77

8-
import tools.jackson.databind.ObjectMapper;
9-
import tools.jackson.databind.cfg.MapperBuilder;
108
import dev.chojo.ocular.dataformats.DataFormat;
119
import dev.chojo.ocular.impl.ModifyableConfigurations;
1210
import dev.chojo.ocular.key.Key;
1311
import dev.chojo.ocular.util.Consumers;
1412
import org.jetbrains.annotations.NotNull;
1513
import tools.jackson.databind.JacksonModule;
14+
import tools.jackson.databind.ObjectMapper;
15+
import tools.jackson.databind.cfg.MapperBuilder;
1616

1717
import java.nio.file.Path;
1818
import java.util.Collection;
@@ -30,6 +30,7 @@
3030
public class ConfigurationsBuilder<T> {
3131
private final @NotNull Key<T> main;
3232
private final List<DataFormat<?, ?>> formats = new LinkedList<>();
33+
private final List<JacksonModule> modules = new LinkedList<>();
3334
private Path base = Path.of(".");
3435
private ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
3536
private Configurations<?> parent = null;
@@ -39,7 +40,6 @@ public class ConfigurationsBuilder<T> {
3940
private Consumer<ObjectMapper> configureWriterMapper = Consumers.identity();
4041
private Consumer<MapperBuilder<ObjectMapper, ?>> configureBuilder = Consumers.identity();
4142
private Consumer<ObjectMapper> configureMapper = Consumers.identity();
42-
private final List<JacksonModule> modules = new LinkedList<>();
4343

4444

4545
/**

src/main/java/dev/chojo/ocular/components/Format.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66
package dev.chojo.ocular.components;
77

8-
import tools.jackson.databind.ObjectMapper;
9-
import tools.jackson.databind.cfg.MapperBuilder;
108
import dev.chojo.ocular.Configurations;
119
import dev.chojo.ocular.dataformats.DataFormat;
10+
import tools.jackson.databind.ObjectMapper;
11+
import tools.jackson.databind.cfg.MapperBuilder;
1212

1313
/**
1414
* The Format class encapsulates the configuration and initialization logic for creating

src/main/java/dev/chojo/ocular/dataformats/DataFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*/
66
package dev.chojo.ocular.dataformats;
77

8-
import tools.jackson.databind.ObjectMapper;
9-
import tools.jackson.databind.cfg.MapperBuilder;
108
import dev.chojo.ocular.exceptions.MissingDataTypeInstallationException;
119
import dev.chojo.ocular.key.Key;
1210
import tools.jackson.databind.JacksonModule;
11+
import tools.jackson.databind.ObjectMapper;
12+
import tools.jackson.databind.cfg.MapperBuilder;
1313

1414
import java.util.Collections;
1515
import java.util.List;

src/main/java/dev/chojo/ocular/dataformats/TomlDataFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
package dev.chojo.ocular.dataformats;
77

8-
import tools.jackson.dataformat.toml.TomlMapper;
98
import dev.chojo.ocular.exceptions.MissingDataTypeInstallationException;
9+
import tools.jackson.dataformat.toml.TomlMapper;
1010

1111
public class TomlDataFormat implements DataFormat<TomlMapper, TomlMapper.Builder> {
1212

@@ -25,7 +25,7 @@ public void assertInstalled() throws MissingDataTypeInstallationException {
2525
try {
2626
Class.forName(TomlMapper.class.getName());
2727
} catch (ClassNotFoundException e) {
28-
throw new MissingDataTypeInstallationException(type(), "com.fasterxml.jackson.dataformat:jackson-dataformat-toml");
28+
throw new MissingDataTypeInstallationException(type(), "tools.jackson.dataformat:jackson-dataformat-toml");
2929
}
3030
}
3131
}

src/main/java/dev/chojo/ocular/dataformats/YamlDataFormat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
package dev.chojo.ocular.dataformats;
77

8-
import tools.jackson.dataformat.yaml.YAMLMapper;
98
import dev.chojo.ocular.exceptions.MissingDataTypeInstallationException;
9+
import tools.jackson.dataformat.yaml.YAMLMapper;
1010
import tools.jackson.dataformat.yaml.YAMLWriteFeature;
1111

1212
public class YamlDataFormat implements DataFormat<YAMLMapper, YAMLMapper.Builder> {
@@ -36,7 +36,7 @@ public void assertInstalled() throws MissingDataTypeInstallationException {
3636
try {
3737
Class.forName(YAMLMapper.class.getName());
3838
} catch (ClassNotFoundException e) {
39-
throw new MissingDataTypeInstallationException(type(), "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml");
39+
throw new MissingDataTypeInstallationException(type(), "tools.jackson.dataformat:jackson-dataformat-yaml");
4040
}
4141
}
4242
}

src/main/java/dev/chojo/ocular/impl/ModifyableConfigurations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*/
66
package dev.chojo.ocular.impl;
77

8-
import tools.jackson.databind.ObjectMapper;
9-
import tools.jackson.databind.cfg.MapperBuilder;
108
import dev.chojo.ocular.Configurations;
119
import dev.chojo.ocular.dataformats.DataFormat;
1210
import dev.chojo.ocular.key.Key;
1311
import org.jetbrains.annotations.NotNull;
1412
import tools.jackson.databind.JacksonModule;
13+
import tools.jackson.databind.ObjectMapper;
14+
import tools.jackson.databind.cfg.MapperBuilder;
1515

1616
import java.nio.file.Path;
1717
import java.util.LinkedList;

0 commit comments

Comments
 (0)