Libraryless. Click here for Pure Java version (413L/3K).
// from GSON project, simplified // (Note: There is a ParameterizedTypeImpl in the JDK, but it is not public // and has a different constructor signature) static persistable final class ParameterizedTypeImpl implements ParameterizedType { private /*final*/ Type ownerType; private /*final*/ Type rawType; private /*final*/ Type[] typeArguments; *(Type *ownerType, Type *rawType, Type... *typeArguments) {} public Type[] getActualTypeArguments() { return typeArguments; } public Type getRawType() { return rawType; } public Type getOwnerType() { return ownerType; } @Override public boolean equals(Object other) { if (other cast ParameterizedType) ret eq(ownerType, other.getOwnerType()) && eq(rawType, other.getRawType()) && eq(asList(typeArguments), asList(other.getActualTypeArguments())); false; } @Override public int hashCode() { return Arrays.hashCode(typeArguments) ^ rawType.hashCode() ^ _hashCode(ownerType); } @Override public String toString() { int length = typeArguments.length; if (length == 0) ret typeToString(rawType); new StringBuilder stringBuilder; stringBuilder.append(typeToString(rawType)).append("<").append(typeToString(typeArguments[0])); for (int i = 1; i < length; i++) { stringBuilder.append(", ").append(typeToString(typeArguments[i])); } ret stringBuilder.append(">").toString(); } static S typeToString(Type type) { return type instanceof Class ? ((Class<?>) type).getName() : type.toString(); } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029596 |
Snippet name: | ParameterizedTypeImpl - an implementation of ParameterizedType |
Eternal ID of this version: | #1029596/8 |
Text MD5: | 5ec4abd179e2bf9113a7cb60e7917b6f |
Transpilation MD5: | 69949eb90fa6c8cc0322bd585065391e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-01 01:19:22 |
Source code size: | 1634 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 229 / 546 |
Version history: | 7 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) #1035536 - GenericArrayTypeImpl - from JDK |