Class DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase<U>

    • Constructor Detail

      • AbstractBase

        public AbstractBase()
    • Method Detail

      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(boolean value)

        Defines the supplied boolean value as a default value of the previously defined or matched field. The value can only be set for numeric fields of type boolean, byte, short, char or int. For non-boolean fields, the field's value is set to 0 for false or 1 for true.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(int value)

        Defines the supplied int value as a default value of the previously defined or matched field. The value can only be set for numeric fields of type boolean, byte, short, char or int where the value must be within the numeric type's range. The boolean type is regarded as a numeric type with the possible values of 0 and 1 representing false and true.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(long value)

        Defines the supplied long value as a default value of the previously defined or matched field.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(float value)

        Defines the supplied float value as a default value of the previously defined or matched field.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(double value)

        Defines the supplied double value as a default value of the previously defined or matched field.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • value

        public DynamicType.Builder.FieldDefinition.Optional<U> value​(java.lang.String value)

        Defines the supplied String value as a default value of the previously defined or matched field.

        Important: A default value in a Java class file defines a field's value prior to the class's initialization. This value is only visible to code if the field is declared static. A default value can also be set for non-static fields where the value is not visible to code. The Java compiler only defines such values for final fields.

        Specified by:
        value in interface DynamicType.Builder.FieldDefinition.Valuable<U>
        Parameters:
        value - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
      • defaultValue

        protected abstract DynamicType.Builder.FieldDefinition.Optional<U> defaultValue​(java.lang.Object defaultValue)
        Defines the supplied value as a default value of the previously defined or matched field.
        Parameters:
        defaultValue - The value to define as a default value of the defined field.
        Returns:
        A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.