Class RequestFieldData

    • Constructor Detail

      • RequestFieldData

        public RequestFieldData​(@Nonnull
                                RequestFieldData aRF)
        Copy constructor
        Parameters:
        aRF - The request field to copy the values from. May not be null.
      • RequestFieldData

        public RequestFieldData​(@Nonnull @Nonempty
                                String sFieldName)
        Create a new request field that has no default value
        Parameters:
        sFieldName - The field name to use. May neither be null nor empty.
      • RequestFieldData

        public RequestFieldData​(@Nonnull @Nonempty
                                String sFieldName,
                                @Nullable
                                String sDefaultValue)
        Default constructor.
        Parameters:
        sFieldName - The field name to use. May neither be null nor empty.
        sDefaultValue - The default value to use, if no value is present in the request scope.
    • Method Detail

      • getDefaultValue

        @Nonnull
        @OverrideOnDemand
        public String getDefaultValue()
        Returns:
        The default value to be used if no request parameter is present. Is never null but an empty string if no default value is available.
      • getRequestValueWithoutDefault

        @Nullable
        protected final String getRequestValueWithoutDefault()
        Helper method to get the request value without falling back to the provided default value.
        Returns:
        null if no such request value is present
      • getRequestValue

        @Nonnull
        public final String getRequestValue()
        Get the value of the request - optionally falling back to the provided default value if no such request parameter is present
        Returns:
        A single request value as string.
      • hasRequestValue

        public final boolean hasRequestValue​(@Nonnull
                                             String sExpectedValue)
        Utility method that checks if the passed expected value matches the request parameter (considering the fallback mechanism)
        Parameters:
        sExpectedValue - The expected value. May not be null.
        Returns:
        true if the passed value equals the actual request value