Java 类org.eclipse.xtext.validation.AbstractInjectableValidator 实例源码

项目:xtext-core    文件:ValidatorTester.java   
@Inject
public ValidatorTester(T validator, EValidatorRegistrar registrar, @Named(Constants.LANGUAGE_NAME) final String languageName) {
    this.validator = validator;
    EValidator.Registry originalRegistry = registrar.getRegistry();
    EValidatorRegistryImpl newRegistry = new EValidatorRegistryImpl();
    registrar.setRegistry(newRegistry);
    this.validator.register(registrar);
    diagnostician = new Diagnostician(newRegistry) {
        @Override
        public java.util.Map<Object,Object> createDefaultContext() {
            java.util.Map<Object,Object> map = super.createDefaultContext();
            map.put(AbstractInjectableValidator.CURRENT_LANGUAGE_NAME, languageName);
            return map;
        }
    };
    registrar.setRegistry(originalRegistry);
    validatorCalled = false;
}