public TranslationTableFactory.ContextRule buildContext(TranslationTableFactory.ContextRule lastContext,
String context) {
if (lastContext == null)
{
return (ContextRule) contexts.get (context);
}
if (lastContext.isMappingDefined())
{
throw new IllegalArgumentException("Unresolved mapping found.");
}
ContextRule nextContext = (ContextRule)
contexts.get(lastContext.getName() + "." + context);
if (nextContext == null)
{
Log.debug ("Undefined mapping: " + lastContext.getName() + " - > " + context);
return null;
}
while (nextContext.isMappingDefined())
{
nextContext = (ContextRule) contexts.get(nextContext.getMapTo());
}
return nextContext;
}
Builds a context based on the given last context and the new context name.
If no last context is given, the context is considered to be an initial
context. |