AdvancedExposable.java
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This file is part of LiteLoader.
* Copyright (C) 2012-16 Adam Mummery-Smith
* All Rights Reserved.
*/
package com.mumfrey.liteloader.modconfig;
import java.io.File;
import com.google.gson.GsonBuilder;
/**
* Interface for Exposables which want a finer degree of control over the
* serialisation process.
*
* @author Adam Mummery-Smith
*/
public interface AdvancedExposable extends Exposable
{
/**
* Allows this object to configure the GsonBuilder prior to the construction
* of the Gson instance. Use this callback to (for example) register custom
* type adapters or set other Gson options such as pretty printing.
*
* @param gsonBuilder
*/
public abstract void setupGsonSerialiser(GsonBuilder gsonBuilder);
/**
* Allows this object to specify an alternative configuration file to the
* one determined by the writer, either return null or return configFile to
* keep the original setting, or return a new File object to set the
* location for the config file. If you specify an alternative location, you
* are responsible for ensuring that the location exists and is writable.
*
* @param configFile Default config file, generated by the ExposableOptions
* for this Exposable
* @param configFileLocation Default config file location, from the config
* strategy
* @param defaultFileName Default cfg file name, from the ExposableOptions
* @return config file location to return, return null to use the default
*/
public abstract File getConfigFile(File configFile, File configFileLocation, String defaultFileName);
}