本文整理了Java中java.lang.reflect.Method.getDeclaredAnnotationsByType()
方法的一些代码示例,展示了Method.getDeclaredAnnotationsByType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getDeclaredAnnotationsByType()
方法的具体详情如下:
包路径:java.lang.reflect.Method
类名称:Method
方法名:getDeclaredAnnotationsByType
暂无
代码示例来源:origin: Diorite/Diorite
return this.method.getDeclaredAnnotationsByType(annotationClass);
代码示例来源:origin: fnproject/fdk-java
private boolean isConfigurationMethod(Method m) {
return m.getDeclaredAnnotationsByType(FnConfiguration.class).length > 0 && !m.getDeclaringClass().isInterface();
}
代码示例来源:origin: com.rapatao.sparkjava/spark-spring-core
/**
* Iterate all methods to registry all Spark handlers
*
* @param sparkController
* @param method
*/
public static void registry(final SparkController sparkController,
final Method method) {
Arrays.stream(method.getDeclaredAnnotationsByType(SparkRequestHandler.class)).forEach(
sparkRequestHandler -> SparkRequestHandlerRegistry.registry(
sparkController, method, sparkRequestHandler));
Arrays.stream(method.getDeclaredAnnotationsByType(SparkExceptionHandler.class)).forEach(
sparkExceptionHandler -> SparkExceptionHandlerRegistry.registry(
sparkController, method, sparkExceptionHandler));
}
}
代码示例来源:origin: mcmonkeyprojects/Sentinel
private static boolean isSentinelRequired(String command, String modifier) {
Method method = sentinelCommandMethodMap.get((command + " " + modifier).toLowerCase());
if (method == null) {
return false;
}
Requirements[] req = method.getDeclaredAnnotationsByType(Requirements.class);
if (req == null || req.length == 0) {
return false;
}
for (Class<? extends Trait> traitClass : req[0].traits()) {
if (traitClass.equals(SentinelTrait.class)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.apache.bval/bval-jsr
for (OverridesAttribute overridesAttribute : m.getDeclaredAnnotationsByType(OverridesAttribute.class)) {
final String to =
Optional.of(overridesAttribute.name()).filter(StringUtils::isNotBlank).orElse(from);
代码示例来源:origin: org.apache.tomee.patch/bval-jsr
for (OverridesAttribute overridesAttribute : m.getDeclaredAnnotationsByType(OverridesAttribute.class)) {
final String to =
Optional.of(overridesAttribute.name()).filter(StringUtils::isNotBlank).orElse(from);
代码示例来源:origin: com.github.javaito/hcjf
while(!classToIntrospect.equals(Layer.class) && !classToIntrospect.equals(Object.class)) {
for (Method method : classToIntrospect.getDeclaredMethods()) {
for (Permission permission : method.getDeclaredAnnotationsByType(Permission.class)) {
SecurityPermissions.publishPermission(layerInstance.getClass(), permission.value());
for (LazyPermission permission : method.getDeclaredAnnotationsByType(LazyPermission.class)) {
SecurityPermissions.publishPermission(layerInstance.getClass(), permission.value());
代码示例来源:origin: name.remal/common
List<AnnotationAttribute> innerAttributes = null;
for (Method attributeMethod : getAttributeMethods(annotationType)) {
for (AnnotationAttributeAlias alias : attributeMethod.getDeclaredAnnotationsByType(AnnotationAttributeAlias.class)) {
if (null == innerAttributes) {
innerAttributes = new ArrayList<>();
代码示例来源:origin: name.remal.tools/common
List<AnnotationAttribute> innerAttributes = null;
for (Method attributeMethod : getAttributeMethods(annotationType)) {
for (AnnotationAttributeAlias alias : attributeMethod.getDeclaredAnnotationsByType(AnnotationAttributeAlias.class)) {
if (innerAttributes == null) {
innerAttributes = new ArrayList<>();
代码示例来源:origin: com.github.javaito/hcjf
for (Permission permission : implementationMethod.getDeclaredAnnotationsByType(Permission.class)) {
SecurityPermissions.checkPermission(getTarget().getClass(), permission.value());
内容来源于网络,如有侵权,请联系作者删除!