private void injectValue(Object processor, Field field, Object value, String errMessage) { try { field.setAccessible(true); field.set(processor, value); } catch (Exception e) { throw new ClarityException( e, "%s, field is class %s, value is class %s", errMessage, field.getClass().getName(), runner.getContext().getClass().getName() ); } }
public EngineType getEngineType() { return executionModel.getRunner().getEngineType(); }
public int getTick() { return executionModel.getRunner().getTick(); }
private void injectValue(Object processor, Field field, Object value, String errMessage) { try { field.setAccessible(true); field.set(processor, value); } catch (Exception e) { throw new ClarityException( e, "%s, field is class %s, value is class %s", errMessage, field.getClass().getName(), runner.getContext().getClass().getName() ); } }
public EngineType getEngineType() { return executionModel.getRunner().getEngineType(); }
public int getTick() { return executionModel.getRunner().getTick(); }
private void processInjections() { for (Object processor : processors.values()) { Class<?> c = processor.getClass(); while (true) { for (Field field : c.getDeclaredFields()) { for (Annotation fieldAnnotation : field.getAnnotations()) { if (fieldAnnotation instanceof Insert) { if (field.getType().isAssignableFrom(Context.class)) { injectValue(processor, field, runner.getContext(), "cannot inject context"); } else { injectProcessor(processor, field); } } else if (fieldAnnotation instanceof InsertEvent) { injectEvent(processor, field, (InsertEvent) fieldAnnotation); } } } c = c.getSuperclass(); if (c == Object.class) { break; } } } }
private boolean supportsEngineType(Provides provides) { for (EngineId id : provides.engine()) { if (id == runner.getEngineType().getId()) { return true; } } return false; }
private void processInjections() { for (Object processor : processors.values()) { Class<?> c = processor.getClass(); while (true) { for (Field field : c.getDeclaredFields()) { for (Annotation fieldAnnotation : field.getAnnotations()) { if (fieldAnnotation instanceof Insert) { if (field.getType().isAssignableFrom(Context.class)) { injectValue(processor, field, runner.getContext(), "cannot inject context"); } else { injectProcessor(processor, field); } } else if (fieldAnnotation instanceof InsertEvent) { injectEvent(processor, field, (InsertEvent) fieldAnnotation); } } } c = c.getSuperclass(); if (c == Object.class) { break; } } } }
private boolean supportsEngineType(Provides provides) { for (EngineId id : provides.engine()) { if (id == runner.getEngineType().getId()) { return true; } } return false; }
public void runSeek(String[] args) throws Exception { Runner runner = new SimpleRunner(new MappedFileSource(args[0])).runWith(this); StringTables st = runner.getContext().getProcessor(StringTables.class); for (String name : names) { StringTable t = st.forName(name); System.out.println(t.toString()); } }