Class URLGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<T>
org.instancio.internal.generator.net.URLGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<URL>
,Generator<URL>
,GeneratorSpec<URL>
,URLGeneratorSpec
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.Specifies a generator for the file name.Returns a generated value.Specifies a generator for the host name.port
(int port) Specifies the port number.Generate a random protocol from the given choices.Specifies that a random port number between 1 and 65535 (inclusive) should be generated.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
getContext, hints
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.instancio.generator.AsStringGeneratorSpec
asString, asString
-
Constructor Details
-
URLGenerator
-
-
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<URL>
- Returns:
- spec name if defined, or
null
otherwise
-
protocol
Description copied from interface:URLGeneratorSpec
Generate a random protocol from the given choices. If not specified, the default is HTTP.- Specified by:
protocol
in interfaceURLGeneratorSpec
- Parameters:
protocols
- one or more values from which a random protocol will be selected- Returns:
- spec builder
-
port
Description copied from interface:URLGeneratorSpec
Specifies the port number. If not specified, default port-1
will be used.- Specified by:
port
in interfaceURLGeneratorSpec
- Parameters:
port
- port number to use- Returns:
- spec builder
-
randomPort
Description copied from interface:URLGeneratorSpec
Specifies that a random port number between 1 and 65535 (inclusive) should be generated.- Specified by:
randomPort
in interfaceURLGeneratorSpec
- Returns:
- spec builder
-
host
Description copied from interface:URLGeneratorSpec
Specifies a generator for the host name. If not specified, a random host name will be generated.- Specified by:
host
in interfaceURLGeneratorSpec
- Parameters:
hostGenerator
- generator for the host name- Returns:
- spec builder
-
file
Description copied from interface:URLGeneratorSpec
Specifies a generator for the file name. If not specified, blank file name will be used.- Specified by:
file
in interfaceURLGeneratorSpec
- Parameters:
fileGenerator
- generator for the file- Returns:
- spec builder
-
generate
Description copied from interface:Generator
Returns a generated value.If this method produces random data, the data needs to be generated using the provided
Random
instance. This ensures generated values are reproducible for a given seed value.
-