public class IsbnBuilder extends Object
| Constructor and Description |
|---|
IsbnBuilder(Dummy4j dummy4j,
IsbnValidator validator,
InternationalNumberCheckDigitFormulaProvider checkDigitFormulaProvider) |
| Modifier and Type | Method and Description |
|---|---|
Isbn |
build()
Generates a random ISBN
|
String |
toString() |
IsbnBuilder |
withoutSeparator()
The generated ISBN will contain only digits and no separator
|
IsbnBuilder |
withPrefix(String prefix)
Sets the prefix of the generated ISBN.
|
IsbnBuilder |
withPublication(String publication)
Sets the publication of the generated ISBN.
|
IsbnBuilder |
withRandomPrefix()
Sets a random prefix for the generated ISBN to one that is randomly chosen from the yml definitions.
|
IsbnBuilder |
withRandomPrefix(String... prefixes)
Sets the prefix for the generated ISBN to one that is randomly chosen from provided arguments.
|
IsbnBuilder |
withRandomPublication()
Sets a random publication for the generated ISBN.
|
IsbnBuilder |
withRandomPublication(String... publications)
Sets the publication for the generated ISBN to one that is randomly chosen from provided arguments.
|
IsbnBuilder |
withRandomRegistrant()
Sets a random registrant for the generated ISBN.
|
IsbnBuilder |
withRandomRegistrant(String... registrants)
Sets the registrant for the generated ISBN to one that is randomly chosen from provided arguments.
|
IsbnBuilder |
withRandomRegistrationGroup()
Sets a random registration group for the generated ISBN.
|
IsbnBuilder |
withRandomRegistrationGroup(String... registrationGroups)
Sets the registration group for the generated ISBN to one that is randomly chosen from provided arguments.
|
IsbnBuilder |
withRandomSeparator()
Sets a separator for the generated ISBN to one that is randomly chosen from the yml definitions.
|
IsbnBuilder |
withRandomSeparator(String... separators)
Sets the separator for the generated ISBN to one that is randomly chosen from provided arguments
|
IsbnBuilder |
withRandomType()
Sets a random type for the generated ISBN (10 or 13 character length).
|
IsbnBuilder |
withRandomType(IsbnType... types)
Sets the type for the generated ISBN to one that is randomly chosen from provided arguments
|
IsbnBuilder |
withRegistrant(String registrant)
Sets the registrant of the generated ISBN.
|
IsbnBuilder |
withRegistrationGroup(String group)
Sets the registration group of the generated ISBN.
|
IsbnBuilder |
withSeparator(String separator)
Sets the separator used for formatting ISBN
|
IsbnBuilder |
withType(IsbnType type)
Sets the type of the generated ISBN
|
public IsbnBuilder(Dummy4j dummy4j, IsbnValidator validator, InternationalNumberCheckDigitFormulaProvider checkDigitFormulaProvider)
public IsbnBuilder withRandomType()
This is the default behavior for this builder.
IsbnTypepublic IsbnBuilder withRandomType(IsbnType... types)
IsbnTypepublic IsbnBuilder withType(IsbnType type)
IsbnTypepublic IsbnBuilder withRandomPrefix()
This is the default behavior for this builder.
public IsbnBuilder withRandomPrefix(String... prefixes)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided arguments fail validationpublic IsbnBuilder withPrefix(String prefix)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided argument fails validationpublic IsbnBuilder withRandomRegistrationGroup()
This is the default behavior for this builder.
public IsbnBuilder withRandomRegistrationGroup(String... registrationGroups)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided arguments fail validationpublic IsbnBuilder withRegistrationGroup(String group)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided argument fails validationpublic IsbnBuilder withRandomRegistrant()
This is the default behavior for this builder.
public IsbnBuilder withRandomRegistrant(String... registrants)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided arguments fail validation*public IsbnBuilder withRegistrant(String registrant)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided argument fails validationpublic IsbnBuilder withRandomPublication()
This is the default behavior for this builder.
public IsbnBuilder withRandomPublication(String... publications)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided arguments fail validationpublic IsbnBuilder withPublication(String publication)
The builder tries to adjust the length of the remaining auto-generated ISBN elements so that the valid ISBN length is preserved.
However, combining custom prefixes, registration groups, registrants or publications can result in invalid ISBN if their combined length would not produce a valid ISBN and the builder would have no auto-generated elements left to trim (or trimming them would still not produce a valid ISBN length.
Therefore, it is advised to make sure that every combination of parameters passed to this builder would produce an ISBN of valid length.
InvalidIsbnParameterException - when the provided argument fails validationpublic IsbnBuilder withRandomSeparator()
This is the default behavior for this builder.
public IsbnBuilder withRandomSeparator(String... separators)
public IsbnBuilder withSeparator(String separator)
public IsbnBuilder withoutSeparator()
public Isbn build()
Copyright © 2022. All rights reserved.