wms-jax.validation

ype[])actualTypeArguments.clone());
  }
  
  public Type getOwnerType()
  {
    return ownerType;
  }
  
  public Type getRawType()
  {
    return rawType;
  }
  
  public Type[] getActualTypeArguments()
  {
    return (Type[])actualTypeArguments.clone();
  }
  
  public int hashCode()
  {
    int hashCode = Utils.nullHashCode(ownerType);
    hashCode = 37 * hashCode + rawType.hashCode();
    hashCode = 37 * hashCode + Arrays.hashCode(actualTypeArguments);
    
    return hashCode;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof ParameterizedType)) {
      return false;
    }
    ParameterizedType type = (ParameterizedType)object;
    if (type == this) {
      return true;
    }
    return (Utils.nullEquals(ownerType, type.getOwnerType())) && (rawType.equals(type.getRawType())) && (Arrays.equals(actualTypeArguments, type.getActualTypeArguments()));
  }
  
  public String toString()
  {
    return toString(this);
  }
  
  public static String toString(ParameterizedType type)
  {
    return toString(type, ClassSerializers.QUALIFIED);
  }
  
  public static String toString(ParameterizedType type, ClassSerializer serializer)
  {
    StringBuilder builder = new StringBuilder();
    
    Type ownerType = type.getOwnerType();
    if (ownerType != null)
    {
      builder.append(TypeUtils.toString(ownerType, serializer));
      builder.append(".");
    }
    builder.append(TypeUtils.toString(type.getRawType(), serializer));
    
    Type[] actualTypeArguments = type.getActualTypeArguments();
    if ((actualTypeArguments != null) && (actualTypeArguments.length > 0))
    {
      builder.append("<");
      for (int i = 0; i < actualTypeArguments.length; i++)
      {
        if (i > 0) {
          builder.append(",");
        }
        builder.append(TypeUtils.toString(actualTypeArguments[i], serializer));
      }
      builder.append(">");
    }
    return builder.toString();
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.DefaultParameterizedType
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.Arrays;

class DefaultTypeVariable<D extends GenericDeclaration>
  implements TypeVariable<D>
{
  private static final Type[] DEFAULT_BOUNDS = { Object.class };
  private final D declaration;
  private final String name;
  private final Type[] bounds;
  
  public DefaultTypeVariable(D declaration, String name, Type[] bounds)
  {
    if ((bounds == null) || (bounds.length == 0)) {
      bounds = DEFAULT_BOUNDS;
    }
    this.declaration = ((GenericDeclaration)Utils.checkNotNull(declaration, "declaration"));
    this.name = ((String)Utils.checkNotNull(name, "name"));
    this.bounds = ((Type[])bounds.clone());
  }
  
  public D getGenericDeclaration()
  {
    return declaration;
  }
  
  public String getName()
  {
    return name;
  }
  
  public Type[] getBounds()
  {
    return (Type[])bounds.clone();
  }
  
  public int hashCode()
  {
    int hashCode = declaration.hashCode();
    hashCode = hashCode * 37 + name.hashCode();
    hashCode = hashCode * 37 + Arrays.hashCode(bounds);
    
    return hashCode;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof TypeVariable)) {
      return false;
    }
    TypeVariable<?> typeVariable = (TypeVariable)object;
    
    return (declaration.equals(typeVariable.getGenericDeclaration())) && (name.equals(typeVariable.getName())) && (Arrays.equals(bounds, typeVariable.getBounds()));
  }
  
  public String toString()
  {
    return toString(this);
  }
  
  public static String toString(TypeVariable<?> type)
  {
    return toString(type, ClassSerializers.QUALIFIED);
  }
  
  public static String toString(TypeVariable<?> type, ClassSerializer serializer)
  {
    StringBuilder builder = new StringBuilder();
    
    builder.append(type.getName());
    if (!Arrays.equals(DEFAULT_BOUNDS, type.getBounds()))
    {
      builder.append(" extends ");
      
      TypeUtils.appendBounds(builder, type.getBounds(), serializer);
    }
    return builder.toString();
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.DefaultTypeVariable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.util.Arrays;

class DefaultWildcardType
  implements WildcardType
{
  private static final Type[] DEFAULT_UPPER_BOUNDS = { Object.class };
  private static final Type[] DEFAULT_LOWER_BOUNDS = new Type[0];
  private final Type[] upperBounds;
  private final Type[] lowerBounds;
  
  public DefaultWildcardType(Type[] upperBounds, Type[] lowerBounds)
  {
    if ((upperBounds == null) || (upperBounds.length == 0)) {
      upperBounds = DEFAULT_UPPER_BOUNDS;
    }
    if (lowerBounds == null) {
      lowerBounds = DEFAULT_LOWER_BOUNDS;
    }
    this.upperBounds = ((Type[])upperBounds.clone());
    this.lowerBounds = ((Type[])lowerBounds.clone());
    
    boolean hasUpperBounds = !Arrays.equals(this.upperBounds, DEFAULT_UPPER_BOUNDS);
    boolean hasLowerBounds = !Arrays.equals(this.lowerBounds, DEFAULT_LOWER_BOUNDS);
    Utils.checkFalse((hasUpperBounds) && (hasLowerBounds), "Wildcard type cannot have both upper and lower bounds");
  }
  
  public Type[] getUpperBounds()
  {
    return (Type[])upperBounds.clone();
  }
  
  public Type[] getLowerBounds()
  {
    return (Type[])lowerBounds.clone();
  }
  
  public int hashCode()
  {
    return Arrays.hashCode(lowerBounds) ^ Arrays.hashCode(upperBounds);
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof WildcardType)) {
      return false;
    }
    WildcardType wildcardType = (WildcardType)object;
    
    return (Arrays.equals(lowerBounds, wildcardType.getLowerBounds())) && (Arrays.equals(upperBounds, wildcardType.getUpperBounds()));
  }
  
  public String toString()
  {
    return toString(this);
  }
  
  public static String toString(WildcardType type)
  {
    return toString(type, ClassSerializers.QUALIFIED);
  }
  
  public static String toString(WildcardType type, ClassSerializer serializer)
  {
    StringBuilder builder = new StringBuilder();
    
    builder.append("?");
    
    Type[] lowerBounds = type.getLowerBounds();
    Type[] upperBounds = type.getUpperBounds();
    if (!Arrays.equals(DEFAULT_LOWER_BOUNDS, lowerBounds))
    {
      builder.append(" super ");
      
      TypeUtils.appendBounds(builder, lowerBounds, serializer);
    }
    else if (!Arrays.equals(DEFAULT_UPPER_BOUNDS, upperBounds))
    {
      builder.append(" extends ");
      
      TypeUtils.appendBounds(builder, upperBounds, serializer);
    }
    return builder.toString();
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.DefaultWildcardType
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.Type;

final class Generic$DefaultGeneric<T>
  extends Generic<T>
{
  public Generic$DefaultGeneric(Type type)
  {
    super(type);
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.Generic.DefaultGeneric
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;

public abstract class Generic<T>
{
  private final Type type;
  
  private static final class DefaultGeneric<T>
    extends Generic<T>
  {
    public DefaultGeneric(Type type)
    {
      super();
    }
  }
  
  protected Generic()
  {
    Type type = getActualTypeArgument();
    
    validateType(type);
    
    this.type = type;
  }
  
  Generic(Type type)
  {
    validateType(type);
    
    this.type = type;
  }
  
  public Type getType()
  {
    return type;
  }
  
  public Class<? super T> getRawType()
  {
    return TypeUtils.getRawType(type);
  }
  
  public String toUnqualifiedString()
  {
    return TypeUtils.toUnqualifiedString(type);
  }
  
  public static <T> Generic<T> get(Class<T> klass)
  {
    return new DefaultGeneric(klass);
  }
  
  public static Generic<?> get(Type type)
  {
    return new DefaultGeneric(type);
  }
  
  public static <T> Generic<? extends T> get(Class<T> rawType, Type... actualTypeArguments)
  {
    ParameterizedType paramType = Types.parameterizedType(rawType, actualTypeArguments);
    
    return get(paramType);
  }
  
  public static Generic<?> valueOf(String typeName)
  {
    return get(Types.valueOf(typeName));
  }
  
  public int hashCode()
  {
    return type.hashCode();
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof Generic)) {
      return false;
    }
    Generic<?> generic = (Generic)object;
    
    return type.equals(generic.getType());
  }
  
  public String toString()
  {
    return TypeUtils.toString(type);
  }
  
  private static void validateType(Type type)
  {
    Utils.checkNotNull(type, "type");
    Utils.checkFalse(type instanceof GenericArrayType, "Generic array types are not supported: ", type);
    Utils.checkFalse(type instanceof TypeVariable, "Type variables are not supported: ", type);
    Utils.checkFalse(type instanceof WildcardType, "Wildcard types are not supported: ", type);
    Utils.checkTrue(((type instanceof Class)) || ((type instanceof ParameterizedType)), "Unsupported type: ", type);
  }
  
  private Type getActualTypeArgument()
  {
    if (getClass().getSuperclass() != Generic.class) {
      throw new IllegalStateException("Generic must only be subclassed once");
    }
    Type superclass = getClass().getGenericSuperclass();
    
    return ((ParameterizedType)superclass).getActualTypeArguments()[0];
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.Generic
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;

public final class Generics
{
  private Generics()
  {
    throw new AssertionError();
  }
  
  public static <T> Generic<Comparator<T>> comparator(Class<T> type)
  {
    return Generic.get(Comparator.class, new Type[] { type });
  }
  
  public static <E> Generic<Enumeration<E>> enumeration(Class<E> elementClass)
  {
    return Generic.get(Enumeration.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<Iterator<E>> iterator(Class<E> elementClass)
  {
    return Generic.get(Iterator.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<ListIterator<E>> listIterator(Class<E> elementClass)
  {
    return Generic.get(ListIterator.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<Collection<E>> collection(Class<E> elementClass)
  {
    return Generic.get(Collection.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<Set<E>> set(Class<E> elementClass)
  {
    return Generic.get(Set.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<SortedSet<E>> sortedSet(Class<E> elementClass)
  {
    return Generic.get(SortedSet.class, new Type[] { elementClass });
  }
  
  public static <E> Generic<List<E>> list(Class<E> elementClass)
  {
    return Generic.get(List.class, new Type[] { elementClass });
  }
  
  public static <K, V> Generic<Map<K, V>> map(Class<K> keyClass, Class<V> valueClass)
  {
    return Generic.get(Map.class, new Type[] { keyClass, valueClass });
  }
  
  public static <K, V> Generic<SortedMap<K, V>> sortedMap(Class<K> keyClass, Class<V> valueClass)
  {
    return Generic.get(SortedMap.class, new Type[] { keyClass, valueClass });
  }
  
  public static <E> Generic<Queue<E>> queue(Class<E> elementClass)
  {
    return Generic.get(Queue.class, new Type[] { elementClass });
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.Generics
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.GenericArrayType;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public final class Types
{
  private Types()
  {
    throw new AssertionError();
  }
  
  public static <D extends GenericDeclaration> TypeVariable<D> typeVariable(D declaration, String name, Type... bounds)
  {
    return new DefaultTypeVariable(declaration, name, bounds);
  }
  
  public static GenericArrayType genericArrayType(Type componentType)
  {
    return new DefaultGenericArrayType(componentType);
  }
  
  public static ParameterizedType parameterizedType(Class<?> rawType, Type... actualTypeArguments)
  {
    return new DefaultParameterizedType(null, rawType, actualTypeArguments);
  }
  
  public static WildcardType unboundedWildcardType()
  {
    return wildcardType(null, null);
  }
  
  public static WildcardType upperBoundedWildcardType(Type upperBound)
  {
    Utils.checkNotNull(upperBound, "upperBound");
    
    return wildcardType(new Type[] { upperBound }, null);
  }
  
  public static WildcardType lowerBoundedWildcardType(Type lowerBound)
  {
    Utils.checkNotNull(lowerBound, "lowerBound");
    
    return wildcardType(null, new Type[] { lowerBound });
  }
  
  public static Type valueOf(String typeName)
  {
    return valueOf(typeName, Collections.emptySet());
  }
  
  public static Type valueOf(String typeName, Set<String> imports)
  {
    Map<String, String> importMap = new HashMap();
    for (String className : imports)
    {
      String unqualifiedClassName = ClassUtils.getUnqualifiedClassName(className);
      if (importMap.containsKey(unqualifiedClassName)) {
        throw new IllegalArgumentException("Duplicate imports: " + (String)importMap.get(unqualifiedClassName) + " and " + className);
      }
      importMap.put(unqualifiedClassName, className);
    }
    return valueOf(typeName, importMap);
  }
  
  private static WildcardType wildcardType(Type[] upperBounds, Type[] lowerBounds)
  {
    return new DefaultWildcardType(upperBounds, lowerBounds);
  }
  
  private static Type valueOf(String typeName, Map<String, String> imports)
  {
    if (typeName.endsWith("[]"))
    {
      String componentName = typeName.substring(0, typeName.length() - "[]".length());
      
      Type componentType = valueOf(componentName, imports);
      
      return TypeUtils.getArrayType(componentType);
    }
    if (typeName.startsWith("?")) {
      return parseWildcardType(typeName, imports);
    }
    int argStart = typeName.indexOf('<');
    if (argStart == -1) {
      return parseClass(typeName, imports);
    }
    int argEnd = typeName.lastIndexOf('>');
    if (argEnd == -1) {
      throw new IllegalArgumentException("Mismatched type argument delimiters: " + typeName);
    }
    String rawTypeName = typeName.substring(0, argStart);
    Class<?> rawType = parseClass(rawTypeName, imports);
    
    String[] actualTypeArgumentNames = typeName.substring(argStart + 1, argEnd).split(",");
    Type[] actualTypeArguments = new Type[actualTypeArgumentNames.length];
    for (int i = 0; i < actualTypeArgumentNames.length; i++) {
      actualTypeArguments[i] = valueOf(actualTypeArgumentNames[i], imports);
    }
    return parameterizedType(rawType, actualTypeArguments);
  }
  
  private static Class<?> parseClass(String className, Map<String, String> imports)
  {
    Class<?> klass = parseClass(className);
    if (klass != null) {
      return klass;
    }
    if ((!className.contains(".")) && (imports.containsKey(className)))
    {
      String qualifiedClassName = (String)imports.get(className);
      
      klass = parseClass(qualifiedClassName);
      if (klass != null) {
        return klass;
      }
    }
    throw new IllegalArgumentException("Class not found: " + className);
  }
  
  private static Class<?> parseClass(String className)
  {
    try
    {
      return Class.forName(className);
    }
    catch (ClassNotFoundException exception) {}
    return null;
  }
  
  private static WildcardType parseWildcardType(String typeName, Map<String, String> imports)
  {
    Type[] lowerBounds;
    if ("?".equals(typeName))
    {
      Type[] upperBounds = null;
      lowerBounds = null;
    }
    else
    {
      Type[] lowerBounds;
      if (typeName.startsWith("? extends "))
      {
        String upperBoundName = typeName.substring("? extends ".length());
        Type upperBound = valueOf(upperBoundName, imports);
        
        Type[] upperBounds = { upperBound };
        lowerBounds = null;
      }
      else
      {
        Type[] lowerBounds;
        if (typeName.startsWith("? super "))
        {
          String lowerBoundName = typeName.substring("? super ".length());
          Type lowerBound = valueOf(lowerBoundName, imports);
          
          Type[] upperBounds = null;
          lowerBounds = new Type[] { lowerBound };
        }
        else
        {
          throw new IllegalArgumentException("Invalid wildcard type: " + typeName);
        }
      }
    }
    Type[] lowerBounds;
    Type[] upperBounds;
    return wildcardType(upperBounds, lowerBounds);
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.Types
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;

public final class TypeUtils
{
  private TypeUtils()
  {
    throw new AssertionError();
  }
  
  public static boolean isAssignable(Type supertype, Type type)
  {
    Utils.checkNotNull(supertype, "supertype");
    Utils.checkNotNull(type, "type");
    boolean assignable;
    boolean assignable;
    if (supertype.equals(type))
    {
      assignable = true;
    }
    else
    {
      boolean assignable;
      if (((supertype instanceof Class)) && ((type instanceof Class)))
      {
        assignable = ((Class)supertype).isAssignableFrom((Class)type);
      }
      else
      {
        boolean assignable;
        if (((supertype instanceof Class)) && ((type instanceof ParameterizedType)))
        {
          assignable = isAssignable(supertype, ((ParameterizedType)type).getRawType());
        }
        else
        {
          boolean assignable;
          if (((supertype instanceof ParameterizedType)) && ((type instanceof ParameterizedType)))
          {
            assignable = isAssignable((ParameterizedType)supertype, (ParameterizedType)type);
          }
          else
          {
            boolean assignable;
            if ((supertype instanceof WildcardType))
            {
              assignable = isAssignable((WildcardType)supertype, type);
            }
            else
            {
              boolean assignable;
              if ((type instanceof Class)) {
                assignable = isAssignable(supertype, (Class)type);
              } else {
                assignable = false;
              }
            }
          }
        }
      }
    }
    return assignable;
  }
  
  public static boolean isInstance(Type type, Object object)
  {
    return getRawType(type).isInstance(object);
  }
  
  public static Type getErasedType(Type type)
  {
    Utils.checkNotNull(type, "type");
    Type erasedType;
    Type erasedType;
    if ((type instanceof ParameterizedType))
    {
      Type rawType = ((ParameterizedType)type).getRawType();
      
      erasedType = getErasedType(rawType);
    }
    else
    {
      Type erasedType;
      if (isArray(type))
      {
        Type componentType = getComponentType(type);
        Type erasedComponentType = getErasedType(componentType);
        
        erasedType = getArrayType(erasedComponentType);
      }
      else
      {
        Type erasedType;
        if ((type instanceof TypeVariable))
        {
          Type[] bounds = ((TypeVariable)type).getBounds();
          
          erasedType = getErasedType(bounds[0]);
        }
        else
        {
          erasedType = type;
        }
      }
    }
    return erasedType;
  }
  
  public static Class<?> getRawType(Type type)
  {
    Utils.checkNotNull(type, "type");
    Class<?> rawType;
    if ((type instanceof Class))
    {
      rawType = (Class)type;
    }
    else
    {
      Class<?> rawType;
      if ((type instanceof GenericArrayType))
      {
        Type componentType = ((GenericArrayType)type).getGenericComponentType();
        
        Class<?> rawComponentType = getRawType(componentType);
        
        rawType = ClassUtils.getArrayType(rawComponentType);
      }
      else
      {
        Class<?> rawType;
        if ((type instanceof ParameterizedType)) {
          rawType = getRawType(((ParameterizedType)type).getRawType());
        } else {
          throw new IllegalArgumentException("Cannot obtain raw type from " + type);
        }
      }
    }
    Class<?> rawType;
    return rawType;
  }
  
  public static boolean isArray(Type type)
  {
    Utils.checkNotNull(type, "type");
    boolean array;
    boolean array;
    if ((type instanceof Class))
    {
      array = ((Class)type).isArray();
    }
    else
    {
      boolean array;
      if ((type instanceof GenericArrayType)) {
        array = true;
      } else {
        array = false;
      }
    }
    return array;
  }
  
  public static Type getComponentType(Type type)
  {
    Utils.checkNotNull(type, "type");
    Type componentType;
    Type componentType;
    if ((type instanceof Class))
    {
      Class<?> klass = (Class)type;
      Type componentType;
      if (klass.isArray()) {
        componentType = klass.getComponentType();
      } else {
        componentType = null;
      }
    }
    else
    {
      Type componentType;
      if ((type instanceof GenericArrayType)) {
        componentType = ((GenericArrayType)type).getGenericComponentType();
      } else {
        componentType = null;
      }
    }
    return componentType;
  }
  
  public static Type getArrayType(Type componentType)
  {
    Utils.checkNotNull(componentType, "componentType");
    Type arrayType;
    Type arrayType;
    if ((componentType instanceof Class)) {
      arrayType = ClassUtils.getArrayType((Class)componentType);
    } else {
      arrayType = Types.genericArrayType(componentType);
    }
    return arrayType;
  }
  
  public static boolean isSimpleParameterizedType(Type type, Class<?> rawType)
  {
    Utils.checkNotNull(type, "type");
    Utils.checkNotNull(rawType, "rawType");
    if (!(type instanceof ParameterizedType)) {
      return false;
    }
    ParameterizedType paramType = (ParameterizedType)type;
    
    Type paramRawType = paramType.getRawType();
    if (!(paramRawType instanceof Class)) {
      return false;
    }
    Class<?> paramRawClass = (Class)paramRawType;
    if (!rawType.isAssignableFrom(paramRawClass)) {
      return false;
    }
    Type[] typeArgs = paramType.getActualTypeArguments();
    
    return typeArgs.length == 1;
  }
  
  public static Type getActualTypeArgument(Type type)
  {
    Utils.checkNotNull(type, "type");
    
    ParameterizedType paramType = (ParameterizedType)type;
    
    Type[] typeArgs = paramType.getActualTypeArguments();
    
    Utils.checkTrue(typeArgs.length == 1, "type must be a ParameterizedType with one actual type argument: ", type);
    
    return typeArgs[0];
  }
  
  public static String toString(Type type)
  {
    return toString(type, ClassSerializers.QUALIFIED);
  }
  
  public static String toString(Type type, ClassSerializer serializer)
  {
    String value;
    String value;
    if ((type instanceof Class))
    {
      Class<?> klass = (Class)type;
      String value;
      if (klass.isArray()) {
        value = toString(klass.getComponentType(), serializer) + "[]";
      } else {
        value = serializer.toString(klass);
      }
    }
    else
    {
      String value;
      if ((type instanceof TypeVariable))
      {
        value = DefaultTypeVariable.toString((TypeVariable)type, serializer);
      }
      else
      {
        String value;
        if ((type instanceof GenericArrayType))
        {
          value = DefaultGenericArrayType.toString((GenericArrayType)type, serializer);
        }
        else
        {
          String value;
          if ((type instanceof ParameterizedType))
          {
            value = DefaultParameterizedType.toString((ParameterizedType)type, serializer);
          }
          else
          {
            String value;
            if ((type instanceof WildcardType)) {
              value = DefaultWildcardType.toString((WildcardType)type, serializer);
            } else {
              value = String.valueOf(type);
            }
          }
        }
      }
    }
    return value;
  }
  
  public static String toUnqualifiedString(Type type)
  {
    return toString(type, ClassSerializers.UNQUALIFIED);
  }
  
  static StringBuilder appendBounds(StringBuilder builder, Type[] bounds, ClassSerializer serializer)
  {
    for (int i = 0; i < bounds.length; i++)
    {
      if (i > 0) {
        builder.append(" & ");
      }
      builder.append(toString(bounds[i], serializer));
    }
    return builder;
  }
  
  private static boolean isAssignable(ParameterizedType supertype, ParameterizedType type)
  {
    if (!isAssignable(supertype.getRawType(), type.getRawType())) {
      return false;
    }
    Type[] supertypeArgs = supertype.getActualTypeArguments();
    Type[] typeArgs = type.getActualTypeArguments();
    if (supertypeArgs.length != typeArgs.length) {
      return false;
    }
    for (int i = 0; i < supertypeArgs.length; i++)
    {
      Type supertypeArg = supertypeArgs[i];
      Type typeArg = typeArgs[i];
      if ((!supertypeArg.equals(typeArg)) && ((!(supertypeArg instanceof WildcardType)) || (!isAssignable((WildcardType)supertypeArg, typeArg)))) {
        return false;
      }
    }
    return true;
  }
  
  private static boolean isAssignable(WildcardType supertype, Type type)
  {
    for (Type upperBound : supertype.getUpperBounds()) {
      if (!isAssignable(upperBound, type)) {
        return false;
      }
    }
    for (Type lowerBound : supertype.getLowerBounds()) {
      if (!isAssignable(type, lowerBound)) {
        return false;
      }
    }
    return true;
  }
  
  private static boolean isAssignable(Type supertype, Class<?> type)
  {
    Type genericSuperclass = type.getGenericSuperclass();
    if ((genericSuperclass != null) && (isAssignable(supertype, genericSuperclass))) {
      return true;
    }
    for (Type interphace : type.getGenericInterfaces()) {
      if (isAssignable(supertype, interphace)) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.TypeUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.jtype;

final class Utils
{
  private Utils()
  {
    throw new AssertionError();
  }
  
  public static <T> T checkNotNull(T object, String name)
  {
    if (object == null) {
      throw new NullPointerException(name + " cannot be null");
    }
    return object;
  }
  
  public static void checkTrue(boolean condition, String message)
  {
    if (!condition) {
      throw new IllegalArgumentException(message);
    }
  }
  
  public static void checkTrue(boolean condition, String message, Object value)
  {
    if (!condition) {
      throw new IllegalArgumentException(message + value);
    }
  }
  
  public static void checkFalse(boolean condition, String message)
  {
    if (condition) {
      throw new IllegalArgumentException(message);
    }
  }
  
  public static void checkFalse(boolean condition, String message, Object value)
  {
    if (condition) {
      throw new IllegalArgumentException(message + value);
    }
  }
  
  public static int nullHashCode(Object object)
  {
    return object != null ? object.hashCode() : 0;
  }
  
  public static boolean nullEquals(Object object1, Object object2)
  {
    return object1 == null ? false : object2 == null ? true : object1.equals(object2);
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.jtype.Utils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.metadata;

import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.validator.util.LoggerFactory;
import org.slf4j.Logger;

public class AnnotationIgnores
{
  private static final Logger log = ;
  private final Map<Class<?>, Boolean> ignoreAnnotationDefaults = new HashMap();
  private final Map<Class<?>, List<Member>> ignoreAnnotationOnMember = new HashMap();
  private final Map<Class<?>, Boolean> ignoreAnnotationOnClass = new HashMap();
  
  public void setDefaultIgnoreAnnotation(Class<?> clazz, Boolean b)
  {
    if (b == null) {
      ignoreAnnotationDefaults.put(clazz, Boolean.TRUE);
    } else {
      ignoreAnnotationDefaults.put(clazz, b);
    }
  }
  
  public boolean getDefaultIgnoreAnnotation(Class<?> clazz)
  {
    return (ignoreAnnotationDefaults.containsKey(clazz)) && (((Boolean)ignoreAnnotationDefaults.get(clazz)).booleanValue());
  }
  
  public void setIgnoreAnnotationsOnMember(Member member)
  {
    Class<?> beanClass = member.getDeclaringClass();
    if (ignoreAnnotationOnMember.get(beanClass) == null)
    {
      List<Member> tmpList = new ArrayList();
      tmpList.add(member);
      ignoreAnnotationOnMember.put(beanClass, tmpList);
    }
    else
    {
      ((List)ignoreAnnotationOnMember.get(beanClass)).add(member);
    }
  }
  
  public boolean isIgnoreAnnotations(Member member)
  {
    Class<?> clazz = member.getDeclaringClass();
    List<Member> ignoreAnnotationForMembers = (List)ignoreAnnotationOnMember.get(clazz);
    boolean ignoreAnnotation;
    boolean ignoreAnnotation;
    if ((ignoreAnnotationForMembers == null) || (!ignoreAnnotationForMembers.contains(member))) {
      ignoreAnnotation = getDefaultIgnoreAnnotation(clazz);
    } else {
      ignoreAnnotation = ignoreAnnotationForMembers.contains(member);
    }
    if (ignoreAnnotation) {
      logMessage(member, clazz);
    }
    return ignoreAnnotation;
  }
  
  private void logMessage(Member member, Class<?> clazz)
  {
    String type;
    String type;
    if ((member instanceof Field)) {
      type = "Field";
    } else {
      type = "Property";
    }
    log.debug(type + " level annotations are getting ignored for " + clazz.getName() + "." + member.getName());
  }
  
  public void setIgnoreAnnotationsOnClass(Class<?> clazz, boolean b)
  {
    ignoreAnnotationOnClass.put(clazz, Boolean.valueOf(b));
  }
  
  public boolean isIgnoreAnnotations(Class<?> clazz)
  {
    boolean ignoreAnnotation;
    boolean ignoreAnnotation;
    if (ignoreAnnotationOnClass.containsKey(clazz)) {
      ignoreAnnotation = ((Boolean)ignoreAnnotationOnClass.get(clazz)).booleanValue();
    } else {
      ignoreAnnotation = getDefaultIgnoreAnnotation(clazz);
    }
    if ((log.isDebugEnabled()) && (ignoreAnnotation)) {
      log.debug("Class level annotation are getting ignored for " + clazz.getName());
    }
    return ignoreAnnotation;
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.metadata.AnnotationIgnores
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.metadata;

import java.util.Map;
import java.util.Set;
import javax.validation.metadata.BeanDescriptor;
import javax.validation.metadata.PropertyDescriptor;

public class BeanDescriptorImpl<T>
  extends ElementDescriptorImpl
  implements BeanDescriptor
{
  public BeanDescriptorImpl(BeanMetaData<T> beanMetaData)
  {
    super(beanMetaData.getBeanClass(), beanMetaData);
  }
  
  public boolean isBeanConstrained()
  {
    return metaDataBean.getMetaConstraintsAsMap().size() > 0;
  }
  
  public PropertyDescriptor getConstraintsForProperty(String propertyName)
  {
    if (propertyName == null) {
      throw new IllegalArgumentException("The property name cannot be null");
    }
    return metaDataBean.getPropertyDescriptor(propertyName);
  }
  
  public Set<PropertyDescriptor> getConstrainedProperties()
  {
    return metaDataBean.getConstrainedProperties();
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.metadata.BeanDescriptorImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.metadata;

import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.metadata.BeanDescriptor;
import javax.validation.metadata.PropertyDescriptor;

public abstract interface BeanMetaData<T>
{
  public abstract Class<T> getBeanClass();
  
  public abstract BeanDescriptor getBeanDescriptor();
  
  public abstract List<Member> getCascadedMembers();
  
  public abstract List<Class<?>> getDefaultGroupSequence();
  
  public abstract boolean defaultGroupSequenceIsRedefined();
  
  public abstract Map<Class<?>, List<MetaConstraint<T, ? extends Annotation>>> getMetaConstraintsAsMap();
  
  public abstract List<MetaConstraint<T, ? extends Annotation>> getMetaConstraintsAsList();
  
  public abstract PropertyDescriptor getPropertyDescriptor(String paramString);
  
  public abstract boolean isPropertyPresent(String paramString);
  
  public abstract Set<PropertyDescriptor> getConstrainedProperties();
}

/* Location:
 * Qualified Name:     org.hibernate.validator.metadata.BeanMetaData
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.metadata;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class BeanMetaDataCache
{
  private Map<Class<?>, BeanMetaDataImpl<?>> metadataProviders = new ConcurrentHashMap(10);
  
  public <T> BeanMetaDataImpl<T> getBeanMetaData(Class<T> beanClass)
  {
    if (beanClass == null) {
      throw new IllegalArgumentException("Class cannot be null");
    }
    return (BeanMetaDataImpl)metadataProviders.get(beanClass);
  }
  
  public <T> void addBeanMetaData(Class<T> beanClass, BeanMetaDataImpl<T> metaData)
  {
    metadataProviders.put(beanClass, metaData);
  }
}

/* Location:
 * Qualified Name:     org.hibernate.validator.metadata.BeanMetaDataCache
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.hibernate.validator.metadata;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.GroupDefinitionException;
import javax.validation.GroupSequence;
import javax.validation.Valid;
import javax.validation.groups.Default;
import javax.validation.metadata.BeanDescriptor;
import javax.validation.metadata.PropertyDescriptor;
import org.hibernate.validator.util.GetDeclaredFields;
import org.hibernate.validator.util.GetDeclaredMethods;
import org.hibernate.validator.util.LoggerFactory;
import org.hibernate.validator.util.ReflectionHelper;
import org.hibernate.validator.util.SetAccessibility;
import org.slf4j.Logger;

public class BeanMetaDataImpl<T>
  implements BeanMetaData<T>
{
  private static final Logger log = LoggerFactory.make();
  private final Class<T> beanClass;
  private BeanDescriptorImpl<T> beanDescriptor;
  private Map<Class<?>, List<MetaConstraint<T, ? extends Annotation>>> metaConstraints = new HashMap();
  private List<Member> cascadedMembers = new ArrayList();
  private Map<String, PropertyDescriptor> propertyDescriptors = new HashMap();
  private List<Class<?>> defaultGroupSequence = new ArrayList();
  private final ConstraintHelper constraintHelper;
  private final Set<String> propertyNames = new HashSet(30);
  
  public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper, BeanMetaDataCache beanMetaDataCache)
  {
    this(beanClass, constraintHelper, new AnnotationIgnores(), beanMetaDataCache);
  }
  
  public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper, AnnotationIgnores annotationIgnores, BeanMetaDataCache beanMetaDataCache)
  {
    this.beanClass = beanClass;
    this.constraintHelper = constraintHelper;
    createMetaData(annotationIgnores, beanMetaDataCache);
  }
  
  public Class<T> getBeanClass()
  {
    return beanClass;
  }
  
  public BeanDescriptor getBeanDescriptor()
  {
    return beanDescriptor;
  }
  
  public List<Member> getCascadedMembers()
  {
    return Collections.unmodifiableList(cascadedMembers);
  }
  
  public Map<Class<?>, List<MetaConstraint<T, ? extends Annotation>>> getMetaConstraintsAsMap()
  {
    return Collections.unmodifiableMap(metaConstraints);
  }
  
  public List<MetaConstraint<T, ? extends Annotation>> getMetaConstraintsAsList()
  {
    List<MetaConstraint<T, ? extends Annotation>> constraintList = new ArrayList();
    for (List<MetaConstraint<T, ? extends Annotation>> list : metaConstraints.values()) {
      constraintList.addAll(list);
    }
    return Collections.unmodifiableList(constraintList);
  }
  
  public void addMetaConstraint(Class<?> clazz, MetaConstraint<T, ? extends Annotation> metaConstraint)
  {
    List<MetaConstraint<T, ? extends Annotation>> constraintList;
    if (!metaConstraints.containsKey(clazz))
    {
      List<MetaConstraint<T, ? extends Annotation>> constraintList = new ArrayList();
      metaConstraints.put(clazz, constraintList);
    }
    else
    {
      constraintList = (List)metaConstraints.get(clazz);
    }
    constraintList.add(metaConstraint);
    if (metaConstraint.getElementType() == ElementType.TYPE)
    {
      beanDescriptor.addConstraintDescriptor(metaConstraint.getDescriptor());
    }
    else
    {
      PropertyDescriptorImpl propertyDescriptor = (PropertyDescriptorImpl)propertyDescriptors.get(metaConstraint.getPropertyName());
      if (propertyDescriptor == null)
      {
        Member member = metaConstraint.getMember();
        propertyDescriptor = addPropertyDescriptorForMember(member, isValidAnnotationPresent(member));
      }
      propertyDescriptor.addConstraintDescriptor(metaConstraint.getDescriptor());
    }
  }
  
  public void addCascadedMember(Member member)
  {
    setAccessibility(member);
    cascadedMembers.add(member);
    addPropertyDescriptorForMember(member, true);
  }
  
  public PropertyDescriptor getPropertyDescriptor(String property)
  {
    return (PropertyDescriptor)propertyDescriptors.get(property);
  }
  
  public boolean isPropertyPresent(String name)
  {
    return propertyNames.contains(name);
  }
  
  public List<Class<?>> getDefaultGroupSequence()
  {
    return Collections.unmodifiableList(defaultGroupSequence);
  }
  
  public boolean defaultGroupSequenceIsRedefined()
  {
    return defaultGroupSequence.size() > 1;
  }
  
  public void setDefaultGroupSequence(List<Class<?>> groupSequence)
  {
    defaultGroupSequence
1 2 3 4 5 6 7 8 9 10 11

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd