public class RandomValuePropertySource extends PropertySource<Random>
PropertySource
that returns a random value for any property that starts with
"random.". Where the "unqualified property name" is the portion of the
requested property name beyond the "random." prefix, this PropertySource
returns:
Integer
value, restricted by an optionally
specified range.Long
value, restricted by an optionally
specified range.byte[]
.
OPEN value (,max) CLOSE
where the OPEN,CLOSE
are any character and
value,max
are integers. If max
is not provided, then 0 is used as the
lower bound and value
is the upper bound. If max
is provided then
value
is the minimum value and max
is the maximum (exclusive).
PropertySource.StubPropertySource
Modifier and Type | Field and Description |
---|---|
static String |
RANDOM_PROPERTY_SOURCE_NAME
Name of the random
PropertySource . |
name, source
Constructor and Description |
---|
RandomValuePropertySource() |
RandomValuePropertySource(String name) |
Modifier and Type | Method and Description |
---|---|
static void |
addToEnvironment(ConfigurableEnvironment environment) |
Object |
getProperty(String name) |
containsProperty, equals, getName, getSource, hashCode, named, toString
public static final String RANDOM_PROPERTY_SOURCE_NAME
PropertySource
.public RandomValuePropertySource()
public RandomValuePropertySource(String name)
public Object getProperty(String name)
getProperty
in class PropertySource<Random>
public static void addToEnvironment(ConfigurableEnvironment environment)