org.kitesdk.morphline.stdlib
Class TryRulesBuilder
java.lang.Object
org.kitesdk.morphline.stdlib.TryRulesBuilder
- All Implemented Interfaces:
- CommandBuilder
public final class TryRulesBuilder
- extends Object
- implements CommandBuilder
A tryRules command consists of zero or more rules.
A rule consists of zero or more commands.
The rules of a tryRules command are processed in top-down order. If one of the commands in a rule
fails, the tryRules command stops processing of this rule, backtracks and tries the next rule,
and so on, until a rule is found that runs all its commands to completion without failure (the
rule succeeds). If a rule succeeds the remaining rules of the current tryRules command are
skipped. If no rule succeeds the record remains unchanged, but a warning may be issued (the
warning can be turned off) or an exception may be thrown (which is logged and ignored in
production mode).
Because a command can itself be a tryRules command, there can be tryRules commands with commands,
nested inside tryRules, inside tryRules, recursively. This helps to implement arbitrarily complex
functionality for advanced usage.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TryRulesBuilder
public TryRulesBuilder()
getNames
public Collection<String> getNames()
- Description copied from interface:
CommandBuilder
- Returns the names with which this command can be invoked.
The returned set can contain synonyms to enable backwards compatible name changes.
- Specified by:
getNames
in interface CommandBuilder
build
public Command build(com.typesafe.config.Config config,
Command parent,
Command child,
MorphlineContext context)
- Description copied from interface:
CommandBuilder
- Creates and returns a command rooted at the given morphline JSON
config
.
The command will feed records into child
. The command will have
parent
as it's parent. Additional parameters can be passed via the morphline
context
.
- Specified by:
build
in interface CommandBuilder
Copyright © 2013–2014. All rights reserved.