/** {@inheritDoc} */ public InstrumentedType.WithFlexibleName represent(TypeDescription typeDescription) { return new InstrumentedType.Default(typeDescription.getName(), typeDescription.getModifiers(), typeDescription.getSuperClass(), typeDescription.getTypeVariables().asTokenList(is(typeDescription)), typeDescription.getInterfaces().accept(Generic.Visitor.Substitutor.ForDetachment.of(typeDescription)), typeDescription.getDeclaredFields().asTokenList(is(typeDescription)), typeDescription.getDeclaredMethods().asTokenList(is(typeDescription)), typeDescription.getDeclaredAnnotations(), TypeInitializer.None.INSTANCE, LoadedTypeInitializer.NoOp.INSTANCE, typeDescription.getDeclaringType(), typeDescription.getEnclosingMethod(), typeDescription.getEnclosingType(), typeDescription.getDeclaredTypes(), typeDescription.isAnonymousType(), typeDescription.isLocalType(), typeDescription.isNestHost() ? TargetType.DESCRIPTION : typeDescription.getNestHost(), typeDescription.isNestHost() ? typeDescription.getNestMembers().filter(not(is(typeDescription))) : Collections.<TypeDescription>emptyList()); } },
/** * {@inheritDoc} */ public WithFlexibleName withInterfaces(TypeList.Generic interfaceTypes) { return new Default(name, modifiers, superClass, typeVariables, CompoundList.of(this.interfaceTypes, interfaceTypes.accept(Generic.Visitor.Substitutor.ForDetachment.of(this))), fieldTokens, methodTokens, annotationDescriptions, typeInitializer, loadedTypeInitializer, declaringType, enclosingMethod, enclosingType, declaredTypes, anonymousClass, localClass, nestHost, nestMembers); }
/** * {@inheritDoc} */ public MethodDescription.Token asToken(ElementMatcher<? super TypeDescription> matcher) { TypeDescription.Generic receiverType = getReceiverType(); return new MethodDescription.Token(getInternalName(), getModifiers(), getTypeVariables().asTokenList(matcher), getReturnType().accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher)), getParameters().asTokenList(matcher), getExceptionTypes().accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher)), getDeclaredAnnotations(), getDefaultValue(), receiverType == null ? TypeDescription.Generic.UNDEFINED : receiverType.accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher))); }
/** * {@inheritDoc} */ public Token accept(TypeDescription.Generic.Visitor<? extends TypeDescription.Generic> visitor) { return new Token(name, modifiers, getTypeVariableTokens().accept(visitor), returnType.accept(visitor), getParameterTokens().accept(visitor), getExceptionTypes().accept(visitor), annotations, defaultValue, receiverType == null ? TypeDescription.Generic.UNDEFINED : receiverType.accept(visitor)); }
/** * {@inheritDoc} */ public TypeVariableToken accept(TypeDescription.Generic.Visitor<? extends TypeDescription.Generic> visitor) { return new TypeVariableToken(symbol, getBounds().accept(visitor), annotations); }
/** * Transforms a type variable into a type variable token with its bounds detached. * * @param typeVariable A type variable in its attached state. * @param matcher A matcher that identifies types to detach from the upper bound types. * @return A token representing the detached type variable. */ public static TypeVariableToken of(TypeDescription.Generic typeVariable, ElementMatcher<? super TypeDescription> matcher) { return new TypeVariableToken(typeVariable.getSymbol(), typeVariable.getUpperBounds().accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher)), typeVariable.getDeclaredAnnotations()); }
/** * {@inheritDoc} */ public TypeList.Generic getTypeVariables() { return methodDescription.getTypeVariables().accept(visitor).filter(ElementMatchers.ofSort(TypeDefinition.Sort.VARIABLE)); }
/** * {@inheritDoc} */ public TypeList.Generic getUpperBounds() { return typeVariable.getUpperBounds().accept(ForTypeVariableBinding.this); }
/** * {@inheritDoc} */ public Generic onParameterizedType(Generic parameterizedType) { Generic ownerType = parameterizedType.getOwnerType(); return new OfParameterizedType.Latent(parameterizedType.asErasure(), ownerType == null ? UNDEFINED : ownerType.accept(this), parameterizedType.getTypeArguments().accept(this), Empty.INSTANCE); }
/** * {@inheritDoc} */ public TypeList.Generic getExceptionTypes() { return bridgeTarget.getExceptionTypes().accept(TypeDescription.Generic.Visitor.TypeErasing.INSTANCE); }
/** * {@inheritDoc} */ public Generic getUpperBounds() { return typeVariableToken.getBounds().accept(visitor); }