Class PofUpdater

    • Constructor Detail

      • PofUpdater

        public PofUpdater()
        Default constructor (necessary for the PortableObject interface).
      • PofUpdater

        public PofUpdater​(int iProp)
        Constructs a PofUpdater based on a property index.

        This constructor is equivalent to:

           PofUpdater updater =
               new PofUpdater(new SimplePofPath(iProp));
         
        Parameters:
        iProp - property index
      • PofUpdater

        public PofUpdater​(PofNavigator navigator)
        Constructs a PofUpdater based on a POF navigator.
        Parameters:
        navigator - POF navigator
    • Method Detail

      • update

        public void update​(Object oTarget,
                           Object oValue)
        Update the state of the passed target object using the passed value. For intrinsic types, the specified value is expected to be a standard wrapper type in the same manner that reflection works; for example, an int value would be passed as a java.lang.Integer.
        Specified by:
        update in interface ValueUpdater
        Overrides:
        update in class AbstractUpdater
        Parameters:
        oTarget - the Object to update the state of
        oValue - the new value to update the state with
      • updateEntry

        public void updateEntry​(Map.Entry entry,
                                Object oValue)
        Update the passed entry using the specified value.

        It is expected that this updater will only be used against POF-encoded entries implementing BinaryEntry interface.

        Overrides:
        updateEntry in class AbstractUpdater
        Parameters:
        entry - the entry to update
        oValue - the new value to update the target's property with
        Throws:
        UnsupportedOperationException - if the specified target object is not a POF-encoded BinaryEntry or the serializer is not a PofContext
        PofNavigationException - if the property cannot be located (navigated to)
      • equals

        public boolean equals​(Object o)
        Compare the PofUpdater with another object to determine equality.
        Overrides:
        equals in class Object
        Returns:
        true iff this PofUpdater and the passed object are equivalent PofUpdaters
      • hashCode

        public int hashCode()
        Determine a hash value for the PofUpdater object according to the general Object.hashCode() contract.
        Overrides:
        hashCode in class Object
        Returns:
        an integer hash value for this PofUpdater object
      • toString

        public String toString()
        Return a human-readable description for this PofUpdater.
        Overrides:
        toString in class Object
        Returns:
        a String description of the PofUpdater
      • readExternal

        public void readExternal​(PofReader in)
                          throws IOException
        Restore the contents of a user type instance by reading its state using the specified PofReader object.
        Specified by:
        readExternal in interface PortableObject
        Parameters:
        in - the PofReader from which to read the object's state
        Throws:
        IOException - if an I/O error occurs
      • writeExternal

        public void writeExternal​(PofWriter out)
                           throws IOException
        Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
        Specified by:
        writeExternal in interface PortableObject
        Parameters:
        out - the PofWriter to which to write the object's state
        Throws:
        IOException - if an I/O error occurs