Skip to content

Commit

Permalink
updated visitor parameters to final.
Browse files Browse the repository at this point in the history
Signed-off-by: Asif Sohail Mohammed <[email protected]>
  • Loading branch information
asifsmohammed committed Nov 5, 2021
1 parent 6b086c9 commit 3d006ec
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class LogstashVisitor extends LogstashBaseVisitor {

@Override
public Object visitConfig(LogstashParser.ConfigContext configContext) {
public Object visitConfig(final LogstashParser.ConfigContext configContext) {
final Map<LogstashPluginType, List<LogstashPlugin>> pluginSections = new LinkedHashMap<>();

configContext.plugin_section().forEach(pluginSection -> {
Expand All @@ -44,15 +44,15 @@ public Object visitConfig(LogstashParser.ConfigContext configContext) {
}

@Override
public Object visitPlugin_section(LogstashParser.Plugin_sectionContext pluginSectionContext) {
public Object visitPlugin_section(final LogstashParser.Plugin_sectionContext pluginSectionContext) {

return pluginSectionContext.branch_or_plugin().stream()
.map(this::visitBranch_or_plugin)
.collect(Collectors.toList());
}

@Override
public Object visitBranch_or_plugin(LogstashParser.Branch_or_pluginContext branchOrPluginContext) {
public Object visitBranch_or_plugin(final LogstashParser.Branch_or_pluginContext branchOrPluginContext) {

if (branchOrPluginContext.getChild(0) instanceof LogstashParser.PluginContext)
return visitPlugin(branchOrPluginContext.plugin());
Expand All @@ -61,7 +61,7 @@ public Object visitBranch_or_plugin(LogstashParser.Branch_or_pluginContext branc
}

@Override
public Object visitPlugin(LogstashParser.PluginContext pluginContext) {
public Object visitPlugin(final LogstashParser.PluginContext pluginContext) {
final String pluginName = pluginContext.name().getText();
final List<LogstashAttribute> logstashAttributeList = pluginContext.attributes().attribute().stream()
.map(attribute -> (LogstashAttribute) visitAttribute(attribute))
Expand All @@ -74,7 +74,7 @@ public Object visitPlugin(LogstashParser.PluginContext pluginContext) {
}

@Override
public Object visitAttribute(LogstashParser.AttributeContext attributeContext) {
public Object visitAttribute(final LogstashParser.AttributeContext attributeContext) {
LogstashValueType logstashValueType = null;
Object value = null;

Expand Down Expand Up @@ -102,7 +102,7 @@ else if (attributeContext.value().STRING() != null && attributeContext.value().g
value = attributeContext.value().getText().replaceAll("^\"|\"$|^'|'$", "");
}

LogstashAttributeValue logstashAttributeValue = LogstashAttributeValue.builder()
final LogstashAttributeValue logstashAttributeValue = LogstashAttributeValue.builder()
.attributeValueType(logstashValueType)
.value(value)
.build();
Expand All @@ -114,19 +114,19 @@ else if (attributeContext.value().STRING() != null && attributeContext.value().g
}

@Override
public Object visitArray(LogstashParser.ArrayContext arrayContext) {
public Object visitArray(final LogstashParser.ArrayContext arrayContext) {
return arrayContext.value().stream()
.map(RuleContext::getText)
.collect(Collectors.toList());
}

@Override
public Object visitHash(LogstashParser.HashContext hashContext) {
public Object visitHash(final LogstashParser.HashContext hashContext) {
return visitHashentries(hashContext.hashentries());
}

@Override
public Object visitHashentries(LogstashParser.HashentriesContext hashentriesContext) {
public Object visitHashentries(final LogstashParser.HashentriesContext hashentriesContext) {
final Map<String, Object> hashEntries = new LinkedHashMap<>();

hashentriesContext.hashentry().forEach(hashentryContext -> {
Expand All @@ -139,7 +139,7 @@ public Object visitHashentries(LogstashParser.HashentriesContext hashentriesCont
}

@Override
public Object visitHashentry(LogstashParser.HashentryContext hashentryContext) {
public Object visitHashentry(final LogstashParser.HashentryContext hashentryContext) {
if (hashentryContext.value().getChild(0) instanceof LogstashParser.ArrayContext)
return visitArray(hashentryContext.value().array());

Expand Down

0 comments on commit 3d006ec

Please sign in to comment.