Starsector API
Loading...
Searching...
No Matches
com.fs.starfarer.api.impl.BaseSharedJSONFile Class Referenceabstract
Inheritance diagram for com.fs.starfarer.api.impl.BaseSharedJSONFile:
[legend]
Collaboration diagram for com.fs.starfarer.api.impl.BaseSharedJSONFile:
[legend]

Public Member Functions

void loadIfNeeded ()
 
void saveIfNeeded ()
 
Set< String > getSet (String key)
 
boolean doesSetContain (String key, String value)
 
boolean addToSet (String key, String value)
 
boolean optBoolean (String key, boolean defaultValue)
 
void setBoolean (String key, boolean value)
 
float optFloat (String key, float defaultValue)
 
void setFloat (String key, float value)
 
int optInt (String key, int defaultValue)
 
void setInt (String key, int value)
 
String optString (String key, String defaultValue)
 
void setString (String key, String value)
 
void unset (String key)
 

Protected Member Functions

abstract String getFilename ()
 

Protected Attributes

JSONObject json = new JSONObject()
 
Map< String, Set< String > > setCache = new HashMap<>()
 

Detailed Description

Base class. Extending classes are for relatively small amounts of data meant to be shared across different saves.

The amount of data stored here should be small and bounded (i.e. not growing indefinitely).

Code using this should assume the data stored here may be lost (e.g. due to the common folder being deleted) and handle this/recover gracefully.

Author
Alex

Definition at line 30 of file BaseSharedJSONFile.java.

Member Function Documentation

◆ addToSet()

boolean com.fs.starfarer.api.impl.BaseSharedJSONFile.addToSet ( String key,
String value )

Definition at line 84 of file BaseSharedJSONFile.java.

◆ doesSetContain()

boolean com.fs.starfarer.api.impl.BaseSharedJSONFile.doesSetContain ( String key,
String value )

Definition at line 79 of file BaseSharedJSONFile.java.

◆ getFilename()

abstract String com.fs.starfarer.api.impl.BaseSharedJSONFile.getFilename ( )
abstractprotected

◆ getSet()

Set< String > com.fs.starfarer.api.impl.BaseSharedJSONFile.getSet ( String key)

Definition at line 62 of file BaseSharedJSONFile.java.

◆ loadIfNeeded()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.loadIfNeeded ( )

Definition at line 35 of file BaseSharedJSONFile.java.

◆ optBoolean()

boolean com.fs.starfarer.api.impl.BaseSharedJSONFile.optBoolean ( String key,
boolean defaultValue )

Definition at line 112 of file BaseSharedJSONFile.java.

◆ optFloat()

float com.fs.starfarer.api.impl.BaseSharedJSONFile.optFloat ( String key,
float defaultValue )

Definition at line 123 of file BaseSharedJSONFile.java.

◆ optInt()

int com.fs.starfarer.api.impl.BaseSharedJSONFile.optInt ( String key,
int defaultValue )

Definition at line 134 of file BaseSharedJSONFile.java.

◆ optString()

String com.fs.starfarer.api.impl.BaseSharedJSONFile.optString ( String key,
String defaultValue )

Definition at line 145 of file BaseSharedJSONFile.java.

◆ saveIfNeeded()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.saveIfNeeded ( )

Definition at line 47 of file BaseSharedJSONFile.java.

◆ setBoolean()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.setBoolean ( String key,
boolean value )

Definition at line 115 of file BaseSharedJSONFile.java.

◆ setFloat()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.setFloat ( String key,
float value )

Definition at line 126 of file BaseSharedJSONFile.java.

◆ setInt()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.setInt ( String key,
int value )

Definition at line 137 of file BaseSharedJSONFile.java.

◆ setString()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.setString ( String key,
String value )

Definition at line 148 of file BaseSharedJSONFile.java.

◆ unset()

void com.fs.starfarer.api.impl.BaseSharedJSONFile.unset ( String key)

Definition at line 156 of file BaseSharedJSONFile.java.

Member Data Documentation

◆ json

JSONObject com.fs.starfarer.api.impl.BaseSharedJSONFile.json = new JSONObject()
protected

Definition at line 33 of file BaseSharedJSONFile.java.

◆ setCache

Map<String, Set<String> > com.fs.starfarer.api.impl.BaseSharedJSONFile.setCache = new HashMap<>()
protected

Definition at line 60 of file BaseSharedJSONFile.java.


The documentation for this class was generated from the following file: