@FunctionalInterface @ThreadSafe public interface AvroValidator
_)
characters (e.g., [A-Z,a-z,0-9,_]).
An AvroValidator can determine if the supplied fullname follows these Avro rules.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
AvroValidator.ReplacementFunction
Function used to determine the replacement for a character that is not valid per Avro rules.
|
static interface |
AvroValidator.ReplacementOccurred
Function used to report that an original value was replaced with an Avro-compatible string.
|
| Modifier and Type | Field and Description |
|---|---|
static AvroValidator |
DEFAULT |
| Modifier and Type | Method and Description |
|---|---|
static AvroValidator |
create(AvroValidator.ReplacementFunction function,
AvroValidator.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname validator that calls the supplied
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static AvroValidator |
create(AvroValidator.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname validator that calls the supplied
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static AvroValidator |
create(char replacement,
AvroValidator.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname validator that calls the supplied
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static AvroValidator |
create(org.slf4j.Logger logger)
Create a stateful Avro fullname validator that logs a warning the first time an invalid fullname is seen and replaced
with a valid fullname, and throws an error if the replacement conflicts with that of a different original.
|
static AvroValidator |
create(org.slf4j.Logger logger,
AvroValidator.ReplacementOccurred uponConflict)
Create a stateful Avro fullname validator that logs a warning the first time an invalid fullname is seen and replaced
with a valid fullname.
|
static AvroValidator |
create(String replacement,
AvroValidator.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname validator that calls the supplied
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static AvroValidator |
defaultValidator()
Create a stateful Avro fullname validator that logs a warning the first time an invalid fullname is seen and replaced
with a valid fullname and throws an exception.
|
static boolean |
isValidFullname(String fullname)
Determine if the supplied string is a valid Avro namespace.
|
static boolean |
isValidFullnameFirstCharacter(char c)
Determine if the supplied character is a valid first character for Avro fullnames.
|
static boolean |
isValidFullnameNonFirstCharacter(char c)
Determine if the supplied character is a valid non-first character for Avro fullnames.
|
String |
validate(String proposedName)
Convert the proposed string to a valid Avro fullname, replacing all invalid characters with the underscore ('_')
character.
|
static String |
validFullname(String proposedName)
Convert the proposed string to a valid Avro fullname, replacing all invalid characters with the underscore ('_') character.
|
static String |
validFullname(String proposedName,
AvroValidator.ReplacementFunction replacement)
Convert the proposed string to a valid Avro fullname, using the supplied function to replace all invalid characters.
|
static String |
validFullname(String proposedName,
AvroValidator.ReplacementFunction replacement,
AvroValidator.ReplacementOccurred uponReplacement)
Convert the proposed string to a valid Avro fullname, using the supplied function to replace all invalid characters.
|
static String |
validFullname(String proposedName,
String replacement)
Convert the proposed string to a valid Avro fullname, replacing all invalid characters with the supplied string.
|
static final AvroValidator DEFAULT
String validate(String proposedName)
proposedName - the proposed fullname; may not be nullstatic AvroValidator defaultValidator()
static AvroValidator create(org.slf4j.Logger logger)
logger - the logger to use; may not be nullstatic AvroValidator create(org.slf4j.Logger logger, AvroValidator.ReplacementOccurred uponConflict)
logger - the logger to use; may not be nulluponConflict - the function to be called when there is a conflict and after that conflict is logged; may be nullstatic AvroValidator create(AvroValidator.ReplacementOccurred uponReplacement)
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. This method replaces all invalid characters with the underscore
character ('_').uponReplacement - the function called each time the original fullname is replaced; may be nullstatic AvroValidator create(char replacement, AvroValidator.ReplacementOccurred uponReplacement)
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname.replacement - the character that should be used to replace all invalid charactersuponReplacement - the function called each time the original fullname is replaced; may be nullstatic AvroValidator create(String replacement, AvroValidator.ReplacementOccurred uponReplacement)
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname.replacement - the character sequence that should be used to replace all invalid charactersuponReplacement - the function called each time the original fullname is replaced; may be nullstatic AvroValidator create(AvroValidator.ReplacementFunction function, AvroValidator.ReplacementOccurred uponReplacement)
AvroValidator.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname.function - the replacement functionuponReplacement - the function called each time the original fullname is replaced; may be nullstatic boolean isValidFullname(String fullname)
fullname - the name to be used as an Avro fullname; may not be nulltrue if the fullname satisfies Avro rules, or false otherwisestatic boolean isValidFullnameFirstCharacter(char c)
c - the charactertrue if the character is a valid first character of an Avro fullname, or false otherwiseisValidFullname(String)static boolean isValidFullnameNonFirstCharacter(char c)
c - the charactertrue if the character is a valid non-first character of an Avro fullname, or false otherwiseisValidFullname(String)static String validFullname(String proposedName)
proposedName - the proposed fullname; may not be nullstatic String validFullname(String proposedName, String replacement)
proposedName - the proposed fullname; may not be nullreplacement - the character sequence that should be used to replace all invalid charactersstatic String validFullname(String proposedName, AvroValidator.ReplacementFunction replacement)
proposedName - the proposed fullname; may not be nullreplacement - the character sequence that should be used to replace all invalid charactersstatic String validFullname(String proposedName, AvroValidator.ReplacementFunction replacement, AvroValidator.ReplacementOccurred uponReplacement)
proposedName - the proposed fullname; may not be nullreplacement - the character sequence that should be used to replace all invalid charactersuponReplacement - the function to be called every time the proposed name is invalid and replaced; may be nullCopyright © 2017 JBoss by Red Hat. All rights reserved.