类com.alibaba.fastjson.serializer.JavaBeanSerializer源码实例Demo

下面列出了怎么用com.alibaba.fastjson.serializer.JavaBeanSerializer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: uavstack   文件: JSONPath.java
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Collection<Object> getPropertyValues(final Object currentObject) {
    final Class<?> currentClass = currentObject.getClass();

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentClass);

    if (beanSerializer != null) {
        try {
            return beanSerializer.getFieldValues(currentObject);
        } catch (Exception e) {
            throw new JSONPathException("jsonpath error, path " + path, e);
        }
    }

    if (currentObject instanceof Map) {
        Map map = (Map) currentObject;
        return map.values();
    }

    throw new UnsupportedOperationException();
}
 
源代码2 项目: coming   文件: JSONPath_s.java
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Collection<Object> getPropertyValues(final Object currentObject) {
    final Class<?> currentClass = currentObject.getClass();

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentClass);

    if (beanSerializer != null) {
        try {
            return beanSerializer.getFieldValues(currentObject);
        } catch (Exception e) {
            throw new JSONPathException("jsonpath error, path " + path, e);
        }
    }

    if (currentObject instanceof Map) {
        Map map = (Map) currentObject;
        return map.values();
    }

    if (currentObject instanceof Collection) {
        return (Collection) currentObject;
    }

    throw new UnsupportedOperationException();
}
 
源代码3 项目: uavstack   文件: JSONPath.java
@SuppressWarnings({"rawtypes", "unchecked"})
Set<?> evalKeySet(Object currentObject) {
    if (currentObject == null) {
        return null;
    }

    if (currentObject instanceof Map) {
        // For performance reasons return keySet directly, without filtering null-value key.
        return ((Map)currentObject).keySet();
    }

    if (currentObject instanceof Collection || currentObject instanceof Object[]
        || currentObject.getClass().isArray()) {
        return null;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());
    if (beanSerializer == null) {
        return null;
    }

    try {
        return beanSerializer.getFieldNames(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalKeySet error : " + path, e);
    }
}
 
源代码4 项目: coming   文件: JSONPath_s.java
@SuppressWarnings({"rawtypes", "unchecked"})
Set<?> evalKeySet(Object currentObject) {
    if (currentObject == null) {
        return null;
    }

    if (currentObject instanceof Map) {
        // For performance reasons return keySet directly, without filtering null-value key.
        return ((Map)currentObject).keySet();
    }

    if (currentObject instanceof Collection || currentObject instanceof Object[]
        || currentObject.getClass().isArray()) {
        return null;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());
    if (beanSerializer == null) {
        return null;
    }

    try {
        return beanSerializer.getFieldNames(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalKeySet error : " + path, e);
    }
}
 
源代码5 项目: coming   文件: JSONPath_t.java
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Collection<Object> getPropertyValues(final Object currentObject) {
    if (currentObject == null) {
        return null;
    }

    final Class<?> currentClass = currentObject.getClass();

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentClass);

    if (beanSerializer != null) {
        try {
            return beanSerializer.getFieldValues(currentObject);
        } catch (Exception e) {
            throw new JSONPathException("jsonpath error, path " + path, e);
        }
    }

    if (currentObject instanceof Map) {
        Map map = (Map) currentObject;
        return map.values();
    }

    if (currentObject instanceof Collection) {
        return (Collection) currentObject;
    }

    throw new UnsupportedOperationException();
}
 
源代码6 项目: coming   文件: JSONPath_t.java
@SuppressWarnings({"rawtypes", "unchecked"})
Set<?> evalKeySet(Object currentObject) {
    if (currentObject == null) {
        return null;
    }

    if (currentObject instanceof Map) {
        // For performance reasons return keySet directly, without filtering null-value key.
        return ((Map)currentObject).keySet();
    }

    if (currentObject instanceof Collection || currentObject instanceof Object[]
        || currentObject.getClass().isArray()) {
        return null;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());
    if (beanSerializer == null) {
        return null;
    }

    try {
        return beanSerializer.getFieldNames(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalKeySet error : " + path, e);
    }
}
 
源代码7 项目: uavstack   文件: JSONPath.java
@SuppressWarnings("rawtypes")
int evalSize(Object currentObject) {
    if (currentObject == null) {
        return -1;
    }

    if (currentObject instanceof Collection) {
        return ((Collection) currentObject).size();
    }

    if (currentObject instanceof Object[]) {
        return ((Object[]) currentObject).length;
    }

    if (currentObject.getClass().isArray()) {
        return Array.getLength(currentObject);
    }

    if (currentObject instanceof Map) {
        int count = 0;

        for (Object value : ((Map) currentObject).values()) {
            if (value != null) {
                count++;
            }
        }
        return count;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());

    if (beanSerializer == null) {
        return -1;
    }

    try {
        return beanSerializer.getSize(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalSize error : " + path, e);
    }
}
 
源代码8 项目: coming   文件: JSONPath_s.java
@SuppressWarnings("rawtypes")
int evalSize(Object currentObject) {
    if (currentObject == null) {
        return -1;
    }

    if (currentObject instanceof Collection) {
        return ((Collection) currentObject).size();
    }

    if (currentObject instanceof Object[]) {
        return ((Object[]) currentObject).length;
    }

    if (currentObject.getClass().isArray()) {
        return Array.getLength(currentObject);
    }

    if (currentObject instanceof Map) {
        int count = 0;

        for (Object value : ((Map) currentObject).values()) {
            if (value != null) {
                count++;
            }
        }
        return count;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());

    if (beanSerializer == null) {
        return -1;
    }

    try {
        return beanSerializer.getSize(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalSize error : " + path, e);
    }
}
 
源代码9 项目: coming   文件: JSONPath_t.java
@SuppressWarnings("rawtypes")
int evalSize(Object currentObject) {
    if (currentObject == null) {
        return -1;
    }

    if (currentObject instanceof Collection) {
        return ((Collection) currentObject).size();
    }

    if (currentObject instanceof Object[]) {
        return ((Object[]) currentObject).length;
    }

    if (currentObject.getClass().isArray()) {
        return Array.getLength(currentObject);
    }

    if (currentObject instanceof Map) {
        int count = 0;

        for (Object value : ((Map) currentObject).values()) {
            if (value != null) {
                count++;
            }
        }
        return count;
    }

    JavaBeanSerializer beanSerializer = getJavaBeanSerializer(currentObject.getClass());

    if (beanSerializer == null) {
        return -1;
    }

    try {
        return beanSerializer.getSize(currentObject);
    } catch (Exception e) {
        throw new JSONPathException("evalSize error : " + path, e);
    }
}
 
 类所在包
 类方法
 同包方法