Class Swizzler

java.lang.Object
com.jalios.jstore.Swizzler

public class Swizzler extends Object
This class manages the id <-> storable maps.
Author:
Olivier Dedieu
  • Method Details

    • registerStorable

      public void registerStorable(Storable storable, Map<String,String> attributes)
      Swizzler ID <==> Storable
    • removeStorable

      public void removeStorable(Storable storable)
    • updateReferences

      public void updateReferences(Storable storable, Storable updated) throws IOException
      Updates the references of a storable and its update
      Parameters:
      storable - the old referenced storable
      updated - the updated storable
      Throws:
      IOException
    • updateArrayOfReferences

      public void updateArrayOfReferences(Storable[] array, Storable[] updatedArray) throws IOException
      Throws:
      IOException
    • getStorable

      public Storable getStorable(String id)
    • isSwizzled

      public boolean isSwizzled(Storable storable)
      Check if the specified Storable (or any storable with matching id) has been saved in Swizzler
      Parameters:
      storable - a Storable instance, may be null
      Returns:
      false if specified storable is null, has a null id, or has not been stored in swizzler, true if storable was found in swizzler
    • isSwizzled

      public boolean isSwizzled(String id)
    • iterator

      public Iterator<Storable> iterator()
      Return an iterator on the storable set
      Returns:
      the storable iterator.
    • swizzle

      public void swizzle(Map<String,String> attributes)
      Replace in the Map the storables by their ID storable -> ID
    • incRC

      public void incRC(Storable storable)
      Increments the Reference Counter of the storable
      Parameters:
      storable - the target storable
    • decRC

      public void decRC(Storable storable)
      Decrements the Reference Counter of the storable
      Parameters:
      storable - the target storable
    • isReferrenced

      public boolean isReferrenced(Storable storable)