亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? methodtransition.java

?? mina是以Java實現的一個開源的網絡程序框架
?? JAVA
字號:
/* *  Licensed to the Apache Software Foundation (ASF) under one *  or more contributor license agreements.  See the NOTICE file *  distributed with this work for additional information *  regarding copyright ownership.  The ASF licenses this file *  to you under the Apache License, Version 2.0 (the *  "License"); you may not use this file except in compliance *  with the License.  You may obtain a copy of the License at * *    http://www.apache.org/licenses/LICENSE-2.0 * *  Unless required by applicable law or agreed to in writing, *  software distributed under the License is distributed on an *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *  KIND, either express or implied.  See the License for the *  specific language governing permissions and limitations *  under the License. * */package org.apache.mina.statemachine.transition;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;import java.util.Arrays;import org.apache.commons.lang.builder.EqualsBuilder;import org.apache.commons.lang.builder.HashCodeBuilder;import org.apache.commons.lang.builder.ToStringBuilder;import org.apache.mina.statemachine.State;import org.apache.mina.statemachine.StateMachine;import org.apache.mina.statemachine.StateMachineFactory;import org.apache.mina.statemachine.annotation.Transition;import org.apache.mina.statemachine.context.StateContext;import org.apache.mina.statemachine.event.Event;import org.slf4j.Logger;import org.slf4j.LoggerFactory;/** * {@link Transition} which invokes a {@link Method}. The {@link Method} will * only be invoked if its argument types actually matches a subset of the  * {@link Event}'s argument types. The argument types are matched in order so * you must make sure the order of the method's arguments corresponds to the * order of the event's arguments.  *<p> * If the first method argument type matches * {@link Event} the current {@link Event} will be bound to that argument. In * the same manner the second argument (or first if the method isn't interested  * in the current {@link Event}) can have the {@link StateContext} type and will * in that case be bound to the current {@link StateContext}. * </p> * <p> * Normally you wouldn't create instances of this class directly but rather use the  * {@link Transition} annotation to define the methods which should be used as * transitions in your state machine and then let {@link StateMachineFactory} create a  * {@link StateMachine} for you. * </p> * * @author The Apache MINA Project (dev@mina.apache.org) * @version $Rev: 592122 $, $Date: 2007-11-05 20:10:32 +0100 (Mon, 05 Nov 2007) $ */public class MethodTransition extends AbstractTransition {    private static final Logger log = LoggerFactory.getLogger( MethodTransition.class );    private static final Object[] EMPTY_ARGUMENTS = new Object[0];        private final Method method;    private final Object target;    /**     * Creates a new instance with the specified {@link State} as next state      * and for the specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param nextState the next {@link State}.     * @param method the target method.     * @param target the target object.     */    public MethodTransition(Object eventId, State nextState, Method method, Object target) {        super(eventId, nextState);        this.method = method;        this.target = target;    }    /**     * Creates a new instance which will loopback to the same {@link State}      * for the specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param method the target method.     * @param target the target object.     */    public MethodTransition(Object eventId, Method method, Object target) {        this(eventId, null, method, target);    }        /**     * Creates a new instance with the specified {@link State} as next state      * and for the specified {@link Event} id. The target {@link Method} will     * be the method in the specified target object with the same name as the     * specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param nextState the next {@link State}.     * @param target the target object.     * @throws NoSuchMethodException if no method could be found with a name      *         equal to the {@link Event} id.     * @throws AmbiguousMethodException if more than one method was found with      *         a name equal to the {@link Event} id.     */    public MethodTransition(Object eventId, State nextState, Object target) {        this(eventId, nextState, eventId.toString(), target);    }        /**     * Creates a new instance which will loopback to the same {@link State}      * for the specified {@link Event} id. The target {@link Method} will     * be the method in the specified target object with the same name as the     * specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param target the target object.     * @throws NoSuchMethodException if no method could be found with a name      *         equal to the {@link Event} id.     * @throws AmbiguousMethodException if more than one method was found with      *         a name equal to the {@link Event} id.     */    public MethodTransition(Object eventId, Object target) {        this(eventId, eventId.toString(), target);    }    /**     * Creates a new instance which will loopback to the same {@link State}      * for the specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param methodName the name of the target {@link Method}.     * @param target the target object.     * @throws NoSuchMethodException if the method could not be found.     * @throws AmbiguousMethodException if there are more than one method with      *         the specified name.     */    public MethodTransition(Object eventId, String methodName, Object target) {        this(eventId, null, methodName, target);    }        /**     * Creates a new instance with the specified {@link State} as next state      * and for the specified {@link Event} id.     *      * @param eventId the {@link Event} id.     * @param nextState the next {@link State}.     * @param methodName the name of the target {@link Method}.     * @param target the target object.     * @throws NoSuchMethodException if the method could not be found.     * @throws AmbiguousMethodException if there are more than one method with      *         the specified name.     */    public MethodTransition(Object eventId, State nextState, String methodName, Object target) {        super(eventId, nextState);        this.target = target;                Method[] candidates = target.getClass().getMethods();        Method result = null;        for (int i = 0; i < candidates.length; i++) {            if (candidates[i].getName().equals(methodName)) {                if (result != null) {                    throw new AmbiguousMethodException(methodName);                }                result = candidates[i];            }        }                if (result == null) {            throw new NoSuchMethodException(methodName);        }                this.method = result;    }        /**     * Returns the target {@link Method}.     *      * @return the method.     */    public Method getMethod() {        return method;    }    /**     * Returns the target object.     *      * @return the target object.     */    public Object getTarget() {        return target;    }    public boolean doExecute(Event event) {        Class<?>[] types = method.getParameterTypes();                if (types.length == 0) {            invokeMethod(EMPTY_ARGUMENTS);            return true;        }                if (types.length > 2 + event.getArguments().length) {            return false;        }                Object[] args = new Object[types.length];                int i = 0;        if (match(types[i], event, Event.class)) {            args[i++] = event;        }        if (i < args.length && match(types[i], event.getContext(), StateContext.class)) {            args[i++] = event.getContext();        }        Object[] eventArgs = event.getArguments();        for (int j = 0; i < args.length && j < eventArgs.length; j++) {            if (match(types[i], eventArgs[j], Object.class)) {                args[i++] = eventArgs[j];            }        }                if (args.length > i) {            return false;        }                invokeMethod(args);                return true;    }        @SuppressWarnings("unchecked")    private boolean match(Class<?> paramType, Object arg, Class argType) {        if (paramType.isPrimitive()) {            if (paramType.equals(Boolean.TYPE)) {                return arg instanceof Boolean;            }            if (paramType.equals(Integer.TYPE)) {                return arg instanceof Integer;            }            if (paramType.equals(Long.TYPE)) {                return arg instanceof Long;            }            if (paramType.equals(Short.TYPE)) {                return arg instanceof Short;            }            if (paramType.equals(Byte.TYPE)) {                return arg instanceof Byte;            }            if (paramType.equals(Double.TYPE)) {                return arg instanceof Double;            }            if (paramType.equals(Float.TYPE)) {                return arg instanceof Float;            }            if (paramType.equals(Character.TYPE)) {                return arg instanceof Character;            }        }        return argType.isAssignableFrom(paramType)                 && paramType.isAssignableFrom(arg.getClass());    }    private void invokeMethod(Object[] arguments) {        try {            if (log.isDebugEnabled()) {                log.debug("Executing method " + method                         + " with arguments " + Arrays.asList(arguments));            }            method.invoke(target, arguments);        } catch (InvocationTargetException ite) {            if (ite.getCause() instanceof RuntimeException) {                throw (RuntimeException) ite.getCause();            }            throw new MethodInvocationException(method, ite);        } catch (IllegalAccessException iae) {            throw new MethodInvocationException(method, iae);        }    }        public boolean equals(Object o) {        if (!(o instanceof MethodTransition)) {            return false;        }        if (o == this) {            return true;        }        MethodTransition that = (MethodTransition) o;        return new EqualsBuilder()            .appendSuper(super.equals(that))            .append(method, that.method)            .append(target, that.target)            .isEquals();    }    public int hashCode() {        return new HashCodeBuilder(13, 33).appendSuper(super.hashCode()).append(method).append(target).toHashCode();    }    public String toString() {        return new ToStringBuilder(this)            .appendSuper(super.toString())            .append("method", method)            .append("target", target)            .toString();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91理论电影在线观看| 色系网站成人免费| 午夜天堂影视香蕉久久| 亚洲欧美激情小说另类| 亚洲色图视频网| 亚洲免费观看视频| 亚洲.国产.中文慕字在线| 亚洲影视在线观看| 日韩二区三区在线观看| 奇米777欧美一区二区| 国产一区二区三区在线观看免费视频| 久久爱www久久做| 成人免费高清在线| 91免费国产视频网站| 欧美色电影在线| 制服丝袜中文字幕一区| 精品日韩欧美一区二区| 国产午夜精品久久久久久久| 最近日韩中文字幕| 亚洲成人综合视频| 久久99久久久久久久久久久| 国产成a人亚洲| 91福利在线观看| 91麻豆精品国产91| 国产日韩精品久久久| 亚洲综合在线观看视频| 日本人妖一区二区| 成人ar影院免费观看视频| 在线观看免费成人| 欧美精品一区二区在线播放| 国产精品成人一区二区艾草 | 麻豆视频一区二区| 国产成人免费在线视频| 91国产免费看| 久久久另类综合| 亚洲综合网站在线观看| 国产麻豆精品在线观看| 欧美亚洲动漫精品| 国产欧美一区二区三区网站| 亚欧色一区w666天堂| av网站一区二区三区| 2021久久国产精品不只是精品| 久久夜色精品一区| 亚洲国产精品自拍| 成人免费电影视频| 久久综合色婷婷| 天天做天天摸天天爽国产一区 | 五月婷婷激情综合| 成人在线视频一区二区| 日韩欧美一级片| 五月婷婷色综合| 日本精品视频一区二区| 国产精品无圣光一区二区| 久久超碰97中文字幕| 欧美日韩精品一区二区在线播放| 国产精品精品国产色婷婷| 精品一区二区影视| 欧美另类z0zxhd电影| 亚洲美腿欧美偷拍| 高清国产午夜精品久久久久久| 日韩一区二区三| 亚洲成人手机在线| 欧美在线免费视屏| 亚洲在线视频网站| 色天使色偷偷av一区二区| 国产精品污网站| 成人亚洲一区二区一| 久久天天做天天爱综合色| 日本vs亚洲vs韩国一区三区二区 | 久久久久久免费毛片精品| 麻豆精品一区二区三区| 日韩三级视频在线看| 奇米影视一区二区三区小说| 56国语精品自产拍在线观看| 亚洲欧美日韩国产另类专区| 99久久综合狠狠综合久久| 国产精品久久网站| 9l国产精品久久久久麻豆| 自拍视频在线观看一区二区| 91色.com| 婷婷国产在线综合| 91精品国产91久久久久久一区二区| 午夜一区二区三区在线观看| 制服丝袜成人动漫| 麻豆国产精品一区二区三区| 2021久久国产精品不只是精品| 国产福利一区二区三区在线视频| 久久综合久久综合亚洲| 成人永久免费视频| 最近中文字幕一区二区三区| 欧美日韩一区国产| 麻豆91免费观看| 中文字幕不卡在线| 91小视频在线免费看| 视频一区在线视频| 久久综合九色综合97婷婷女人| 成人一区二区三区中文字幕| 亚洲精品网站在线观看| 欧美日韩一区在线| 国产一区二区不卡在线| 欧美国产精品中文字幕| 欧洲av在线精品| 韩国女主播成人在线观看| 自拍偷在线精品自拍偷无码专区 | 国产激情精品久久久第一区二区| 国产精品日韩精品欧美在线 | 麻豆国产精品一区二区三区 | 日韩一区二区在线播放| 国产精品一区二区久激情瑜伽| 亚洲视频电影在线| 666欧美在线视频| 粉嫩嫩av羞羞动漫久久久| 亚洲制服丝袜av| 国产免费久久精品| 日韩一区二区精品| 91在线播放网址| 国产老肥熟一区二区三区| 亚洲乱码国产乱码精品精小说 | 日韩欧美成人一区| 成人免费视频视频| 免费人成精品欧美精品| 亚洲另类色综合网站| 久久久精品国产免大香伊| 欧美三级日韩三级国产三级| 国产白丝网站精品污在线入口| 亚洲成av人片在线观看无码| 国产亚洲欧美色| 精品欧美久久久| 91精品国产综合久久精品性色| 97精品电影院| 成人激情免费网站| 国产在线视频一区二区三区| 亚洲成人av一区| 亚洲综合丝袜美腿| 亚洲免费大片在线观看| 国产欧美一区二区三区网站| 精品国产一区二区三区不卡| 欧美高清精品3d| 欧美日韩免费不卡视频一区二区三区| av亚洲精华国产精华精华| 国产一区二区美女诱惑| 麻豆国产精品777777在线| 五月激情六月综合| 亚洲高清免费视频| 亚洲国产日韩av| 亚洲国产视频在线| 天天爽夜夜爽夜夜爽精品视频| 亚洲制服丝袜av| 亚洲高清久久久| 亚洲bt欧美bt精品777| 午夜精品久久一牛影视| 一区二区三区四区在线免费观看| 亚洲你懂的在线视频| 日韩毛片高清在线播放| 最新欧美精品一区二区三区| 亚洲私人影院在线观看| 一区二区三区中文字幕精品精品| 亚洲精品欧美专区| 亚洲高清不卡在线观看| 午夜精品一区二区三区三上悠亚| 婷婷夜色潮精品综合在线| 亚洲成a人片在线观看中文| 日韩福利视频导航| 精品一区二区三区在线观看| 国产成人精品免费网站| 99re66热这里只有精品3直播| 色综合天天综合网天天狠天天| 一本一道久久a久久精品| 欧美日韩一区二区三区视频| 欧美久久一区二区| 精品久久国产97色综合| 国产精品欧美一区二区三区| 亚洲精品免费播放| 丝袜美腿亚洲色图| 国产大陆a不卡| 色诱亚洲精品久久久久久| 欧美视频一区在线观看| 2014亚洲片线观看视频免费| 亚洲欧美一区二区视频| 香蕉成人伊视频在线观看| 国产乱子伦一区二区三区国色天香| 成人污污视频在线观看| 欧美在线一区二区| 精品国产乱码久久久久久夜甘婷婷 | 亚洲乱码精品一二三四区日韩在线 | 亚洲国产精品视频| 国内精品自线一区二区三区视频| 成人黄色免费短视频| 欧美男同性恋视频网站| 欧美激情中文字幕| 亚洲高清久久久| 不卡一区二区中文字幕| 日韩视频一区二区三区在线播放| 国产精品视频一二三| 日本特黄久久久高潮| 91视频国产观看| 国产日韩亚洲欧美综合| 日韩av电影免费观看高清完整版| 成人网在线播放| 欧美大片一区二区|