Package com.helger.web.scope.util
Class RequestFieldDataMultiValue
- java.lang.Object
-
- com.helger.web.scope.util.AbstractRequestFieldData
-
- com.helger.web.scope.util.RequestFieldDataMultiValue
-
- Direct Known Subclasses:
SessionBackedRequestFieldDataMultiValue
@Immutable public class RequestFieldDataMultiValue extends AbstractRequestFieldData
Represents a wrapper around a single request value. It allows gathering the current values, optionally using default values.- Since:
- 9.0.2
- Author:
- Philip Helger
- See Also:
For single value class
-
-
Constructor Summary
Constructors Constructor Description RequestFieldDataMultiValue(RequestFieldDataMultiValue aRF)Copy constructorRequestFieldDataMultiValue(String sFieldName)Create a new request field that has no default valueRequestFieldDataMultiValue(String sFieldName, Collection<String> aDefaultValues)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)com.helger.commons.collection.impl.ICommonsList<String>getDefaultValues()com.helger.commons.collection.impl.ICommonsList<String>getRequestValues()Get the value of the request - optionally falling back to the provided default value if no such request parameter is presentprotected com.helger.commons.collection.impl.ICommonsList<String>getRequestValuesWithoutDefault()Helper method to get the request value without falling back to the provided default value.inthashCode()booleanhasRequestValues(Collection<String> aExpectedValues)Utility method that checks if the passed expected value matches the request parameter (considering the fallback mechanism)StringtoString()-
Methods inherited from class com.helger.web.scope.util.AbstractRequestFieldData
getFieldName, getParams
-
-
-
-
Constructor Detail
-
RequestFieldDataMultiValue
public RequestFieldDataMultiValue(@Nonnull RequestFieldDataMultiValue aRF)
Copy constructor- Parameters:
aRF- The request field to copy the values from. May not benull.
-
RequestFieldDataMultiValue
public RequestFieldDataMultiValue(@Nonnull @Nonempty String sFieldName)
Create a new request field that has no default value- Parameters:
sFieldName- The field name to use. May neither benullnor empty.
-
RequestFieldDataMultiValue
public RequestFieldDataMultiValue(@Nonnull @Nonempty String sFieldName, @Nullable Collection<String> aDefaultValues)
Default constructor.- Parameters:
sFieldName- The field name to use. May neither benullnor empty.aDefaultValues- The default values to use, if no value is present in the request scope.
-
-
Method Detail
-
getDefaultValues
@Nonnull @ReturnsMutableCopy @OverrideOnDemand public com.helger.commons.collection.impl.ICommonsList<String> getDefaultValues()
- Returns:
- The default values to be used if no request parameter is present.
Is never
nullbut an empty list if no default value is available.
-
getRequestValuesWithoutDefault
@Nullable protected final com.helger.commons.collection.impl.ICommonsList<String> getRequestValuesWithoutDefault()
Helper method to get the request value without falling back to the provided default value.- Returns:
nullif no such request value is present
-
getRequestValues
@Nonnull public final com.helger.commons.collection.impl.ICommonsList<String> getRequestValues()
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.
-
hasRequestValues
public final boolean hasRequestValues(@Nonnull Collection<String> aExpectedValues)
Utility method that checks if the passed expected value matches the request parameter (considering the fallback mechanism)- Parameters:
aExpectedValues- The list of expected values. May not benull.- Returns:
trueif the passed value equals the actual request value
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractRequestFieldData
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractRequestFieldData
-
toString
public String toString()
- Overrides:
toStringin classAbstractRequestFieldData
-
-