Connection.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:Blockly 作者:
@VisibleForTesting
void checkConnection(Connection target) {
    switch (canConnectWithReason(target)) {
        case CAN_CONNECT:
            break;
        case REASON_SELF_CONNECTION:
            throw new IllegalArgumentException("Cannot connect a block to itself.");
        case REASON_WRONG_TYPE:
            throw new IllegalArgumentException("Cannot connect these types.");
        case REASON_MUST_DISCONNECT:
            throw new IllegalStateException(
                    "Must disconnect from current block before connecting to a new one.");
        case REASON_TARGET_NULL:
            throw new IllegalArgumentException("Cannot connect to a null connection/block");
        case REASON_CHECKS_FAILED:
            throw new IllegalArgumentException("Cannot connect, checks do not match.");
        default:
            throw new IllegalArgumentException(
                    "Unknown connection failure, this should never happen!");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号