Customerly.java 文件源码

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

项目:Customerly-Android-SDK 作者:
/**
 * Optionally you can specify the user attributes
 * @param pAttributes The attributes of the user. Can contain only String, char, byte, int, long, float or double values
 * @return The Task itself for method chaining
 * @throws IllegalArgumentException if the attributes map check fails
 */
@CheckResult @NonNull public RegisterUserTask attributes(@Nullable JSONObject pAttributes) throws IllegalArgumentException {
    if(pAttributes != null) {
        Iterator<String> keysIterator = pAttributes.keys();
        String key;
        while(keysIterator.hasNext()) {
            Object attr = pAttributes.opt(keysIterator.next());
            if(     attr != null && (
                    attr instanceof String ||
                    attr instanceof Integer ||
                    attr instanceof Byte ||
                    attr instanceof Long ||
                    attr instanceof Double ||
                    attr instanceof Float ||
                    attr instanceof Character ||
                    attr instanceof Boolean)) {
                continue;
            }
            _log("Attributes HashMap can contain only String, char, byte, int, long, float or double values");
            throw new IllegalArgumentException("Attributes HashMap can contain only Strings, int, float, long, double or char values");
        }
    } else {
        this.attributes = null;
    }
    return this;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号