public ElementDescriptorImpl(
     Type type,
     Set<ConstraintDescriptorImpl<?>> constraintDescriptors,
     boolean defaultGroupSequenceRedefined,
     List<Class<?>> defaultGroupSequence) {
   this.type = (Class<?>) TypeHelper.getErasedType(type);
   this.constraintDescriptors = Collections.unmodifiableSet(constraintDescriptors);
   this.defaultGroupSequenceRedefined = defaultGroupSequenceRedefined;
   this.defaultGroupSequence = Collections.unmodifiableList(defaultGroupSequence);
 }
  private static Type extractType(Class<? extends ConstraintValidator<?, ?>> validator) {
    Map<Type, Type> resolvedTypes = newHashMap();
    Type constraintValidatorType = resolveTypes(resolvedTypes, validator);

    // we now have all bind from a type to its resolution at one level
    Type validatorType =
        ((ParameterizedType) constraintValidatorType)
            .getActualTypeArguments()[VALIDATOR_TYPE_INDEX];
    if (validatorType == null) {
      throw log.getNullIsAnInvalidTypeForAConstraintValidatorException();
    } else if (validatorType instanceof GenericArrayType) {
      validatorType = TypeHelper.getArrayType(TypeHelper.getComponentType(validatorType));
    }

    while (resolvedTypes.containsKey(validatorType)) {
      validatorType = resolvedTypes.get(validatorType);
    }
    // FIXME raise an exception if validatorType is not a class
    return validatorType;
  }