Class Ip4Generator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<String>
org.instancio.internal.generator.domain.internet.Ip4Generator
- All Implemented Interfaces:
Generator<String>
,GeneratorSpec<String>
,Ip4GeneratorSpec
,Ip4Spec
,NullableGeneratorSpec<String>
,ValueSpec<String>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.Generates IPv4 address from CIDR notation, for example:fromCidr("192.168.1.0/24")
.nullable()
Indicates thatnull
value can be generated.protected String
tryGenerateNonNull
(Random random) Makes the best effort to return a non-null value.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullable, nullable
-
Constructor Details
-
Ip4Generator
public Ip4Generator() -
Ip4Generator
-
-
Method Details
-
apiMethod
Description copied from class:AbstractGenerator
Returns the public API method name of the generator spec. The returned name is used for reporting validation errors.- Specified by:
apiMethod
in classAbstractGenerator<String>
- Returns:
- spec name if defined, or
null
otherwise
-
fromCidr
Description copied from interface:Ip4GeneratorSpec
Generates IPv4 address from CIDR notation, for example:fromCidr("192.168.1.0/24")
.- Specified by:
fromCidr
in interfaceIp4GeneratorSpec
- Specified by:
fromCidr
in interfaceIp4Spec
- Parameters:
cidr
- CIDR notation from which an IP address will be generated- Returns:
- generator spec
-
nullable
Description copied from interface:NullableGeneratorSpec
Indicates thatnull
value can be generated.- Specified by:
nullable
in interfaceNullableGeneratorSpec<String>
- Specified by:
nullable
in interfaceValueSpec<String>
- Overrides:
nullable
in classAbstractGenerator<String>
- Returns:
- spec builder
-
tryGenerateNonNull
Description copied from class:AbstractGenerator
Makes the best effort to return a non-null value. However, in certain cases this method will produce anull
.- Specified by:
tryGenerateNonNull
in classAbstractGenerator<String>
- Parameters:
random
- for generating the value- Returns:
- generated value, either a null or non-null
-