From f1d1085163a1ccc521ba289318f912b53c1f894b Mon Sep 17 00:00:00 2001 From: Isaac Hier Date: Mon, 6 Aug 2018 12:29:07 -0400 Subject: [PATCH] Add protected methods to Configuration so subclasses may extend it Signed-off-by: Isaac Hier --- .../java/io/jaegertracing/Configuration.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/jaeger-core/src/main/java/io/jaegertracing/Configuration.java b/jaeger-core/src/main/java/io/jaegertracing/Configuration.java index 976ee7f3d..849c91794 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/Configuration.java +++ b/jaeger-core/src/main/java/io/jaegertracing/Configuration.java @@ -181,7 +181,6 @@ public Configuration(String serviceName) { this.serviceName = JaegerTracer.Builder.checkValidServiceName(serviceName); } - /** * @return Configuration object from environmental variables */ @@ -462,7 +461,7 @@ public void apply(JaegerTracer.Builder builder) { registerCodec(builder, Format.Builtin.TEXT_MAP); } - protected void registerCodec(JaegerTracer.Builder builder, Format format) { + private void registerCodec(JaegerTracer.Builder builder, Format format) { if (codecs.containsKey(format)) { List> codecsForFormat = codecs.get(format); Codec codec = codecsForFormat.size() == 1 @@ -653,19 +652,19 @@ public static SenderConfiguration fromEnv() { } } - private static String stringOrDefault(String value, String defaultValue) { + protected static String stringOrDefault(String value, String defaultValue) { return value != null && value.length() > 0 ? value : defaultValue; } - private static Number numberOrDefault(Number value, Number defaultValue) { + protected static Number numberOrDefault(Number value, Number defaultValue) { return value != null ? value : defaultValue; } - private static String getProperty(String name) { + protected static String getProperty(String name) { return System.getProperty(name, System.getenv(name)); } - private static Integer getPropertyAsInt(String name) { + protected static Integer getPropertyAsInt(String name) { String value = getProperty(name); if (value != null) { try { @@ -677,7 +676,7 @@ private static Integer getPropertyAsInt(String name) { return null; } - private static Number getPropertyAsNum(String name) { + protected static Number getPropertyAsNum(String name) { String value = getProperty(name); if (value != null) { try { @@ -694,11 +693,11 @@ private static Number getPropertyAsNum(String name) { * the name. This method defaults to returning false for a name that doesn't exist. * @param name The name of the system property */ - private static boolean getPropertyAsBool(String name) { + protected static boolean getPropertyAsBool(String name) { return Boolean.valueOf(getProperty(name)); } - private static Map tracerTagsFromEnv() { + protected static Map tracerTagsFromEnv() { Map tracerTagMaps = null; String tracerTags = getProperty(JAEGER_TAGS); if (tracerTags != null) { @@ -718,7 +717,7 @@ private static Map tracerTagsFromEnv() { return tracerTagMaps; } - private static String resolveValue(String value) { + protected static String resolveValue(String value) { if (value.startsWith("${") && value.endsWith("}")) { String[] ref = value.substring(2, value.length() - 1).split("\\s*:\\s*"); if (ref.length > 0) {