• java 异常


    参数为空,抛这个异常IllegalArgumentException

    public static void notNull(Object object, String message) {
    if (object == null) {
    throw new IllegalArgumentException(message);
    }
    }

    状态异常,一般参数为false,或者converter instanceof ConditionalConverter为false,

    参数不满足条件的时候就跑出IllegalStateException异常

    public void add(Iterator<E> iterator) {
    Assert.state(!this.inUse, "You can no longer add iterators to a composite iterator that's already in use");
    if (this.iterators.contains(iterator)) {
    throw new IllegalArgumentException("You cannot add the same iterator twice");
    }
    this.iterators.add(iterator);
    }

    public void add(GenericConverter converter) {
    Set<ConvertiblePair> convertibleTypes = converter.getConvertibleTypes();
    if (convertibleTypes == null) {
    Assert.state(converter instanceof ConditionalConverter,
    "Only conditional converters may return null convertible types");
    this.globalConverters.add(converter);
    }
    else {
    for (ConvertiblePair convertiblePair : convertibleTypes) {
    ConvertersForPair convertersForPair = getMatchableConverters(convertiblePair);
    convertersForPair.add(converter);
    }
    }
    }

    public int compare(T o1, T o2) {
    Assert.state(this.comparators.size() > 0,
    "No sort definitions have been added to this CompoundComparator to compare");
    for (InvertibleComparator comparator : this.comparators) {
    int result = comparator.compare(o1, o2);
    if (result != 0) {
    return result;
    }
    }
    return 0;
    }

  • 相关阅读:
    二分数组的一些搜索方法
    获取图像lbp特征
    字符串的模糊搜索
    Python numpy读取图片方法
    红方人员实战手册转载
    libuv的交叉编译
    Gogs的交叉编译与配置
    配置PHP8与Nginx并启动nextcloud
    hi3798mv100SDK上DropBear的交叉编译
    Nginx的交叉编译
  • 原文地址:https://www.cnblogs.com/handsome1013/p/7249277.html
Copyright © 2020-2023  润新知