Package nzilbb.util

Interface CloneableBean

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default javax.json.JsonObjectBuilder addExtraJsonAttributes​(javax.json.JsonObjectBuilder json)
      Called at the end of the default implementation of toJson(), this method allows implementors to add any extra properties required to the JsonObjectBuilder before it's built.
      default void clonePropertiesFrom​(CloneableBean other, String except)
      Copies the other bean's cloned properties to this bean.
      default CloneableBean fromJson​(javax.json.JsonObject json)
      Initializes the bean with the given JSON representation.
      default Set<String> getClonedAttributes()
      Keys for attributes that are cloned/serialized - i.e.
      default Method getter​(String key)
      Access the class's getter for the given attribute.
      default Method setter​(String key)
      Access the class's setter for the given attribute.
      default javax.json.JsonObject toJson()
      Serializes the bean as a JsonObject.
    • Method Detail

      • getClonedAttributes

        default Set<String> getClonedAttributes()
        Keys for attributes that are cloned/serialized - i.e. when a subclass object is cloned, only these attributes are copied into the clone.
        Returns:
        A set of attributes whose values are cloned.
      • toJson

        default javax.json.JsonObject toJson()
        Serializes the bean as a JsonObject.
        Returns:
        A JSON representation of the bean.
      • addExtraJsonAttributes

        default javax.json.JsonObjectBuilder addExtraJsonAttributes​(javax.json.JsonObjectBuilder json)
        Called at the end of the default implementation of toJson(), this method allows implementors to add any extra properties required to the JsonObjectBuilder before it's built.
        Parameters:
        json - The JSON object being built.
        Returns:
        The builder with any added properties.
      • fromJson

        default CloneableBean fromJson​(javax.json.JsonObject json)
        Initializes the bean with the given JSON representation.
        Parameters:
        json -
        Returns:
        A reference to this bean.
      • clonePropertiesFrom

        default void clonePropertiesFrom​(CloneableBean other,
                                         String except)
        Copies the other bean's cloned properties to this bean.
      • getter

        default Method getter​(String key)
        Access the class's getter for the given attribute.
        Parameters:
        key -
        Returns:
        The getter, or null if there isn't one.
      • setter

        default Method setter​(String key)
        Access the class's setter for the given attribute.
        Parameters:
        key -
        Returns:
        The setter, or null if there isn't one.