Java Code Examples for java.lang.reflect.Type.clone()

The following are Jave code examples for showing how to use clone() of the java.lang.reflect.Type class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: Utils.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // Require an owner type if the raw type needs it.
  if (rawType instanceof Class<?>
      && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
    throw new IllegalArgumentException();
  }

  this.ownerType = ownerType;
  this.rawType = rawType;
  this.typeArguments = typeArguments.clone();

  for (Type typeArgument : this.typeArguments) {
    checkNotNull(typeArgument, "typeArgument == null");
    checkNotPrimitive(typeArgument);
  }
}
 
Example 2
Project: GitHub   File: Utils.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // Require an owner type if the raw type needs it.
  if (rawType instanceof Class<?>
      && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
    throw new IllegalArgumentException();
  }

  for (Type typeArgument : typeArguments) {
    checkNotNull(typeArgument, "typeArgument == null");
    checkNotPrimitive(typeArgument);
  }

  this.ownerType = ownerType;
  this.rawType = rawType;
  this.typeArguments = typeArguments.clone();
}
 
Example 3
Project: pcloud-networking-java   File: Types.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    // Require an owner type if the raw type needs it.
    if (rawType instanceof Class<?> &&
                (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
        throw new IllegalArgumentException("unexpected owner type for " + rawType + ": " + ownerType);
    }

    this.ownerType = ownerType == null ? null : canonicalize(ownerType);
    this.rawType = canonicalize(rawType);
    this.typeArguments = typeArguments.clone();
    for (int t = 0; t < this.typeArguments.length; t++) {
        if (this.typeArguments[t] == null) throw new NullPointerException();
        checkNotPrimitive(this.typeArguments[t]);
        this.typeArguments[t] = canonicalize(this.typeArguments[t]);
    }
}
 
Example 4
Project: elasticsearch_my   File: MoreTypes.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    // require an owner type if the raw type needs it
    if (rawType instanceof Class<?>) {
        Class rawTypeAsClass = (Class) rawType;
        if (ownerType == null && rawTypeAsClass.getEnclosingClass() != null) {
            throw new IllegalArgumentException("No owner type for enclosed " + rawType);
        }
        if (ownerType != null && rawTypeAsClass.getEnclosingClass() == null) {
            throw new IllegalArgumentException("Owner type for unenclosed " + rawType);
        }

    }

    this.ownerType = ownerType == null ? null : canonicalize(ownerType);
    this.rawType = canonicalize(rawType);
    this.typeArguments = typeArguments.clone();
    for (int t = 0; t < this.typeArguments.length; t++) {
        Objects.requireNonNull(this.typeArguments[t], "type parameter");
        checkNotPrimitive(this.typeArguments[t], "type parameters");
        this.typeArguments[t] = canonicalize(this.typeArguments[t]);
    }
}
 
Example 5
Project: super-volley   File: Utils.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    // Require an owner type if the raw type needs it.
    if (rawType instanceof Class<?>
            && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
        throw new IllegalArgumentException();
    }

    this.ownerType = ownerType;
    this.rawType = rawType;
    this.typeArguments = typeArguments.clone();

    for (Type typeArgument : this.typeArguments) {
        if (typeArgument == null) throw new NullPointerException();
        checkNotPrimitive(typeArgument);
    }
}
 
Example 6
Project: letv   File: d.java   View Source Code Vote up 6 votes
public d(Type type, Type type2, Type... typeArr) {
    int i = 0;
    if (type2 instanceof Class) {
        Class cls = (Class) type2;
        int i2 = (Modifier.isStatic(cls.getModifiers()) || cls.getEnclosingClass() == null) ? 1 : 0;
        boolean z = (type == null && i2 == 0) ? false : true;
        a.a(z);
    }
    this.a = type == null ? null : b.a(type);
    this.b = b.a(type2);
    this.c = (Type[]) typeArr.clone();
    while (i < this.c.length) {
        a.a(this.c[i]);
        b.e(this.c[i]);
        this.c[i] = b.a(this.c[i]);
        i++;
    }
}
 
Example 7
Project: letv   File: C$Gson$Types.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    boolean z = false;
    if (rawType instanceof Class) {
        boolean z2;
        Class<?> rawTypeAsClass = (Class) rawType;
        if (ownerType != null || rawTypeAsClass.getEnclosingClass() == null) {
            z2 = true;
        } else {
            z2 = false;
        }
        C$Gson$Preconditions.checkArgument(z2);
        if (ownerType == null || rawTypeAsClass.getEnclosingClass() != null) {
            z = true;
        }
        C$Gson$Preconditions.checkArgument(z);
    }
    this.ownerType = ownerType == null ? null : C$Gson$Types.canonicalize(ownerType);
    this.rawType = C$Gson$Types.canonicalize(rawType);
    this.typeArguments = (Type[]) typeArguments.clone();
    for (int t = 0; t < this.typeArguments.length; t++) {
        C$Gson$Preconditions.checkNotNull(this.typeArguments[t]);
        C$Gson$Types.checkNotPrimitive(this.typeArguments[t]);
        this.typeArguments[t] = C$Gson$Types.canonicalize(this.typeArguments[t]);
    }
}
 
Example 8
Project: odoo-work   File: $Gson$Types.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // require an owner type if the raw type needs it
  if (rawType instanceof Class<?>) {
    Class<?> rawTypeAsClass = (Class<?>) rawType;
    boolean isStaticOrTopLevelClass = Modifier.isStatic(rawTypeAsClass.getModifiers())
        || rawTypeAsClass.getEnclosingClass() == null;
    checkArgument(ownerType != null || isStaticOrTopLevelClass);
  }

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    checkNotNull(this.typeArguments[t]);
    checkNotPrimitive(this.typeArguments[t]);
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 9
Project: lams   File: $Gson$Types.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // require an owner type if the raw type needs it
  if (rawType instanceof Class<?>) {
    Class<?> rawTypeAsClass = (Class<?>) rawType;
    checkArgument(ownerType != null || rawTypeAsClass.getEnclosingClass() == null);
    checkArgument(ownerType == null || rawTypeAsClass.getEnclosingClass() != null);
  }

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    checkNotNull(this.typeArguments[t]);
    checkNotPrimitive(this.typeArguments[t]);
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 10
Project: inspector   File: Types.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(@Nullable Type ownerType, Type rawType, Type... typeArguments) {
  // Require an owner type if the raw type needs it.
  if (rawType instanceof Class<?>
      && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
    throw new IllegalArgumentException(
        "unexpected owner type for " + rawType + ": " + ownerType);
  }

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    if (this.typeArguments[t] == null) throw new NullPointerException();
    checkNotPrimitive(this.typeArguments[t]);
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 11
Project: OSchina_resources_android   File: CacheManager.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    // require an owner type if the raw type needs it
    if (rawType instanceof Class<?>) {
        Class<?> rawTypeAsClass = (Class<?>) rawType;
        boolean isStaticOrTopLevelClass = Modifier.isStatic(rawTypeAsClass.getModifiers())
                || rawTypeAsClass.getEnclosingClass() == null;
        checkArgument(ownerType != null || isStaticOrTopLevelClass);
    }

    this.ownerType = ownerType == null ? null : canonicalize(ownerType);
    this.rawType = canonicalize(rawType);
    this.typeArguments = typeArguments.clone();
    for (int t = 0; t < this.typeArguments.length; t++) {
        checkNotNull(this.typeArguments[t]);
        this.typeArguments[t] = canonicalize(this.typeArguments[t]);
    }
}
 
Example 12
Project: XXXX   File: Types.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // Require an owner type if the raw type needs it.
  if (rawType instanceof Class<?>
      && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
    throw new IllegalArgumentException();
  }

  this.ownerType = ownerType;
  this.rawType = rawType;
  this.typeArguments = typeArguments.clone();

  for (Type typeArgument : this.typeArguments) {
    if (typeArgument == null) {
      throw new NullPointerException();
    }
    checkNotPrimitive(typeArgument);
  }
}
 
Example 13
Project: boohee_v5.6   File: C$Gson$Types.java   View Source Code Vote up 6 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
    boolean z = false;
    if (rawType instanceof Class) {
        Class<?> rawTypeAsClass = (Class) rawType;
        boolean isStaticOrTopLevelClass;
        if (Modifier.isStatic(rawTypeAsClass.getModifiers()) || rawTypeAsClass
                .getEnclosingClass() == null) {
            isStaticOrTopLevelClass = true;
        } else {
            isStaticOrTopLevelClass = false;
        }
        if (ownerType != null || isStaticOrTopLevelClass) {
            z = true;
        }
        C$Gson$Preconditions.checkArgument(z);
    }
    this.ownerType = ownerType == null ? null : C$Gson$Types.canonicalize(ownerType);
    this.rawType = C$Gson$Types.canonicalize(rawType);
    this.typeArguments = (Type[]) typeArguments.clone();
    for (int t = 0; t < this.typeArguments.length; t++) {
        C$Gson$Preconditions.checkNotNull(this.typeArguments[t]);
        C$Gson$Types.checkNotPrimitive(this.typeArguments[t]);
        this.typeArguments[t] = C$Gson$Types.canonicalize(this.typeArguments[t]);
    }
}
 
Example 14
Project: hoard   File: Types.java   View Source Code Vote up 6 votes
ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // Require an owner type if the raw type needs it.
  if (rawType instanceof Class<?>
    && (ownerType == null) != (((Class<?>) rawType).getEnclosingClass() == null)) {
    throw new IllegalArgumentException(
      "unexpected owner type for " + rawType + ": " + ownerType);
  }

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    if (this.typeArguments[t] == null) throw new NullPointerException();
    checkNotPrimitive(this.typeArguments[t]);
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 15
Project: rockscript   File: ParameterizedTypeImpl.java   View Source Code Vote up 5 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // require an owner type if the raw type needs it
  ensureOwnerType(ownerType, rawType);

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    throwIfNull(this.typeArguments[t], "type parameter");
    checkNotPrimitive(this.typeArguments[t], "type parameters");
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 16
Project: jdk8u-jdk   File: TestTypeResolver.java   View Source Code Vote up 5 votes
TypeVariableImpl(String name, D gd, Type... bounds) {
    this.name = name;
    this.gd = gd;
    if (bounds.length == 0)
        bounds = new Type[] {Object.class};
    this.bounds = bounds.clone();
}
 
Example 17
Project: businessworks   File: MoreTypes.java   View Source Code Vote up 5 votes
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
  // require an owner type if the raw type needs it
  ensureOwnerType(ownerType, rawType);

  this.ownerType = ownerType == null ? null : canonicalize(ownerType);
  this.rawType = canonicalize(rawType);
  this.typeArguments = typeArguments.clone();
  for (int t = 0; t < this.typeArguments.length; t++) {
    checkNotNull(this.typeArguments[t], "type parameter");
    checkNotPrimitive(this.typeArguments[t], "type parameters");
    this.typeArguments[t] = canonicalize(this.typeArguments[t]);
  }
}
 
Example 18
Project: openjdk-jdk10   File: TestTypeResolver.java   View Source Code Vote up 5 votes
TypeVariableImpl(String name, D gd, Type... bounds) {
    this.name = name;
    this.gd = gd;
    if (bounds.length == 0)
        bounds = new Type[] {Object.class};
    this.bounds = bounds.clone();
}