本文整理汇总了Java中com.thoughtworks.go.plugin.api.annotation.Extension类的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Extension类属于com.thoughtworks.go.plugin.api.annotation包,在下文中一共展示了Extension类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidClass
import com.thoughtworks.go.plugin.api.annotation.Extension; //导入依赖的package包/类
private boolean isValidClass(Class<?> candidateClass) {
try {
boolean doesNotHaveExtensionAnnotation = candidateClass.getAnnotation(Extension.class) == null;
if (doesNotHaveExtensionAnnotation) {
return false;
}
boolean isAbstract = Modifier.isAbstract(candidateClass.getModifiers());
if (isAbstract) {
errors.add(String.format("Class [%s] is annotated with @Extension but is abstract.", candidateClass.getSimpleName()));
return false;
}
boolean isNotPublic = !Modifier.isPublic(candidateClass.getModifiers());
if (isNotPublic) {
errors.add(String.format("Class [%s] is annotated with @Extension but is not public.", candidateClass.getSimpleName()));
return false;
}
return isInstantiable(candidateClass);
} catch (NoSuchMethodException e) {
errors.add(String.format(
"Class [%s] is annotated with @Extension but cannot be constructed. Make sure it and all of its parent classes have a default constructor.", candidateClass.getSimpleName()));
return false;
}
}
示例2: foo
import com.thoughtworks.go.plugin.api.annotation.Extension; //导入依赖的package包/类
public void foo() {
@Extension
class DummyInnerClassWithExtension implements PluginDescriptorAware {
@Override
public void setPluginDescriptor(PluginDescriptor descriptor) {
throw new UnsupportedOperationException();
}
}
}