Class KeyPath.Mut

java.lang.Object
space.arim.dazzleconf.backend.KeyPath
space.arim.dazzleconf.backend.KeyPath.Mut
All Implemented Interfaces:
Printable
Enclosing class:
KeyPath

public static final class KeyPath.Mut extends KeyPath
  • Constructor Details

    • Mut

      public Mut()
      Creates an empty key path
    • Mut

      public Mut(@NonNull String @NonNull ... parts)
      Creates from the given parts
      Parameters:
      parts - the parts
    • Mut

      public Mut(@NonNull KeyPath other)
      Creates from another key path.

      This will copy the parts of that key path into this one.

      Parameters:
      other - the other key path
  • Method Details

    • intoMut

      public @NonNull KeyPath.Mut intoMut()
      Description copied from class: KeyPath
      Gets this key path as a mutable one.

      If not mutable, the data is copied to a new key path which is returned. This copying may be performed lazily, such as by deferring to the first mutative operation on the returned object.

      Specified by:
      intoMut in class KeyPath
      Returns:
      this key path if mutable, or a mutable copy if needed
    • intoImmut

      public @NonNull KeyPath.Immut intoImmut()
      Description copied from class: KeyPath
      Gets this key path as an immutable one.

      The data contained within this KeyPath is moved to an immutable instance. The old instance may still be used, but the implementation of this method may be optimized for the case that it is not.

      If this instance is already DataTree.Immut, then it may be returned without changes.

      Specified by:
      intoImmut in class KeyPath
      Returns:
      an immutable key path
    • applyKeyMapper

      public void applyKeyMapper(@NonNull KeyMapper keyMapper)
      Applies a key mapper to existing key parts.

      All existing key parts will be mapped through the provided argument. Parts added later will not be affected.

      Parameters:
      keyMapper - the key mapper
    • addFront

      public void addFront(@NonNull CharSequence part)
      Adds a key part at the front.

      This part will be prepended before the other parts.

      Parameters:
      part - the part
    • addBack

      public void addBack(@NonNull CharSequence part)
      Adds a key part at the back.

      This part will be appended behind the other parts.

      Parameters:
      part - the part
    • addPath

      public void addPath(@NonNull KeyPath.SequenceBoundary boundary, @NonNull KeyPath toAdd)
      Adds another key path to this one, either at the front or back of this key path.
      Parameters:
      boundary - where to add the key path; should it be prepended at the front, or appended at the back
      toAdd - that which is added to this one