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


Java Method.isBridge方法代码示例

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


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

示例1: canMap

import java.lang.reflect.Method; //导入方法依赖的package包/类
private boolean canMap(Method method, boolean inherited) {
    if (method.getName().matches("^(get|is).+") == false) {
        return false;
    } else if (method.getParameterTypes().length != 0) {
        return false;
    } else if (method.isBridge() || method.isSynthetic()) {
        return false;
    } else if (method.getDeclaringClass() == Object.class) {
        return false;
    } else if (!inherited && method.getDeclaringClass() != this.clazz &&
               StandardAnnotationMaps.of(method.getDeclaringClass()).attributeType() == null) {
        return false;
    } else {
        return true;
    }
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:17,代码来源:StandardBeanProperties.java

示例2: findAnnotatedMethods

import java.lang.reflect.Method; //导入方法依赖的package包/类
/**
 * Find methods that are tagged with a given annotation somewhere in the hierarchy
 */
public static Collection<Method> findAnnotatedMethods(Class<?> type, Class<? extends Annotation> annotation)
{
    List<Method> result = new ArrayList<>();

    // gather all publicly available methods
    // this returns everything, even if it's declared in a parent
    for (Method method : type.getMethods()) {
        // skip methods that are used internally by the vm for implementing covariance, etc
        if (method.isSynthetic() || method.isBridge() || isStatic(method.getModifiers())) {
            continue;
        }

        // look for annotations recursively in super-classes or interfaces
        Method managedMethod = findAnnotatedMethod(
                type,
                annotation,
                method.getName(),
                method.getParameterTypes());
        if (managedMethod != null) {
            result.add(managedMethod);
        }
    }

    return result;
}
 
开发者ID:airlift,项目名称:drift,代码行数:29,代码来源:ReflectionHelper.java

示例3: getMethod

import java.lang.reflect.Method; //导入方法依赖的package包/类
private static Method getMethod(Class theClass, String propertyName) {
	Method[] methods = theClass.getDeclaredMethods();
	Method.setAccessible( methods, true );
	for ( Method method : methods ) {
		// if the method has parameters, skip it
		if ( method.getParameterTypes().length != 0 ) {
			continue;
		}
		// if the method is a "bridge", skip it
		if ( method.isBridge() ) {
			continue;
		}

		final String methodName = method.getName();
		if ( methodName.equals( propertyName ) ) {
			return method;
		}
	}

	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:MockHelper.java

示例4: populateHandlerConfiguration

import java.lang.reflect.Method; //导入方法依赖的package包/类
private static void populateHandlerConfiguration(Class<?> handler) {
	Class<?> publicInterface = getPublicInterface(handler);
	if (publicInterface != null) {
		Method[] methods = publicInterface.getMethods();
		for (Method method : methods) {
			if (publicInterface.equals(method.getDeclaringClass()) && !method.isBridge()
					&& "execute".equals(method.getName())) {
				if (method.getParameterTypes().length == 1) {
					MusterServiceConfiguration annotation = publicInterface.getAnnotation(com.github.dmozzy.muster.api.MusterServiceConfiguration.class);
					functionHandlers.put(annotation.name(),
							new PublicIntferfaceReference((Class<? extends MusterService<?, ?>>) handler,
									method.getParameterTypes()[0], method.getReturnType(), annotation.service(),
									annotation.name(), annotation.idempotency()));
				}
			}
		}
	}
	Class<?>[] classes = handler.getClasses();
	for (Class<?> clazz : classes) {
		populateHandlerConfiguration(clazz);
	}
}
 
开发者ID:dmozzy,项目名称:Muster,代码行数:23,代码来源:MusterLambdaHandler.java

示例5: loadAnnotatedMethods

import java.lang.reflect.Method; //导入方法依赖的package包/类
/**
 * Load all methods annotated with {@link OnGuiCreated} into their respective caches for the
 * specified class.
 */
private static void loadAnnotatedMethods(Class<?> listenerClass, Set<Method> methods) {
    for (Method method : listenerClass.getDeclaredMethods()) {
        // The compiler sometimes creates synthetic bridge methods as part of the
        // type erasure process. As of JDK8 these methods now include the same
        // annotations as the original declarations. They should be ignored for
        // subscribe/produce.
        if (method.isBridge()) {
            continue;
        }

        if (method.isAnnotationPresent(OnGuiCreated.class)) {
            Class<?>[] parameterTypes = method.getParameterTypes();
            if (parameterTypes.length != 0) {
                throw new IllegalArgumentException("Method " + method + " has @OnGuiCreated annotation but requires "
                        + parameterTypes.length + " arguments.  Methods must require zero arguments.");
            }

            //if ((method.getModifiers() & Modifier.PUBLIC) == 0) {
            //    throw new IllegalArgumentException("Method " + method + " has @OnGuiCreated annotation but is not 'public'.");
            //}

            methods.add(method);
        }
    }

    METHODS_ON_GUI_CREATED_CACHE.put(listenerClass, methods);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:32,代码来源:AnnotatedHandlerFinder.java

示例6: findAnnotatedMethods

import java.lang.reflect.Method; //导入方法依赖的package包/类
private static EventComposite findAnnotatedMethods(Object listenerClass, Set<EventSubscriber> subscriberMethods,
                                                   CompositeDisposable compositeDisposable) {
    for (Method method : listenerClass.getClass().getDeclaredMethods()) {
        if (method.isBridge()) {
            continue;
        }
        if (method.isAnnotationPresent(Subscribe.class)) {
            Class<?>[] parameterTypes = method.getParameterTypes();
            if (parameterTypes.length != 1) {
                throw new IllegalArgumentException("Method " + method + " has @Subscribe annotation but requires " + parameterTypes
                        .length + " arguments.  Methods must require a single argument.");
            }

            Class<?> parameterClazz = parameterTypes[0];
            if ((method.getModifiers() & Modifier.PUBLIC) == 0) {
                throw new IllegalArgumentException("Method " + method + " has @EventSubscribe annotation on " + parameterClazz + " " +
                        "but is not 'public'.");
            }

            Subscribe annotation = method.getAnnotation(Subscribe.class);
            ThreadMode thread = annotation.threadMode();

            EventSubscriber subscriberEvent = new EventSubscriber(listenerClass, method, thread);
            if (!subscriberMethods.contains(subscriberEvent)) {
                subscriberMethods.add(subscriberEvent);//添加事件订阅者
                compositeDisposable.add(subscriberEvent.getDisposable());//管理订阅,方便取消订阅
            }
        }
    }
    return new EventComposite(compositeDisposable, listenerClass, subscriberMethods);
}
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:32,代码来源:EventFind.java

示例7: getReturnType

import java.lang.reflect.Method; //导入方法依赖的package包/类
private <T, R> Class<R> getReturnType(Class<? extends MusterService<T, R>> publicInterface) {
	if (publicInterface != null) {
		Method[] methods = publicInterface.getMethods();
		for (Method method : methods) {
			if (publicInterface.equals(method.getDeclaringClass()) && !method.isBridge()
					&& "execute".equals(method.getName())) {
				if (method.getParameterTypes().length == 1) {
					return (Class<R>) method.getReturnType();
				}
			}
		}
	}
	return null;
}
 
开发者ID:dmozzy,项目名称:Muster,代码行数:15,代码来源:LambdaMusterOrchestrationManager.java

示例8: isProperty

import java.lang.reflect.Method; //导入方法依赖的package包/类
public static boolean isProperty(Member m) {
	if ( m instanceof Method ) {
		Method method = (Method) m;
		return !method.isSynthetic()
				&& !method.isBridge()
				&& !Modifier.isStatic( method.getModifiers() )
				&& method.getParameterTypes().length == 0
				&& ( method.getName().startsWith( "get" ) || method.getName().startsWith( "is" ) );
	}
	else {
		return !Modifier.isTransient( m.getModifiers() ) && !m.isSynthetic();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:ReflectionHelper.java

示例9: isBridgeMethod

import java.lang.reflect.Method; //导入方法依赖的package包/类
public boolean isBridgeMethod(Method method) {
    return method.isBridge();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ReflectionNavigator.java

示例10: matches

import java.lang.reflect.Method; //导入方法依赖的package包/类
@Override
public boolean matches(Method method) {
	return !method.isBridge();
}
 
开发者ID:drinkjava2,项目名称:jDialects,代码行数:5,代码来源:ReflectionUtils.java

示例11: matches

import java.lang.reflect.Method; //导入方法依赖的package包/类
@Override
public boolean matches(Method method) {
	return (!method.isBridge() && method.getDeclaringClass() != Object.class);
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:5,代码来源:ReflectionUtils.java

示例12: isHandler

import java.lang.reflect.Method; //导入方法依赖的package包/类
public boolean isHandler(Method method) {
    return findAnnotation(method) != null &&
           !method.isBridge() &&
           !method.isSynthetic();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:EventHandlerScanner.java

示例13: registerEvents

import java.lang.reflect.Method; //导入方法依赖的package包/类
public void registerEvents(Listener listener, Plugin plugin) {
    if (!plugin.isEnabled()) {
        throw new PluginException("Plugin attempted to register " + listener.getClass().getName() + " while not enabled");
    }

    Map<Class<? extends Event>, Set<RegisteredListener>> ret = new HashMap<>();
    Set<Method> methods;
    try {
        Method[] publicMethods = listener.getClass().getMethods();
        Method[] privateMethods = listener.getClass().getDeclaredMethods();
        methods = new HashSet<>(publicMethods.length + privateMethods.length, 1.0f);
        Collections.addAll(methods, publicMethods);
        Collections.addAll(methods, privateMethods);
    } catch (NoClassDefFoundError e) {
        plugin.getLogger().error("Plugin " + plugin.getDescription().getFullName() + " has failed to register events for " + listener.getClass() + " because " + e.getMessage() + " does not exist.");
        return;
    }

    for (final Method method : methods) {
        final EventHandler eh = method.getAnnotation(EventHandler.class);
        if (eh == null) continue;
        if (method.isBridge() || method.isSynthetic()) {
            continue;
        }
        final Class<?> checkClass;

        if (method.getParameterTypes().length != 1 || !Event.class.isAssignableFrom(checkClass = method.getParameterTypes()[0])) {
            plugin.getLogger().error(plugin.getDescription().getFullName() + " attempted to register an invalid EventHandler method signature \"" + method.toGenericString() + "\" in " + listener.getClass());
            continue;
        }

        final Class<? extends Event> eventClass = checkClass.asSubclass(Event.class);
        method.setAccessible(true);

        for (Class<?> clazz = eventClass; Event.class.isAssignableFrom(clazz); clazz = clazz.getSuperclass()) {
            // This loop checks for extending deprecated events
            if (clazz.getAnnotation(Deprecated.class) != null) {
                if (Boolean.valueOf(String.valueOf(this.server.getConfig("settings.deprecated-verbpse", true)))) {
                    this.server.getLogger().warning(this.server.getLanguage().translateString("nukkit.plugin.deprecatedEvent", plugin.getName(), clazz.getName(), listener.getClass().getName() + "." + method.getName() + "()"));
                }
                break;
            }
        }
        EventExecutor executor = EventExecutor.create(method, eventClass);
        this.registerEvent(eventClass, listener, eh.priority(), executor, plugin, eh.ignoreCancelled());
    }
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:48,代码来源:PluginManager.java

示例14: getLambdaPayloadClass

import java.lang.reflect.Method; //导入方法依赖的package包/类
private Class getLambdaPayloadClass(Class functionClass) {

        Class payloadClass = null;

        for (Method method : functionClass.getDeclaredMethods())
            if (method.getName().equals("handleRequest") && !method.isSynthetic() && !method.isBridge())
                payloadClass = method.getParameterTypes()[0];

        return payloadClass;
    }
 
开发者ID:d2si-oss,项目名称:ooso,代码行数:11,代码来源:AWSLambdaAsyncMockClient.java

示例15: isUserLevelMethod

import java.lang.reflect.Method; //导入方法依赖的package包/类
/**
 * Determine whether the given method is declared by the user or at least pointing to
 * a user-declared method.
 * <p>Checks {@link Method#isSynthetic()} (for implementation methods) as well as the
 * {@code GroovyObject} interface (for interface methods; on an implementation class,
 * implementations of the {@code GroovyObject} methods will be marked as synthetic anyway).
 * Note that, despite being synthetic, bridge methods ({@link Method#isBridge()}) are considered
 * as user-level methods since they are eventually pointing to a user-declared generic method.
 * @param method the method to check
 * @return {@code true} if the method can be considered as user-declared; [@code false} otherwise
 */
public static boolean isUserLevelMethod(Method method) {
	Assert.notNull(method, "Method must not be null");
	return (method.isBridge() || (!method.isSynthetic() && !isGroovyObjectMethod(method)));
}
 
开发者ID:drinkjava2,项目名称:jDialects,代码行数:16,代码来源:ClassUtils.java


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