@FunctionalInterface @ThreadSafe public interface SchemaNameAdjuster
_)
characters (e.g., [A-Z,a-z,0-9,_]).
A SchemaNameAdjuster can determine if the supplied fullname follows these Avro rules.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SchemaNameAdjuster.ReplacementFunction
Function used to determine the replacement for a character that is not valid per Avro rules.
|
static interface |
SchemaNameAdjuster.ReplacementOccurred
Function used to report that an original value was replaced with an Avro-compatible string.
|
| Modifier and Type | Field and Description |
|---|---|
static SchemaNameAdjuster |
DEFAULT |
| Modifier and Type | Method and Description |
|---|---|
String |
adjust(String proposedName)
Convert the proposed string to a valid Avro fullname, replacing all invalid characters with the underscore ('_')
character.
|
static SchemaNameAdjuster |
create(char replacement,
SchemaNameAdjuster.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname adjuster that calls the supplied
SchemaNameAdjuster.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static SchemaNameAdjuster |
create(org.slf4j.Logger logger)
Create a stateful Avro fullname adjuster 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 SchemaNameAdjuster |
create(org.slf4j.Logger logger,
SchemaNameAdjuster.ReplacementOccurred uponConflict)
Create a stateful Avro fullname adjuster that logs a warning the first time an invalid fullname is seen and replaced
with a valid fullname.
|
static SchemaNameAdjuster |
create(SchemaNameAdjuster.ReplacementFunction function,
SchemaNameAdjuster.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname adjuster that calls the supplied
SchemaNameAdjuster.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static SchemaNameAdjuster |
create(SchemaNameAdjuster.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname adjuster that calls the supplied
SchemaNameAdjuster.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static SchemaNameAdjuster |
create(String replacement,
SchemaNameAdjuster.ReplacementOccurred uponReplacement)
Create a stateful Avro fullname adjuster that calls the supplied
SchemaNameAdjuster.ReplacementOccurred function when an invalid
fullname is seen and replaced with a valid fullname. |
static SchemaNameAdjuster |
defaultAdjuster()
Create a stateful Avro fullname adjuster 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.
|
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,
SchemaNameAdjuster.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,
SchemaNameAdjuster.ReplacementFunction replacement,
SchemaNameAdjuster.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 SchemaNameAdjuster DEFAULT
String adjust(String proposedName)
proposedName - the proposed fullname; may not be nullstatic SchemaNameAdjuster defaultAdjuster()
static SchemaNameAdjuster create(org.slf4j.Logger logger)
logger - the logger to use; may not be nullstatic SchemaNameAdjuster create(org.slf4j.Logger logger, SchemaNameAdjuster.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 SchemaNameAdjuster create(SchemaNameAdjuster.ReplacementOccurred uponReplacement)
SchemaNameAdjuster.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 SchemaNameAdjuster create(char replacement, SchemaNameAdjuster.ReplacementOccurred uponReplacement)
SchemaNameAdjuster.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 SchemaNameAdjuster create(String replacement, SchemaNameAdjuster.ReplacementOccurred uponReplacement)
SchemaNameAdjuster.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 SchemaNameAdjuster create(SchemaNameAdjuster.ReplacementFunction function, SchemaNameAdjuster.ReplacementOccurred uponReplacement)
SchemaNameAdjuster.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, SchemaNameAdjuster.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, SchemaNameAdjuster.ReplacementFunction replacement, SchemaNameAdjuster.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 © 2020 JBoss by Red Hat. All rights reserved.