@Override public int hashCode() { int result = 1; for (Generic typeArgument : getTypeArguments()) { result = 31 * result + typeArgument.hashCode(); } Generic ownerType = getOwnerType(); return result ^ (ownerType == null ? asErasure().hashCode() : ownerType.hashCode()); }
@Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); RenderingDelegate.CURRENT.apply(stringBuilder, asErasure(), getOwnerType()); TypeList.Generic typeArguments = getTypeArguments(); if (!typeArguments.isEmpty()) { stringBuilder.append('<'); boolean multiple = false; for (Generic typeArgument : typeArguments) { if (multiple) { stringBuilder.append(", "); } stringBuilder.append(typeArgument.getTypeName()); multiple = true; } stringBuilder.append('>'); } return stringBuilder.toString(); }
@Override public boolean equals(Object other) { if (this == other) { return true; } else if (!(other instanceof Generic)) { return false; } Generic typeDescription = (Generic) other; if (!typeDescription.getSort().isParameterized()) { return false; } Generic ownerType = getOwnerType(), otherOwnerType = typeDescription.getOwnerType(); return asErasure().equals(typeDescription.asErasure()) && !(ownerType == null && otherOwnerType != null) && !(ownerType != null && !ownerType.equals(otherOwnerType)) && getTypeArguments().equals(typeDescription.getTypeArguments()); }
/** * {@inheritDoc} */ public Generic getSuperClass() { Generic superClass = asErasure().getSuperClass(); return superClass == null ? Generic.UNDEFINED : new LazyProjection.WithResolvedErasure(superClass, new Visitor.Substitutor.ForTypeVariableBinding(this)); }
/** * {@inheritDoc} */ public FieldList<FieldDescription.InGenericShape> getDeclaredFields() { return new FieldList.TypeSubstituting(this, asErasure().getDeclaredFields(), new Visitor.Substitutor.ForTypeVariableBinding(this)); }
/** * {@inheritDoc} */ public TypeList.Generic getInterfaces() { return new TypeList.Generic.ForDetachedTypes.WithResolvedErasure(asErasure().getInterfaces(), new Visitor.Substitutor.ForTypeVariableBinding(this)); }
/** * {@inheritDoc} */ public MethodList<MethodDescription.InGenericShape> getDeclaredMethods() { return new MethodList.TypeSubstituting(this, asErasure().getDeclaredMethods(), new Visitor.Substitutor.ForTypeVariableBinding(this)); }