當前位置: 首頁>>代碼示例>>Java>>正文


Java SerializerFeature.of方法代碼示例

本文整理匯總了Java中com.alibaba.fastjson.serializer.SerializerFeature.of方法的典型用法代碼示例。如果您正苦於以下問題:Java SerializerFeature.of方法的具體用法?Java SerializerFeature.of怎麽用?Java SerializerFeature.of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.fastjson.serializer.SerializerFeature的用法示例。


在下文中一共展示了SerializerFeature.of方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSerializeFeatures

import com.alibaba.fastjson.serializer.SerializerFeature; //導入方法依賴的package包/類
public static int getSerializeFeatures(Class<?> clazz){
    JSONType annotation = TypeUtils.getAnnotation(clazz,JSONType.class);
    if(annotation == null){
        return 0;
    }
    return SerializerFeature.of(annotation.serialzeFeatures());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:TypeUtils.java

示例2: getSerializeFeatures

import com.alibaba.fastjson.serializer.SerializerFeature; //導入方法依賴的package包/類
public static int getSerializeFeatures(Class<?> clazz) {
    JSONType annotation = (JSONType) clazz.getAnnotation(JSONType.class);
    if (annotation == null) {
        return 0;
    }
    return SerializerFeature.of(annotation.serialzeFeatures());
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:TypeUtils.java

示例3: getSerializeFeatures

import com.alibaba.fastjson.serializer.SerializerFeature; //導入方法依賴的package包/類
public static int getSerializeFeatures(Class<?> clazz) {
    JSONType annotation = clazz.getAnnotation(JSONType.class);
    
    if (annotation == null) {
        return 0;
    }
    
    return SerializerFeature.of(annotation.serialzeFeatures());
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:10,代碼來源:TypeUtils.java

示例4: computeFields

import com.alibaba.fastjson.serializer.SerializerFeature; //導入方法依賴的package包/類
private static void computeFields(
        Class<?> clazz, //
        Map<String,String> aliasMap, //
        PropertyNamingStrategy propertyNamingStrategy, //
        Map<String,FieldInfo> fieldInfoMap, //
        Field[] fields){
    for(Field field : fields){
        if(Modifier.isStatic(field.getModifiers())){
            continue;
        }
        JSONField fieldAnnotation = field.getAnnotation(JSONField.class);
        int ordinal = 0, serialzeFeatures = 0, parserFeatures = 0;
        String propertyName = field.getName();
        String label = null;
        if(fieldAnnotation != null){
            if(!fieldAnnotation.serialize()){
                continue;
            }
            ordinal = fieldAnnotation.ordinal();
            serialzeFeatures = SerializerFeature.of(fieldAnnotation.serialzeFeatures());
            parserFeatures = Feature.of(fieldAnnotation.parseFeatures());
            if(fieldAnnotation.name().length() != 0){
                propertyName = fieldAnnotation.name();
            }
            if(fieldAnnotation.label().length() != 0){
                label = fieldAnnotation.label();
            }
        }
        if(aliasMap != null){
            propertyName = aliasMap.get(propertyName);
            if(propertyName == null){
                continue;
            }
        }
        if(propertyNamingStrategy != null){
            propertyName = propertyNamingStrategy.translate(propertyName);
        }
        if(!fieldInfoMap.containsKey(propertyName)){
            FieldInfo fieldInfo = new FieldInfo(propertyName, null, field, clazz, null, ordinal, serialzeFeatures, parserFeatures,
                    null, fieldAnnotation, label);
            fieldInfoMap.put(propertyName, fieldInfo);
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:45,代碼來源:TypeUtils.java

示例5: computeFields

import com.alibaba.fastjson.serializer.SerializerFeature; //導入方法依賴的package包/類
private static void computeFields(Class<?> clazz, Type type, PropertyNamingStrategy propertyNamingStrategy, List<FieldInfo> fieldList, Field[] fields) {
    for (Field field : fields) { // public static fields
        int modifiers = field.getModifiers();
        if ((modifiers & Modifier.STATIC) != 0) {
            continue;
        }

        if ((modifiers & Modifier.FINAL) != 0) {
            Class<?> fieldType = field.getType();
            boolean supportReadOnly = Map.class.isAssignableFrom(fieldType)
                    || Collection.class.isAssignableFrom(fieldType)
                    || AtomicLong.class.equals(fieldType) //
                    || AtomicInteger.class.equals(fieldType) //
                    || AtomicBoolean.class.equals(fieldType);
            if (!supportReadOnly) {
                continue;
            }
        }

        boolean contains = false;
        for (FieldInfo item : fieldList) {
            if (item.name.equals(field.getName())) {
                contains = true;
                break; // 已經是 contains = true,無需繼續遍曆
            }
        }

        if (contains) {
            continue;
        }

        int ordinal = 0, serialzeFeatures = 0, parserFeatures = 0;
        String propertyName = field.getName();

        JSONField fieldAnnotation = field.getAnnotation(JSONField.class);

        if (fieldAnnotation != null) {
            if (!fieldAnnotation.deserialize()) {
                continue;
            }

            ordinal = fieldAnnotation.ordinal();
            serialzeFeatures = SerializerFeature.of(fieldAnnotation.serialzeFeatures());
            parserFeatures = Feature.of(fieldAnnotation.parseFeatures());

            if (fieldAnnotation.name().length() != 0) {
                propertyName = fieldAnnotation.name();
            }
        }

        if (propertyNamingStrategy != null) {
            propertyName = propertyNamingStrategy.translate(propertyName);
        }

        add(fieldList, new FieldInfo(propertyName, null, field, clazz, type, ordinal, serialzeFeatures, parserFeatures, null,
                fieldAnnotation, null));
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:59,代碼來源:JavaBeanInfo.java


注:本文中的com.alibaba.fastjson.serializer.SerializerFeature.of方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。