zoukankan      html  css  js  c++  java
  • 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;
    }

  • 相关阅读:
    JAVA实现WEBSERVICE 上传下载
    C# 扩展方法
    C# winform窗体假死
    javascript webstorm用法
    设计模式 单例模式
    c# 浏览器区别
    C# 文件递归
    批处理
    Windows Services Windows Services的操作
    Oracle下载及安装
  • 原文地址:https://www.cnblogs.com/handsome1013/p/7249277.html
Copyright © 2011-2022 走看看