Class SMFAttribute

    • Method Detail

      • componentCount

        public int componentCount()
        Specified by:
        componentCount in interface SMFAttributeType
        Returns:
        The number of components in the attribute
      • sizeOctets

        public int sizeOctets()
        Specified by:
        sizeOctets in interface SMFAttributeType
        Returns:
        The size of the attribute in octets
      • withName

        public final SMFAttribute withName​(SMFAttributeName value)
        Copy the current immutable object by setting a value for the name attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for name
        Returns:
        A modified copy of the this object
      • withComponentType

        public final SMFAttribute withComponentType​(SMFComponentType value)
        Copy the current immutable object by setting a value for the componentType attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for componentType
        Returns:
        A modified copy of the this object
      • withComponentCount

        public final SMFAttribute withComponentCount​(int value)
        Copy the current immutable object by setting a value for the componentCount attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for componentCount
        Returns:
        A modified copy of the this object
      • withComponentSizeBits

        public final SMFAttribute withComponentSizeBits​(int value)
        Copy the current immutable object by setting a value for the componentSizeBits attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for componentSizeBits
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(java.lang.Object another)
        This instance is equal to all instances of SMFAttribute that have equal attribute values.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: name, componentType, componentCount, componentSizeBits, componentSizeOctets, sizeOctets.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value SMFAttribute with attribute values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the value
      • of

        public static SMFAttribute of​(SMFAttributeName name,
                                      SMFComponentType componentType,
                                      int componentCount,
                                      int componentSizeBits)
        Construct a new immutable SMFAttribute instance.
        Parameters:
        name - The value for the name attribute
        componentType - The value for the componentType attribute
        componentCount - The value for the componentCount attribute
        componentSizeBits - The value for the componentSizeBits attribute
        Returns:
        An immutable SMFAttribute instance
      • copyOf

        public static SMFAttribute copyOf​(SMFAttributeType instance)
        Creates an immutable copy of a SMFAttributeType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable SMFAttribute instance
      • builder

        public static SMFAttribute.Builder builder()
        Creates a builder for SMFAttribute.
         SMFAttribute.builder()
            .setName(com.io7m.smfj.core.SMFAttributeName) // required name
            .setComponentType(com.io7m.smfj.core.SMFComponentType) // required componentType
            .setComponentCount(int) // required componentCount
            .setComponentSizeBits(int) // required componentSizeBits
            .build();
         
        Returns:
        A new SMFAttribute builder