* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
/**
* This static final class contains utility methods for Avro schemas.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class AvroSchemaKeyTranslationUtilities {
/**
* Default constructor to avoid subclassing.
*/
- private AvroSchemaKeyTranslationUtilities() {}
+ private AvroSchemaKeyTranslationUtilities() {
+ // Private constructor to prevent subclassing
+ }
/**
- * Translate characters in JSON keys to values that are legal in Avro. Avro names must start
- * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_]
+ * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and
+ * subsequently contain only [A-Za-z0-9_]
*
* @param jsonString The JSON string to translate
* @param revert True if we want to revert the field names to their original values
}
// Create a JSON element for the incoming JSON string
- final JsonElement jsonElement =
- new GsonBuilder().serializeNulls().create().fromJson(jsonString, JsonElement.class);
+ final JsonElement jsonElement = new GsonBuilder().serializeNulls().create().fromJson(jsonString,
+ JsonElement.class);
final JsonElement translatedJsonElement = translateIllegalKeys(jsonElement, revert);
}
/**
- * Translate characters in JSON keys to values that are legal in Avro. Avro names must start
- * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_]
+ * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and
+ * subsequently contain only [A-Za-z0-9_]
*
* @param jsonElement The JSON element to translate
* @param revert True if we want to revert the field names to their original values
}
/**
- * Translate characters in JSON keys to values that are legal in Avro. Avro names must start
- * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_]
+ * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and
+ * subsequently contain only [A-Za-z0-9_]
*
* @param jsonObject The JSON object to translate
* @param revert True if we want to revert the field names to their original values
}
/**
- * Translate characters in JSON keys to values that are legal in Avro. Avro names must start
- * with [A-Za-z_] and subsequently contain only [A-Za-z0-9_]
+ * Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and
+ * subsequently contain only [A-Za-z0-9_]
*
* @param jsonArray The JSON array to translate
* @param revert True if we want to revert the field names to their original values
}
/**
- * Translate characters in a single JSON key to values that are legal in Avro. Avro names must
- * start with [A-Za-z_] and subsequently contain only [A-Za-z0-9_]
+ * Translate characters in a single JSON key to values that are legal in Avro. Avro names must start with [A-Za-z_]
+ * and subsequently contain only [A-Za-z0-9_]
*
* @param key The key to translate
* @param revert True if we want to revert the field names to their original values