Lightweight library that helps content management.
<dependency>
<groupId>io.zentae.contentlibrary</groupId>
<artifactId>content-library</artifactId>
<version>2.5.0</version>
<scope>compile</scope>
</dependency>
In the following steps I will show how to setup an Extension.
You need to provide what type of data you want to serialize or deserialize.
Extension<String> extension = new JsonExtension<>();
Extension<String> extension = new YamlExtension<>();
For the serialization you'll need to provide a file where the data will be stored
as well as the data that needs to be stored.
File file = new File("some file path");
extension.serialize(file, "Some data");
For the deserialization you only need to provide the file where the stored data is.
String deserializedString = extension.deserialize(file, String.class);
Directories is a very useful class that will be subject to evolution.
This class extends directly from java.File but adds some useful methods.
This method returns all the files within this directory.
Directory directory = new Directory("some directory path");
directory.getFiles().forEach(file ->
System.out.println(file.getAbsolutePath()));
This methods allows you to copy several files into the following directory.
File[] files = new File[5];
Directory directory = new Directory("some directory path");
directory.copyFiles(files);
Wrappers are indeed very useful when it comes to context or to wrap regardless the type of the data.
They can store whatever object regardless their type. Good for generic stuff.
This wrapper is useful for single generic data wrapping.
# The data that needs to be stored.
GamePlayer gamePlayer = null;
# Init object wrapper.
GenericWrapper<GamePlayer> genericWrapper = new GenericWrapper();
# Set the single generic parameter.
genericWrapper.setParameter(gamePlayer);
# Get the stored parameter.
GamePlayer storedGamePlayer = genericWrapper.getParameter();
This map is also generic it can store objects regardless their type.
# The data that needs to be stored.
Object data = null;
# Init map wrapper.
MapWrapper mapWrapper = new MapWrapper();
# Put the data into the map.
mapWrapper.putParameter("key", data);
# Get the said data.
Object storedData = mapWrapper.getParameter("key", Object.class);