Class EmailGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<String>
org.instancio.internal.generator.domain.internet.EmailGenerator
- All Implemented Interfaces:
Generator<String>,GeneratorSpec<String>,AsGeneratorSpec<String>,EmailAsGeneratorSpec,EmailGeneratorSpec,EmailSpec,NullableGeneratorSpec<String>,ValueSpec<String>,InternalLengthGeneratorSpec<String>
public class EmailGenerator
extends AbstractGenerator<String>
implements EmailSpec, EmailAsGeneratorSpec, InternalLengthGeneratorSpec<String>
Internal generator used for generating email addresses for fields annotated
with
@Email annotation from Jakarta Bean Validation API.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.length(int length) Specifies email address length.length(int min, int max) Specifies email address length range.nullable()Indicates thatnullvalue can be generated.nullable(boolean isNullable) protected StringtryGenerateNonNull(Random random) Makes the best effort to return a non-null value.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullableMethods 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, asString
-
Constructor Details
-
EmailGenerator
public EmailGenerator() -
EmailGenerator
-
-
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<String>- Returns:
- spec name if defined, or
nullotherwise
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceEmailAsGeneratorSpec- Specified by:
nullablein interfaceEmailGeneratorSpec- Specified by:
nullablein interfaceEmailSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Specified by:
nullablein interfaceValueSpec<String>- Overrides:
nullablein classAbstractGenerator<String>- Returns:
- spec builder
-
nullable
- Overrides:
nullablein classAbstractGenerator<String>
-
length
Description copied from interface:EmailGeneratorSpecSpecifies email address length range.- Specified by:
lengthin interfaceEmailAsGeneratorSpec- Specified by:
lengthin interfaceEmailGeneratorSpec- Specified by:
lengthin interfaceEmailSpec- Specified by:
lengthin interfaceInternalLengthGeneratorSpec<String>- Parameters:
min- minimum length of address (inclusive)max- maximum length of address (inclusive)- Returns:
- spec builder
-
length
Description copied from interface:EmailGeneratorSpecSpecifies email address length.- Specified by:
lengthin interfaceEmailAsGeneratorSpec- Specified by:
lengthin interfaceEmailGeneratorSpec- Specified by:
lengthin interfaceEmailSpec- Parameters:
length- of email address- Returns:
- spec builder
-
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<String>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-