Class ChangeId


  • public class ChangeId
    extends java.lang.Object
    Used to identify when the state of an object has changed by incrementing an integer id. Other classes can determine when this object has changed by polling to see if the id has changed.

    This is useful as an alternative to an event listener subscription model when there is no safe point in the lifecycle of an object to unsubscribe from the event listeners. Unlike event listeners, this cannot cause memory leaks.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EMPTY_ID  
    • Constructor Summary

      Constructors 
      Constructor Description
      ChangeId()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkChanged​(int id)  
      int get()  
      boolean isEmpty()  
      void update()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChangeId

        public ChangeId()
    • Method Detail

      • get

        public int get()
      • isEmpty

        public boolean isEmpty()
      • checkChanged

        public boolean checkChanged​(int id)
      • update

        public void update()