Class TypeUsage_Builder

  • Direct Known Subclasses:
    TypeUsage.Builder

    @Generated("org.inferred.freebuilder.processor.Processor")
    abstract class TypeUsage_Builder
    extends java.lang.Object
    Auto-generated superclass of TypeUsage.Builder, derived from the API of TypeUsage.
    • Constructor Detail

      • TypeUsage_Builder

        TypeUsage_Builder()
    • Method Detail

      • from

        public static TypeUsage.Builder from​(TypeUsage value)
        Creates a new builder using value as a template.

        If value is a partial, the builder will return more partials.

      • mapStart

        public TypeUsage.Builder mapStart​(java.util.function.IntUnaryOperator mapper)
        Replaces the value to be returned by TypeUsage.start() by applying mapper to it and using the result.
        Returns:
        this Builder object
        Throws:
        java.lang.NullPointerException - if mapper is null
        java.lang.IllegalStateException - if the field has not been set
      • start

        public int start()
        Returns the value that will be returned by TypeUsage.start().
        Throws:
        java.lang.IllegalStateException - if the field has not been set
      • mapEnd

        public TypeUsage.Builder mapEnd​(java.util.function.IntUnaryOperator mapper)
        Replaces the value to be returned by TypeUsage.end() by applying mapper to it and using the result.
        Returns:
        this Builder object
        Throws:
        java.lang.NullPointerException - if mapper is null
        java.lang.IllegalStateException - if the field has not been set
      • end

        public int end()
        Returns the value that will be returned by TypeUsage.end().
        Throws:
        java.lang.IllegalStateException - if the field has not been set
      • mapType

        public TypeUsage.Builder mapType​(java.util.function.UnaryOperator<QualifiedName> mapper)
        Replaces the value to be returned by TypeUsage.type() by applying mapper to it and using the result.
        Returns:
        this Builder object
        Throws:
        java.lang.NullPointerException - if mapper is null or returns null
        java.lang.IllegalStateException - if the field has not been set
      • type

        public QualifiedName type()
        Returns the value that will be returned by TypeUsage.type().
        Throws:
        java.lang.IllegalStateException - if the field has not been set
      • mapScope

        public TypeUsage.Builder mapScope​(java.util.function.UnaryOperator<QualifiedName> mapper)
        If the value to be returned by TypeUsage.scope() is present, replaces it by applying mapper to it and using the result.

        If the result is null, clears the value.

        Returns:
        this Builder object
        Throws:
        java.lang.NullPointerException - if mapper is null
      • mergeFrom

        public TypeUsage.Builder mergeFrom​(TypeUsage value)
        Copies values from value, skipping empty optionals.
        Returns:
        this Builder object
      • mergeFrom

        public TypeUsage.Builder mergeFrom​(TypeUsage.Builder template)
        Copies values from template, skipping empty optionals and unset properties.
        Returns:
        this Builder object
      • clear

        public TypeUsage.Builder clear()
        Resets the state of this builder.
        Returns:
        this Builder object
      • build

        public TypeUsage build()
        Returns a newly-created TypeUsage based on the contents of this Builder.
        Throws:
        java.lang.IllegalStateException - if any field has not been set
      • buildPartial

        public TypeUsage buildPartial()
        Returns a newly-created partial TypeUsage for use in unit tests. State checking will not be performed. Unset properties will throw an UnsupportedOperationException when accessed via the partial object.

        The builder returned by from(TypeUsage) will propagate the partial status of its input, overriding build() to return another partial. This allows for robust tests of modify-rebuild code.

        Partials should only ever be used in tests. They permit writing robust test cases that won't fail if this type gains more application-level constraints (e.g. new required fields) in future. If you require partially complete values in production code, consider using a Builder.