Codota Logo
ValidatorFactory
Code IndexAdd Codota to your IDE (free)

How to use
ValidatorFactory
in
org.schemarepo

Best Java code snippets using org.schemarepo.ValidatorFactory (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

 public class ClientDemo {

 private class MyFilter implements Filter{

  private String filterInput;
  public MyFilter(String input){
    this.filterInput = input;
  }

  @Override
  public String getParameters() {
    return null;
  }

  @Override
  public int currentLength() {
    return this.filterInput.length();
  }

}

  public void testValidators(){

   ValidatorFactory factory = new ValidatorFactory();
   Validator v = factory.getFilterValidator(new MyFilter("filter string goes here..."));
   v.validate();
   }
 }
}
origin: org.schemarepo/schema-repo-common

/**
 * Create a {@link Subject} that validates schemas as configured.
 */
public static Subject validatingSubject(Subject subject, ValidatorFactory factory) {
 if (null == subject) {
  return subject;
 }
 List<Validator> validators;
 SubjectConfig config = subject.getConfig();
 // if the validators key is not specified in the subject config, get the default ones.
 // ensure that even an empty set is honored as "no validators"
 if (config.get(SubjectConfig.VALIDATORS_KEY) != null)
  validators = factory.getValidators(config.getValidators());
 else
  validators = factory.getValidators(factory.getDefaultSubjectValidators());
 if (!validators.isEmpty()) {
  return new ValidatingSubject(subject, new CompositeValidator(validators));
 } else {
  return subject;
 }
}
origin: schema-repo/schema-repo

 public ValidatorFactory build() {
  return new ValidatorFactory(new HashMap<String, Validator>(validators), new HashSet<String>(defaultSubjectValidators));
 }
}
origin: schema-repo/schema-repo

@Test
public void test() throws SchemaValidationException {
 Validator foo = new Validator() {
  @Override
  public void validate(String schemaToValidate,
    Iterable<SchemaEntry> schemasInOrder)
    throws SchemaValidationException {
  }
 };
 ValidatorFactory fact = new ValidatorFactory.Builder().setValidator("foo", foo).build();
 HashSet<String> fooset = new HashSet<String>();
 fooset.add("foo");
 fooset.add(null); // should ignore
 Assert.assertSame(foo, fact.getValidators(fooset).get(0));
 fact.getValidators(fooset).get(0).validate(null, null);
}
origin: schema-repo/schema-repo

/**
 * Create a {@link Subject} that validates schemas as configured.
 */
public static Subject validatingSubject(Subject subject, ValidatorFactory factory) {
 if (null == subject) {
  return subject;
 }
 List<Validator> validators;
 SubjectConfig config = subject.getConfig();
 // if the validators key is not specified in the subject config, get the default ones.
 // ensure that even an empty set is honored as "no validators"
 if (config.get(SubjectConfig.VALIDATORS_KEY) != null)
  validators = factory.getValidators(config.getValidators());
 else
  validators = factory.getValidators(factory.getDefaultSubjectValidators());
 if (!validators.isEmpty()) {
  return new ValidatingSubject(subject, new CompositeValidator(validators));
 } else {
  return subject;
 }
}
origin: org.schemarepo/schema-repo-common

 public ValidatorFactory build() {
  return new ValidatorFactory(new HashMap<String, Validator>(validators), new HashSet<String>(defaultSubjectValidators));
 }
}
origin: stackoverflow.com

 public class FilterImpl implements Filter {
  private final Validator validator;

  public FilterImpl(Validator validator) {
    this.validator = validator;
  }

  @Override
  public getValidator() {
     return this.validator;
  }

  //...
}

public class FilterFactory {
  private final ValidatorFactory validatorFactory = new ValidatorFactory();

  public Filter createFilter() {
    return new FilterImpl(valdatorFactory.createFilterValidator());
  }
}
org.schemarepoValidatorFactory

Javadoc

A factory for mapping Validator names to instantiated instances. Validator names starting with "repo."

Most used methods

  • <init>
  • getValidators
  • getDefaultSubjectValidators
  • getFilterValidator

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now