本文整理汇总了Java中com.google.common.reflect.Invokable.isStatic方法的典型用法代码示例。如果您正苦于以下问题:Java Invokable.isStatic方法的具体用法?Java Invokable.isStatic怎么用?Java Invokable.isStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.reflect.Invokable
的用法示例。
在下文中一共展示了Invokable.isStatic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forAllPublicStaticMethods
import com.google.common.reflect.Invokable; //导入方法依赖的package包/类
/**
* Returns an object responsible for performing sanity tests against the return values
* of all public static methods declared by {@code cls}, excluding superclasses.
*/
public FactoryMethodReturnValueTester forAllPublicStaticMethods(Class<?> cls) {
ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder();
for (Method method : cls.getDeclaredMethods()) {
Invokable<?, ?> invokable = Invokable.from(method);
invokable.setAccessible(true);
if (invokable.isPublic() && invokable.isStatic() && !invokable.isSynthetic()) {
builder.add(invokable);
}
}
return new FactoryMethodReturnValueTester(cls, builder.build(), "public static methods");
}
示例2: verifyMethodAccessibility
import com.google.common.reflect.Invokable; //导入方法依赖的package包/类
private void verifyMethodAccessibility(Errors methodErrors, Invokable<T, ?> method, Object source) {
if (method.isStatic()
|| method.isPrivate()
|| method.isAbstract()
|| method.isSynthetic()) {
methodErrors.addMessage(
"Method @%s %s must not be private, static or abstract",
Eventually.Provides.class.getSimpleName(),
source);
} else if (!method.isPublic()) {
method.setAccessible(true);
}
}
示例3: forAllPublicStaticMethods
import com.google.common.reflect.Invokable; //导入方法依赖的package包/类
/**
* Returns an object responsible for performing sanity tests against the return values of all
* public static methods declared by {@code cls}, excluding superclasses.
*/
public FactoryMethodReturnValueTester forAllPublicStaticMethods(Class<?> cls) {
ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder();
for (Method method : cls.getDeclaredMethods()) {
Invokable<?, ?> invokable = Invokable.from(method);
invokable.setAccessible(true);
if (invokable.isPublic() && invokable.isStatic() && !invokable.isSynthetic()) {
builder.add(invokable);
}
}
return new FactoryMethodReturnValueTester(cls, builder.build(), "public static methods");
}