Package mcp.mobius.waila.api
Interface IJsonConfig<T>
- Type Parameters:
T- the config class
An Interface for easy (de)serialization for config classes
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic @interfaceAdds comment for this value.static interfaceA custom commenter. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidbackup()voidBackup and invalidate current value and force re-read file on nextget().get()Get current valuegetPath()voidInvalidate current value and force re-read file on nextget()booleanstatic <T> IJsonConfig.Builder0<T> of(com.google.gson.reflect.TypeToken<T> type) Creates a builder for generic config type.static <T> IJsonConfig.Builder0<T> Creates a builder for concrete config type.voidsave()Save value to filevoidWrite value to file
-
Method Details
-
of
Creates a builder for concrete config type. -
of
Creates a builder for generic config type.Note: the object factory must be specified.
-
get
T get()Get current value -
save
void save()Save value to file -
write
Write value to file -
invalidate
void invalidate()Invalidate current value and force re-read file on nextget() -
isFileExists
boolean isFileExists()- Returns:
- whether the config file exists.
-
getPath
Path getPath()- Returns:
- the path to the config file.
-
backup
Backup and invalidate current value and force re-read file on nextget(). The backup will have a time suffix to it's file extension. -
backup
default void backup()- See Also:
-