this.earlyOnly = earlyOnly;
}
@Override
public Translator<Object, Object> create(TypeKey<Object> tk, CreateContext ctx, Path path) {
final Translate translateAnno = tk.getAnnotation(Translate.class);
if (translateAnno == null)
return null;
if (earlyOnly && !translateAnno.early())
return null;
@SuppressWarnings("unchecked")
TranslatorFactory<Object, Object> transFact = (TranslatorFactory<Object, Object>)ctx.getFactory().construct(translateAnno.value());
Translator<Object, Object> trans = transFact.create(tk, ctx, path);
if (trans == null) {
path.throwIllegalState("TranslatorFactory " + transFact + " was unable to produce a Translator for " + tk.getType());
return null; // never gets here