当前位置: 首页>>代码示例>>Java>>正文


Java TypeDescription.getSuperClass方法代码示例

本文整理汇总了Java中net.bytebuddy.description.type.TypeDescription.getSuperClass方法的典型用法代码示例。如果您正苦于以下问题:Java TypeDescription.getSuperClass方法的具体用法?Java TypeDescription.getSuperClass怎么用?Java TypeDescription.getSuperClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bytebuddy.description.type.TypeDescription的用法示例。


在下文中一共展示了TypeDescription.getSuperClass方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isMatch

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public boolean isMatch(TypeDescription typeDescription) {
    List<String> parentTypes = new ArrayList<String>(Arrays.asList(this.parentTypes));

    TypeList.Generic implInterfaces = typeDescription.getInterfaces();
    for (TypeDescription.Generic implInterface : implInterfaces) {
        matchHierarchyClass(implInterface, parentTypes);
    }

    if (typeDescription.getSuperClass() != null) {
        matchHierarchyClass(typeDescription.getSuperClass(), parentTypes);
    }

    if (parentTypes.size() == 0) {
        return true;
    }

    return false;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:20,代码来源:HierarchyMatch.java

示例2: apply

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public void apply(ClassVisitor classVisitor, TypeDescription instrumentedType, AnnotationValueFilter annotationValueFilter) {
    AnnotationAppender annotationAppender = new AnnotationAppender.Default(new AnnotationAppender.Target.OnType(classVisitor));
    annotationAppender = AnnotationAppender.ForTypeAnnotations.ofTypeVariable(annotationAppender,
            annotationValueFilter,
            AnnotationAppender.ForTypeAnnotations.VARIABLE_ON_TYPE,
            instrumentedType.getTypeVariables());
    TypeDescription.Generic superClass = instrumentedType.getSuperClass();
    if (superClass != null) {
        annotationAppender = superClass.accept(AnnotationAppender.ForTypeAnnotations.ofSuperClass(annotationAppender, annotationValueFilter));
    }
    int interfaceIndex = 0;
    for (TypeDescription.Generic interfaceType : instrumentedType.getInterfaces()) {
        annotationAppender = interfaceType.accept(AnnotationAppender.ForTypeAnnotations.ofInterfaceType(annotationAppender,
                annotationValueFilter,
                interfaceIndex++));
    }
    for (AnnotationDescription annotation : instrumentedType.getDeclaredAnnotations()) {
        annotationAppender = annotationAppender.append(annotation, annotationValueFilter);
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:22,代码来源:TypeAttributeAppender.java

示例3: represent

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
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.isMemberClass(),
            typeDescription.isAnonymousClass(),
            typeDescription.isLocalClass());
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:21,代码来源:InstrumentedType.java

示例4: inject

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry) {
    MethodList<?> candidates = instrumentedType.getSuperClass().getDeclaredMethods().filter(isConstructor().and(elementMatcher));
    if (candidates.isEmpty()) {
        throw new IllegalStateException("No possible candidate for super constructor invocation in " + instrumentedType.getSuperClass());
    } else if (!candidates.filter(takesArguments(0)).isEmpty()) {
        candidates = candidates.filter(takesArguments(0));
    } else if (candidates.size() > 1) {
        throw new IllegalStateException("More than one possible super constructor for constructor delegation: " + candidates);
    }
    MethodCall methodCall = MethodCall.invoke(candidates.getOnly());
    for (TypeDescription typeDescription : candidates.getOnly().getParameters().asTypeList().asErasures()) {
        methodCall = methodCall.with(typeDescription.getDefaultValue());
    }
    return methodRegistry.append(new LatentMatcher.Resolved<MethodDescription>(isConstructor().and(takesArguments(0))),
            new MethodRegistry.Handler.ForImplementation(methodCall),
            methodAttributeAppenderFactory,
            Transformer.NoOp.<MethodDescription>make());
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:20,代码来源:ConstructorStrategy.java

示例5: of

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
 * Creates a record for a visibility bridge.
 *
 * @param instrumentedType  The instrumented type.
 * @param bridgeTarget      The target method of the visibility bridge.
 * @param attributeAppender The attribute appender to apply to the visibility bridge.
 * @return A record describing the visibility bridge.
 */
public static Record of(TypeDescription instrumentedType, MethodDescription bridgeTarget, MethodAttributeAppender attributeAppender) {
    // Default method bridges must be dispatched on an implemented interface type, not considering the declaring type.
    TypeDefinition bridgeType = null;
    if (bridgeTarget.isDefaultMethod()) {
        TypeDescription declaringType = bridgeTarget.getDeclaringType().asErasure();
        for (TypeDescription interfaceType : instrumentedType.getInterfaces().asErasures().filter(isSubTypeOf(declaringType))) {
            if (bridgeType == null || declaringType.isAssignableTo(bridgeType.asErasure())) {
                bridgeType = interfaceType;
            }
        }
    }
    // Non-default method or default method that is inherited by a super class.
    if (bridgeType == null) {
        bridgeType = instrumentedType.getSuperClass();
    }
    return new OfVisibilityBridge(new VisibilityBridge(instrumentedType, bridgeTarget),
            bridgeTarget,
            bridgeType.asErasure(),
            attributeAppender);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:29,代码来源:TypeWriter.java

示例6: isMatch

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public boolean isMatch(TypeDescription typeDescription) {
    MatchResult matchResult = new MatchResult();
    for (TypeDescription.Generic generic : typeDescription.getInterfaces()) {
        matchHierarchyClazz(generic, matchResult);
    }

    if (typeDescription.getSuperClass() != null) {
        matchHierarchyClazz(typeDescription.getSuperClass(), matchResult);
    }

    return matchResult.result();
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:14,代码来源:EitherInterfaceMatch.java

示例7: doExtractConstructors

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
protected List<MethodDescription.Token> doExtractConstructors(TypeDescription instrumentedType) {
    TypeDescription.Generic superClass = instrumentedType.getSuperClass();
    MethodList<?> defaultConstructors = superClass == null
            ? new MethodList.Empty<MethodDescription.InGenericShape>()
            : superClass.getDeclaredMethods().filter(isConstructor().and(takesArguments(0)).<MethodDescription>and(isVisibleTo(instrumentedType)));
    if (defaultConstructors.size() == 1) {
        return Collections.singletonList(new MethodDescription.Token(Opcodes.ACC_PUBLIC));
    } else {
        throw new IllegalArgumentException(instrumentedType.getSuperClass() + " declares no constructor that is visible to " + instrumentedType);
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:13,代码来源:ConstructorStrategy.java

示例8: identify

import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
protected TypeDefinition identify(TypeDescription typeDescription) {
    return typeDescription.getSuperClass();
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:5,代码来源:SubclassImplementationTarget.java


注:本文中的net.bytebuddy.description.type.TypeDescription.getSuperClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。