Code example for Schema

Methods: newValidator

    public Validator getValidator(Schema schema) {
         * this looks stupid but to avoid lock, and there is almost no cost for creating a ThreadLocal object 
        validatorThreadLocalMap.putIfAbsent(schema, new ThreadLocal<Validator>());
        ThreadLocal<Validator> threadLocal = validatorThreadLocalMap.get(schema);
        Validator validator = threadLocal.get();
        if (validator == null) {
            validator = schema.newValidator();
        return validator;
    public void clearValidators(Schema schema) {
Connect your IDE to all the code out there  Get Codota for Java