Options
All
  • Public
  • Public/Protected
  • All
Menu

Json configuration file reading/writing utility

Hierarchy

Index

Constructors

  • new Config(file: File): Config
  • new Config(path: string): Config

Properties

class: Class<Config>

Methods

  • access<T>(name: string): T
  • checkAndRestore(jsonstr: string): void
  • checkAndRestore(jsonobj: {}): void
  • checkAndRestore(json: JSONObject): void
  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern

    Parameters

    • jsonstr: string

      string representation of JSON object representing the data pattern

    Returns void

  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern

    Parameters

    • jsonobj: {}

      javascript object representing the data pattern checkAndRestore

      • [key: string]: any

    Returns void

  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern

    Parameters

    • json: JSONObject

    Returns void

  • clone(): any
  • equals(param0: any): boolean
  • finalize(): void
  • get<T>(name: string): T
  • Gets property from the config

    Example:

    config.get("generation.ore_copper.max_height");
    

    Type Parameters

    Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns T

    Config instance with current config as parent if the property is object, [[org.json.JSONArray]] instance if the property is an array, raw type if the property is of that raw type, null otherwise

  • getBool(name: string): boolean
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns boolean

    boolean config value specified in config or false if no value was specified

  • getClass(): Class<any>
  • getDouble(name: string): number
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    double number of value by given name from the config, or 0.0 if no value was specified

  • getFloat(name: string): number
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    floating point number of value by given name from the config, or 0.0 if no value was specified

  • getInteger(name: string): number
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    integer of value by given name from the config, or 0 if no value was specified

  • getNames(): ArrayList<string>
  • getNumber(name: string): Number
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns Number

    java number object instance, containing numeric value by given name from the config, or 0 if no value was specified

  • getString(name: string): string
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns string

    string by given name from the config, or null if no value was specified

  • hashCode(): number
  • notify(): void
  • notifyAll(): void
  • save(): void
  • set<T>(name: string, val: T): boolean
  • Sets config value. Do not use [[org.json.JSONObject]] instances to create nested objects, consider using dot-separated names instead

    Type Parameters

    • T = string | number | boolean | JSONArray | JSONObject

    Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    • val: T

      value, may be [[org.json.JSONArray]] instance, [[org.json.JSONObject]] instance or raw data type

    Returns boolean

  • toString(): string
  • wait(): void
  • wait(param0: number): void
  • wait(param0: number, param1: number): void

Generated using TypeDoc