/**
   * If the {@link ConverterProvider} is present and there's a CDI managed {@link Converter}
   * instance available, then return it, else delegate to {@link #getWrapped()} which may return the
   * JSF managed {@link Converter} instance.
   */
  @Override
  public Converter createConverter(Class<?> targetClass) {
    Object provider = BeanManager.INSTANCE.getReference(ConverterProvider.class);

    if (provider
        instanceof
        ConverterProvider) { // If not null, it doesn't return true in EAR deployment on GF3, see
      // also #251.
      Converter converter =
          ((ConverterProvider) provider).createConverter(getWrapped(), targetClass);

      if (converter != null) {
        return converter;
      }
    }

    return getWrapped().createConverter(targetClass);
  }
  /**
   * If the {@link ValidatorProvider} is present and there's a CDI managed {@link Validator}
   * instance available, then return it, else delegate to {@link #getWrapped()} which may return the
   * JSF managed {@link Validator} instance.
   */
  @Override
  public Validator createValidator(String validatorId) throws FacesException {
    Object provider = BeanManager.INSTANCE.getReference(ValidatorProvider.class);

    if (provider
        instanceof
        ValidatorProvider) { // If not null, it doesn't return true in EAR deployment on GF3, see
      // also #251.
      Validator validator =
          ((ValidatorProvider) provider).createValidator(getWrapped(), validatorId);

      if (validator != null) {
        return validator;
      }
    }

    return getWrapped().createValidator(validatorId);
  }