XillaBoot is a lightweight Java framework that makes it easy to store, retrieve, and manage large amounts of data efficiently.
- Built on Gson for automatic serialisation/deserialisation
- Supports JSON files (single file or one file per object) and in-memory caching
- Optional automatic object unloading – keeps memory usage low when enabled
- Buffered file reader (256 bytes at a time) with file indexing for minimal disk overhead
- Annotation-driven – no managers to write
- Thread-safe
1. Annotate your data class:
@JsonFolderManager(folderName = "players/")
public class Player {
private String uuid;
private String name;
public String getId() { return uuid; }
}
2. Initialize XillaBoot:
XillaApplication.initialize();
XillaApplication.getInstance().startup();
3. Use the API:
Player player = new Player("123", "Alice");
XillaAPI.setObject(Player.class, player);
Player samePlayer = XillaAPI.getObject(Player.class, "123");
| Annotation | Storage |
|---|---|
| @CacheManager | In-memory only, no persistence |
| @JsonManager(fileName = "data.json") | Single JSON file |
| @JsonFolderManager(folderName = "data/") | One JSON file per object |
Every stored object needs a unique identifier. XillaBoot checks for these methods in order:
- getId()
- getID()
- getName()
- toString() (last resort)
| Method | Description |
|---|---|
| getObject(Class, String key) | Retrieve an object by key |
| setObject(Class, T obj) | Save or update an object |
| removeObject(Class, T obj) | Delete an object |
| getObjects(Class) | Get all objects of a type |
| getManager(Class) | Get the manager for advanced use |
| generateSettings(String fileName) | Create a new settings file |
| getSetting(String, String key) | Get a setting value |
| setSetting(String, String key, T value) | Set a setting value |
XillaApplication.initialize(false);
Manager<MyClass> manager = new Manager<>(MyClass.class, new JsonFolderLoader("data/"));
XillaApplication.getInstance().registerManager(manager);
XillaApplication.getInstance().startup();
XillaApplication.getInstance().registerStartupProcess(new StartupProcess("Init", StartupPriority.COMPLETE) {
@Override
public void run() {
// code here
}
});
XillaAPI.generateSettings("config.json");
XillaAPI.setSetting("config.json", "maxPlayers", 100);
int max = XillaAPI.getSetting("config.json", "maxPlayers");
Manager<Player> manager = XillaAPI.getManager(Player.class);
for (String key : manager.keySet()) {
boolean wasLoaded = manager.isLoaded(key);
if (!wasLoaded) manager.loadSingle(key);
Player p = manager.get(key);
// do something
if (!wasLoaded) manager.unloadObject(key);
}
Build from source:
git clone https://github.com/your-repo/XillaBoot.git
cd XillaBoot
mvn install
Add dependency:
Maven:
<dependency>
<groupId>net.xilla.boot</groupId>
<artifactId>XillaBoot</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
Gradle:
implementation 'net.xilla.boot:XillaBoot:1.0.1-SNAPSHOT'
Optional shading/relocation for plugin environments:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>net.xilla.boot</pattern>
<shadedPattern>your.package.boot</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
XillaApplication.initialize(false);
SettingsFile config = new SettingsFile("config.yml",
new YamlConfigFileLoader(getDataFolder() + "/config.yml"));
XillaApplication.getInstance().registerManager(config);
XillaApplication.start();
}
}
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
public MyApp() {
XillaApplication.initialize();
XillaAPI.generateSettings("settings.json");
XillaApplication.start();
}
}
"Manager X does not exist or is not registered"
- Did you call XillaApplication.start()?
- If reflection is disabled, did you manually register the manager?
- Check that your class has the correct annotation
Objects are not saving
- Ensure your class has a valid getId() method
- Call manager.save() or enable auto-save with manager.setAutoSave(true)
Memory usage is high
- Enable auto-unloading with manager.setAutoUnload(true)
- Manually unload objects with manager.unloadObject(key)
If you need additional help, please reach out in our discord! https://discord.gg/AyJhdHYbGw