Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Bundle

[17:7] extends: FxObj

Wraps FXGL's Bundle (com.almasb.fxgl.core.serialization.Bundle), the keyed save/load primitive used by PropertyMap.write/read, EngineService.write/read, OfflineTimer, and InputCapture. Each bundle has a name (typically the owning subsystem) plus a map of String keys to Serializable values. Stored values must implement java.io.Serializable; Aussom primitives (int, double, bool, string) all qualify.

Methods

  • Bundle (string Name = "default")

    Creates a new Bundle with the given name.

    • @p Name is the bundle identifier (used in toString and as the lookup key when bundles are aggregated).
  • adopt (object Ajo)

    Wraps an existing Bundle AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a Bundle.
    • @r A new wrapper.
  • getName ()

    Returns the bundle name.

  • put (string Key, Value)

    Stores a Serializable value under Key. Aussom primitives (int, double, bool, string) are accepted; arbitrary objects must implement java.io.Serializable.

    • @p Key is the property name.
    • @p Value is the value to store.
    • @r this object
  • get (string Key)

    Returns the value stored under Key. Throws if the key is missing or if the cast fails — call exists first when the key may not be present.

    • @p Key is the property name.
    • @r The stored value.
  • exists (string Key)

    Returns whether Key is present in the bundle.

    • @p Key is the property name.
    • @r A bool.
  • getData ()

    Returns the underlying data map as an AussomJavaObject around a Java HashMap<String, Serializable>.

    • @r An AussomJavaObject around a Map.