MCPcopy Create free account
hub / github.com/apache/tomcat / getTypeParameter

Method getTypeParameter

java/org/apache/tomcat/websocket/Util.java:250–269  ·  view source on GitHub ↗
(Class<?> clazz, Type argType)

Source from the content-addressed store, hash-verified

248 * definition of the class
249 */
250 private static TypeResult getTypeParameter(Class<?> clazz, Type argType) {
251 if (argType instanceof Class<?>) {
252 return new TypeResult((Class<?>) argType, -1, 0);
253 } else if (argType instanceof ParameterizedType) {
254 return new TypeResult((Class<?>) ((ParameterizedType) argType).getRawType(), -1, 0);
255 } else if (argType instanceof GenericArrayType) {
256 Type arrayElementType = ((GenericArrayType) argType).getGenericComponentType();
257 TypeResult result = getTypeParameter(clazz, arrayElementType);
258 result.incrementDimension(1);
259 return result;
260 } else {
261 TypeVariable<?>[] tvs = clazz.getTypeParameters();
262 for (int i = 0; i < tvs.length; i++) {
263 if (tvs[i].equals(argType)) {
264 return new TypeResult(null, i, 0);
265 }
266 }
267 throw new IllegalStateException();
268 }
269 }
270
271
272 /**

Callers 1

getGenericTypeMethod · 0.95

Calls 2

incrementDimensionMethod · 0.95
equalsMethod · 0.65

Tested by

no test coverage detected