/*
  * (non-Javadoc)
  *
  * @see org.openl.binding.ICastFactory#getCast(java.lang.String,
  *      org.openl.types.IOpenClass, org.openl.types.IOpenClass)
  */
 public IOpenCast getCast(IOpenClass from, IOpenClass to) {
   IOpenCast cast =
       typeCastFactory == null ? null : typeCastFactory.getCast(from, to, configurationContext);
   if (cast != null) {
     return cast;
   }
   return parent == null ? null : parent.getCast(from, to);
 }
  public synchronized void validate(IConfigurableResourceContext cxt)
      throws OpenConfigurationException {
    if (grammarFactory != null) {
      grammarFactory.validate(cxt);
    } else if (parent == null) {
      throw new OpenConfigurationException("Grammar class is not set", getUri(), null);
    }

    if (binderFactory != null) {
      binderFactory.validate(cxt);
    } else if (parent == null) {
      throw new OpenConfigurationException("Bindings are not set", getUri(), null);
    }

    // Methods and casts are optional
    // else if (parent == null)
    // throw new OpenConfigurationException("Methods are not set", getUri(),
    // null);

    if (methodFactory != null) {
      methodFactory.validate(cxt);
    }

    if (typeCastFactory != null) {
      typeCastFactory.validate(cxt);
    }

    if (typeFactory != null) {
      typeFactory.validate(cxt);
    }

    if (openFactories != null) {
      for (Iterator<IOpenFactoryConfiguration> iter = openFactories.values().iterator();
          iter.hasNext(); ) {
        IOpenFactoryConfiguration factory = iter.next();
        factory.validate(cxt);
      }
    }
  }