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>,AsGeneratorSpec<URL>,NullableGeneratorSpec<URL>,URLAsGeneratorSpec,URLGeneratorSpec,URLSpec,ValueSpec<URL>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.Specifies a generator for the file name.Specifies a generator for the host name.nullable()Indicates thatnullvalue can be generated.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.protected URLtryGenerateNonNull(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, 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
-
URLGenerator
public URLGenerator() -
URLGenerator
-
-
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<URL>- Returns:
- spec name if defined, or
nullotherwise
-
protocol
Description copied from interface:URLGeneratorSpecGenerate a random protocol from the given choices. If not specified, the default is HTTP.- Specified by:
protocolin interfaceURLAsGeneratorSpec- Specified by:
protocolin interfaceURLGeneratorSpec- Specified by:
protocolin interfaceURLSpec- Parameters:
protocols- one or more values from which a random protocol will be selected- Returns:
- spec builder
-
port
Description copied from interface:URLGeneratorSpecSpecifies the port number. If not specified, default port-1will be used.- Specified by:
portin interfaceURLAsGeneratorSpec- Specified by:
portin interfaceURLGeneratorSpec- Specified by:
portin interfaceURLSpec- Parameters:
port- port number to use- Returns:
- spec builder
-
randomPort
Description copied from interface:URLGeneratorSpecSpecifies that a random port number between 1 and 65535 (inclusive) should be generated.- Specified by:
randomPortin interfaceURLAsGeneratorSpec- Specified by:
randomPortin interfaceURLGeneratorSpec- Specified by:
randomPortin interfaceURLSpec- Returns:
- spec builder
-
host
Description copied from interface:URLGeneratorSpecSpecifies a generator for the host name. If not specified, a random host name will be generated.- Specified by:
hostin interfaceURLAsGeneratorSpec- Specified by:
hostin interfaceURLGeneratorSpec- Specified by:
hostin interfaceURLSpec- Parameters:
hostGenerator- generator for the host name- Returns:
- spec builder
-
file
Description copied from interface:URLGeneratorSpecSpecifies a generator for the file name. If not specified, blank file name will be used.- Specified by:
filein interfaceURLAsGeneratorSpec- Specified by:
filein interfaceURLGeneratorSpec- Specified by:
filein interfaceURLSpec- Parameters:
fileGenerator- generator for the file- 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<URL>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-