Class URIGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<T>
org.instancio.internal.generator.net.URIGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<URI>,Generator<URI>,GeneratorSpec<URI>,AsGeneratorSpec<URI>,NullableGeneratorSpec<URI>,URIAsGeneratorSpec,URIGeneratorSpec,URISpec,ValueSpec<URI>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.Specifies a generator for the fragmentGenerator.Specifies a generator for the host name.nullable()Indicates thatnullvalue can be generated.Specifies a generator for the path.port(int port) Specifies the port number.Specifies a generator for the query.Specifies that a random port number between 1 and 65535 (inclusive) should be generated.Generate a random scheme from the given choices.protected URItryGenerateNonNull(Random random) Makes the best effort to return a non-null value.Specifies username.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullable, nullableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.instancio.generator.specs.AsGeneratorSpec
as, asStringMethods inherited from interface org.instancio.generator.AsStringGeneratorSpec
asString
-
Constructor Details
-
URIGenerator
public URIGenerator() -
URIGenerator
-
-
Method Details
-
apiMethod
Description copied from class:AbstractGeneratorReturns the public API method name of the generator spec. The returned name is used for reporting validation errors.- Specified by:
apiMethodin classAbstractGenerator<URI>- Returns:
- spec name if defined, or
nullotherwise
-
scheme
Description copied from interface:URIGeneratorSpecGenerate a random scheme from the given choices. If not specified, the default is HTTP.- Specified by:
schemein interfaceURIAsGeneratorSpec- Specified by:
schemein interfaceURIGeneratorSpec- Specified by:
schemein interfaceURISpec- Parameters:
schemes- one or more values from which a random scheme will be selected- Returns:
- spec builder
-
userInfo
Description copied from interface:URIGeneratorSpecSpecifies username. If not specified, anulluser will be generated.- Specified by:
userInfoin interfaceURIAsGeneratorSpec- Specified by:
userInfoin interfaceURIGeneratorSpec- Specified by:
userInfoin interfaceURISpec- Parameters:
userInfo- username to generate- Returns:
- spec builder
-
host
Description copied from interface:URIGeneratorSpecSpecifies a generator for the host name. If not specified, a random host name will be generated.- Specified by:
hostin interfaceURIAsGeneratorSpec- Specified by:
hostin interfaceURIGeneratorSpec- Specified by:
hostin interfaceURISpec- Parameters:
hostGenerator- generator for the host name- Returns:
- spec builder
-
port
Description copied from interface:URIGeneratorSpecSpecifies the port number. If not specified, default port-1will be used.- Specified by:
portin interfaceURIAsGeneratorSpec- Specified by:
portin interfaceURIGeneratorSpec- Specified by:
portin interfaceURISpec- Parameters:
port- port number to use- Returns:
- spec builder
-
randomPort
Description copied from interface:URIGeneratorSpecSpecifies that a random port number between 1 and 65535 (inclusive) should be generated.- Specified by:
randomPortin interfaceURIAsGeneratorSpec- Specified by:
randomPortin interfaceURIGeneratorSpec- Specified by:
randomPortin interfaceURISpec- Returns:
- spec builder
-
path
Description copied from interface:URIGeneratorSpecSpecifies a generator for the path. If not specified,nullpath will be generated.- Specified by:
pathin interfaceURIAsGeneratorSpec- Specified by:
pathin interfaceURIGeneratorSpec- Specified by:
pathin interfaceURISpec- Parameters:
path- generator for the path- Returns:
- spec builder
-
query
Description copied from interface:URIGeneratorSpecSpecifies a generator for the query. If not specified,nullquery will be generated.- Specified by:
queryin interfaceURIAsGeneratorSpec- Specified by:
queryin interfaceURIGeneratorSpec- Specified by:
queryin interfaceURISpec- Parameters:
queryGenerator- generator for the query- Returns:
- spec builder
-
fragment
Description copied from interface:URIGeneratorSpecSpecifies a generator for the fragmentGenerator. If not specified,nullfragmentGenerator will be generated.- Specified by:
fragmentin interfaceURIAsGeneratorSpec- Specified by:
fragmentin interfaceURIGeneratorSpec- Specified by:
fragmentin interfaceURISpec- Parameters:
fragmentGenerator- generator for the fragment- Returns:
- spec builder
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated. -
tryGenerateNonNull
Description copied from class:AbstractGeneratorMakes the best effort to return a non-null value. However, in certain cases this method will produce anull.- Specified by:
tryGenerateNonNullin classAbstractGenerator<URI>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-