Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.0.0
-
None
-
None
Description
Flume is filled with examples like so:
batchSize = Integer.parseInt(context.get("batch-size", String.class));
if (batchSize == null) {
batchSize = defaultBatchSize;
}
from AvroSink. The Context object should provide at a minimum:
- getBoolean(key)
- getBoolean(key, default)
- getInteger(key)
- getInteger(key, default)
- getLong(key)
- getLong(key, default)
Additionally, the Context object outside of tests, is populated via FlumeConfiguration which in the end is a properties file. In this common case, all the values in the Context object will be Strings. In this case, if we do the obvious and simply provide wrappers for getBoolean, we end up executing:
return Boolean.class.cast(String);
Users of the Context object should not care where the values come from, only that they will be returned the correct object type.