@Test public void testIsTargetTypeArray() throws Exception { when(typeDescription.isArray()).thenReturn(true); when(typeDescription.getComponentType()).thenReturn(componentType); when(componentType.represents(TargetType.class)).thenReturn(true); TypeDescription resolvedType = TargetType.resolve(typeDescription, targetType); assertThat(resolvedType.isArray(), is(true)); assertThat(resolvedType.getComponentType(), is(targetType)); }
public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) { int arity = 0; TypeDescription componentType = typeDescription; while (componentType.isArray()) { componentType = componentType.getComponentType(); arity++; } return componentType.represents(TargetType.class) ? TypeDescription.ArrayProjection.of(targetType, arity) : typeDescription; }
TargetType { public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) { int arity = 0; TypeDescription componentType = typeDescription; while (componentType.isArray()) { componentType = componentType.getComponentType(); arity++; } return componentType.represents(TargetType.class) ? TypeDescription.ArrayProjection.of(targetType, arity) : typeDescription; } }
TargetType { public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) { int arity = 0; TypeDescription componentType = typeDescription; while (componentType.isArray()) { componentType = componentType.getComponentType(); arity++; } return componentType.represents(TargetType.class) ? TypeDescription.ArrayProjection.of(targetType, arity) : typeDescription; } private  TargetType(); }
TargetType { public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) { int arity = 0; TypeDescription componentType = typeDescription; while (componentType.isArray()) { componentType = componentType.getComponentType(); arity++; } return componentType.represents(TargetType.class) ? TypeDescription.ArrayProjection.of(targetType, arity) : typeDescription; } private  TargetType(); static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType); }
TargetType { public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) { int arity = 0; TypeDescription componentType = typeDescription; while (componentType.isArray()) { componentType = componentType.getComponentType(); arity++; } return componentType.represents(TargetType.class) ? TypeDescription.ArrayProjection.of(targetType, arity) : typeDescription; } private  TargetType(); static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType); static final TypeDescription DESCRIPTION; }