org.apache.hivemind.schema.rules
Class RuleUtils

java.lang.Object
  extended by org.apache.hivemind.schema.rules.RuleUtils

public class RuleUtils
extends java.lang.Object

Static methods useful to Rules and Translators.

Author:
Howard Lewis Ship

Constructor Summary
RuleUtils()
           
 
Method Summary
static java.util.Map convertInitializer(java.lang.String initializer)
          Used to convert a Translator initializer string of the form: key=value[,key=value]* into a Map of keys and values.
static Translator getTranslator(SchemaProcessor processor, java.lang.String translator)
          Convienience for invoking Module.getTranslator(String).
static java.lang.String processText(SchemaProcessor processor, Element element, java.lang.String inputValue)
          Invoked to process text from an attribute or from an element's content.
static void setProperty(SchemaProcessor processor, Element element, java.lang.String propertyName, java.lang.Object target, java.lang.Object value)
          Sets a property of the target object to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleUtils

public RuleUtils()
Method Detail

convertInitializer

public static java.util.Map convertInitializer(java.lang.String initializer)
Used to convert a Translator initializer string of the form: key=value[,key=value]* into a Map of keys and values. The keys and values are Strings.


processText

public static java.lang.String processText(SchemaProcessor processor,
                                           Element element,
                                           java.lang.String inputValue)
Invoked to process text from an attribute or from an element's content. Performs two jobs:

Note: if the input is a localized message then no symbol expansion takes place. Localized message references are simply strings that begin with '%'. The remainder of the string is the message key.

A null input value passes through unchanged.


setProperty

public static void setProperty(SchemaProcessor processor,
                               Element element,
                               java.lang.String propertyName,
                               java.lang.Object target,
                               java.lang.Object value)
Sets a property of the target object to the given value. Logs an error if there is a problem.


getTranslator

public static Translator getTranslator(SchemaProcessor processor,
                                       java.lang.String translator)
Convienience for invoking Module.getTranslator(String).

Parameters:
processor - the processor for the schema being converted
translator - the string identifying the translator to provide (may be null)
Returns:
a translator obtained via the contributing module, or an instance of NullTranslator