Class JsonrpcObject<IdType>

  • Type Parameters:
    IdType - "id" type parameter
    Direct Known Subclasses:
    RequestObject, ResponseObject

    public abstract class JsonrpcObject<IdType>
    extends Object
    An abstract class for request objects and response objects.
    Author:
    Jin Kwon <onacit_at_gmail.com>
    • Field Detail

      • PROPERTY_NAME_JSONRPC

        public static final String PROPERTY_NAME_JSONRPC
        The property name for $.jsonrpc. The value is "jsonrpc".
        See Also:
        Constant Field Values
      • PROPERTY_NAME_ID

        public static final String PROPERTY_NAME_ID
        The property name for $.id. The value is "id".
        See Also:
        Constant Field Values
    • Constructor Detail

      • JsonrpcObject

        public JsonrpcObject()
        Creates a new instance.
    • Method Detail

      • isIdEitherStringNumberOfNull

        @AssertTrue
        protected @javax.validation.constraints.AssertTrue boolean isIdEitherStringNumberOfNull()
        Indicates whether the current value of "id" property is, semantically, either string, number, or null.

        The isIdEitherStringNumberOfNull() method of JsonrpcObject class returns the value of following expression.

        
         getId() == null || getId() instanceof java.lang.String || getId() instanceof java.lang.Number
         
        Returns:
        true if the value of "id" property is, semantically, either string, number, or null; false otherwise.
      • toString

        public String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the object.
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value for this object.
      • setJsonrpc

        public void setJsonrpc​(String jsonrpc)
        Replaces the current value of "jsonrpc" property with specified value.
        Parameters:
        jsonrpc - new value for "jsonrpc" property.
      • getId

        public IdType getId()
        Returns the current value of "id" property.
        Returns:
        the current value of "id" property.
      • setId

        public void setId​(IdType id)
        Replaces the current value of "id" property with specified value.
        Parameters:
        id - new value for "id" property.