Class AbstractReplicatedMap.MapEntry<K,V>

java.lang.Object
org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapEntry<K,V>
Type Parameters:
K - The type of keys maintained by this map
V - The type of mapped values
All Implemented Interfaces:
Map.Entry<K,V>
Enclosing class:
AbstractReplicatedMap<K,V>

public static class AbstractReplicatedMap.MapEntry<K,V> extends Object implements Map.Entry<K,V>
Represents an entry in the replicated map, including metadata about its role (primary, backup, proxy).
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapEntry(K key, V value)
    Creates a new map entry with the specified key and value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(byte[] data, int offset, int length, boolean diff)
    apply a diff, or an entire object
    boolean
     
    Gets the backup nodes for this entry.
    Gets the key for this entry.
    Gets the primary member for this entry.
    Gets the value for this entry.
    int
     
    boolean
    Checks if this entry is active.
    boolean
    Checks if this entry is a backup.
    boolean
    Checks if this entry is a copy.
    boolean
    Checks if this entry is diffable.
    boolean
    Checks if the key is serializable.
    boolean
    Checks if this entry is primary.
    boolean
    Checks if this entry is a proxy.
    boolean
    Checks if both the key and value are serializable.
    boolean
    Checks if the value is serializable.
    void
    setBackup(boolean backup)
    Sets whether this entry is a backup.
    void
    Sets the backup nodes for this entry.
    void
    setCopy(boolean copy)
    Sets whether this entry is a copy.
    setKey(K key)
    Sets the key for this entry.
    void
    Sets the primary member for this entry.
    void
    setProxy(boolean proxy)
    Sets whether this entry is a proxy.
    setValue(V value)
    Sets the value for this entry.
    Returns a string representation of this map entry.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MapEntry

      public MapEntry(K key, V value)
      Creates a new map entry with the specified key and value.
      Parameters:
      key - The key
      value - The value
  • Method Details

    • isKeySerializable

      public boolean isKeySerializable()
      Checks if the key is serializable.
      Returns:
      true if the key is serializable or null
    • isValueSerializable

      public boolean isValueSerializable()
      Checks if the value is serializable.
      Returns:
      true if the value is serializable or null
    • isSerializable

      public boolean isSerializable()
      Checks if both the key and value are serializable.
      Returns:
      true if both key and value are serializable
    • isBackup

      public boolean isBackup()
      Checks if this entry is a backup.
      Returns:
      true if this entry is a backup
    • setBackup

      public void setBackup(boolean backup)
      Sets whether this entry is a backup.
      Parameters:
      backup - true if this entry is a backup
    • isProxy

      public boolean isProxy()
      Checks if this entry is a proxy.
      Returns:
      true if this entry is a proxy
    • isPrimary

      public boolean isPrimary()
      Checks if this entry is primary.
      Returns:
      true if this entry is primary
    • isActive

      public boolean isActive()
      Checks if this entry is active.
      Returns:
      true if this entry is active
    • setProxy

      public void setProxy(boolean proxy)
      Sets whether this entry is a proxy.
      Parameters:
      proxy - true if this entry is a proxy
    • isCopy

      public boolean isCopy()
      Checks if this entry is a copy.
      Returns:
      true if this entry is a copy
    • setCopy

      public void setCopy(boolean copy)
      Sets whether this entry is a copy.
      Parameters:
      copy - true if this entry is a copy
    • isDiffable

      public boolean isDiffable()
      Checks if this entry is diffable.
      Returns:
      true if this entry is diffable
    • setBackupNodes

      public void setBackupNodes(Member[] nodes)
      Sets the backup nodes for this entry.
      Parameters:
      nodes - The backup nodes
    • getBackupNodes

      public Member[] getBackupNodes()
      Gets the backup nodes for this entry.
      Returns:
      The backup nodes
    • setPrimary

      public void setPrimary(Member m)
      Sets the primary member for this entry.
      Parameters:
      m - The primary member
    • getPrimary

      public Member getPrimary()
      Gets the primary member for this entry.
      Returns:
      The primary member
    • getValue

      public V getValue()
      Gets the value for this entry.
      Specified by:
      getValue in interface Map.Entry<K,V>
      Returns:
      The value
    • setValue

      public V setValue(V value)
      Sets the value for this entry.
      Specified by:
      setValue in interface Map.Entry<K,V>
      Parameters:
      value - The new value
      Returns:
      The previous value
    • getKey

      public K getKey()
      Gets the key for this entry.
      Specified by:
      getKey in interface Map.Entry<K,V>
      Returns:
      The key
    • setKey

      public K setKey(K key)
      Sets the key for this entry.
      Parameters:
      key - The new key
      Returns:
      The previous key
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
    • apply

      public void apply(byte[] data, int offset, int length, boolean diff) throws IOException, ClassNotFoundException
      apply a diff, or an entire object
      Parameters:
      data - byte[]
      offset - int
      length - int
      diff - boolean
      Throws:
      IOException - IO error
      ClassNotFoundException - Deserialization error
    • toString

      public String toString()
      Returns a string representation of this map entry.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this map entry