Java 类com.alibaba.fastjson.annotation.JSONField 实例源码

项目:java-reinforcement-learning    文件:Matrix.java   
@JSONField(serialize = false)
public boolean isSymmetric(){
    if (getRowCount() != getColumnCount()) return false;

    for (Map.Entry<Integer, Vec> rowEntry : rows.entrySet())
    {
        int row = rowEntry.getKey();
        Vec rowVec = rowEntry.getValue();

        for (Integer col : rowVec.getData().keySet())
        {
            if (row == col.intValue()) continue;
            if(DoubleUtils.equals(rowVec.get(col), this.get(col, row))){
                return false;
            }
        }
    }

    return true;
}
项目:GitHub    文件:ParserConfig.java   
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
                                                 JavaBeanInfo beanInfo, //
                                                 FieldInfo fieldInfo) {
    Class<?> clazz = beanInfo.clazz;
    Class<?> fieldClass = fieldInfo.fieldClass;

    Class<?> deserializeUsing = null;
    JSONField annotation = fieldInfo.getAnnotation();
    if (annotation != null) {
        deserializeUsing = annotation.deserializeUsing();
        if (deserializeUsing == Void.class) {
            deserializeUsing = null;
        }
    }

    if (deserializeUsing == null && (fieldClass == List.class || fieldClass == ArrayList.class)) {
        return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
    }

    return new DefaultFieldDeserializer(mapping, clazz, fieldInfo);
}
项目:boohee_v5.6    文件:TypeUtils.java   
public static JSONField getSupperMethodAnnotation(Class<?> clazz, Method method) {
    for (Class<?> interfaceClass : clazz.getInterfaces()) {
        for (Method interfaceMethod : interfaceClass.getMethods()) {
            if (interfaceMethod.getName().equals(method.getName()) && interfaceMethod.getParameterTypes().length == method.getParameterTypes().length) {
                boolean match = true;
                for (int i = 0; i < interfaceMethod.getParameterTypes().length; i++) {
                    if (!interfaceMethod.getParameterTypes()[i].equals(method.getParameterTypes()[i])) {
                        match = false;
                        break;
                    }
                }
                if (match) {
                    JSONField annotation = (JSONField) interfaceMethod.getAnnotation(JSONField.class);
                    if (annotation != null) {
                        return annotation;
                    }
                } else {
                    continue;
                }
            }
        }
    }
    return null;
}
项目:GitHub    文件:ParserConfigBug569.java   
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
                                                 JavaBeanInfo beanInfo, //
                                                 FieldInfo fieldInfo) {
    Class<?> clazz = beanInfo.clazz;
    Class<?> fieldClass = fieldInfo.fieldClass;

    Class<?> deserializeUsing = null;
    JSONField annotation = fieldInfo.getAnnotation();
    if (annotation != null) {
        deserializeUsing = annotation.deserializeUsing();
        if (deserializeUsing == Void.class) {
            deserializeUsing = null;
        }
    }

    if (deserializeUsing == null && (fieldClass == List.class || fieldClass == ArrayList.class)) {
        return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
    }

    return new DefaultFieldDeserializerBug569(mapping, clazz, fieldInfo);
}
项目:uavstack    文件:FieldSerializer.java   
public FieldSerializer(FieldInfo fieldInfo){
    super();
    this.fieldInfo = fieldInfo;
    fieldInfo.setAccessible(true);

    this.double_quoted_fieldPrefix = '"' + fieldInfo.getName() + "\":";

    this.single_quoted_fieldPrefix = '\'' + fieldInfo.getName() + "\':";

    this.un_quoted_fieldPrefix = fieldInfo.getName() + ":";

    JSONField annotation = fieldInfo.getAnnotation(JSONField.class);
    if (annotation != null) {
        for (SerializerFeature feature : annotation.serialzeFeatures()) {
            if (feature == SerializerFeature.WriteMapNullValue) {
                writeNull = true;
            }
        }
    }
}
项目:GitHub    文件:FieldInfo.java   
public JSONField getAnnotation() {
    if (this.fieldAnnotation != null) {
        return this.fieldAnnotation;
    }

    return this.methodAnnotation;
}
项目:jboot    文件:JbootModel.java   
@JSONField(serialize = false)
protected String getPrimaryKey() {
    if (primaryKey != null) {
        return primaryKey;
    }
    String[] primaryKeys = getPrimaryKeys();
    if (null != primaryKeys && primaryKeys.length == 1) {
        primaryKey = primaryKeys[0];
    }

    JbootAssert.assertTrue(primaryKey != null, String.format("get PrimaryKey is error in[%s]", getClass()));
    return primaryKey;
}
项目:rmq4note    文件:RemotingCommand.java   
@JSONField(serialize = false)
public RemotingCommandType getType() {
    if (this.isResponseType()) {
        return RemotingCommandType.RESPONSE_COMMAND;
    }

    return RemotingCommandType.REQUEST_COMMAND;
}
项目:boohee_v5.6    文件:ASMSerializerFactory.java   
private void _enum(Class<?> cls, MethodVisitor mw, FieldInfo property, Context context) {
    boolean writeEnumUsingToString = false;
    JSONField annotation = (JSONField) property.getAnnotation(JSONField.class);
    if (annotation != null) {
        for (SerializerFeature feature : annotation.serialzeFeatures()) {
            if (feature == SerializerFeature.WriteEnumUsingToString) {
                writeEnumUsingToString = true;
            }
        }
    }
    Label _not_null = new Label();
    Label _end_if = new Label();
    Label _end = new Label();
    _nameApply(mw, property, context, _end);
    _get(mw, context, property);
    mw.visitTypeInsn(192, "java/lang/Enum");
    mw.visitVarInsn(58, context.var("enum"));
    _filters(mw, property, context, _end);
    mw.visitVarInsn(25, context.var("enum"));
    mw.visitJumpInsn(199, _not_null);
    _if_write_null(mw, property, context);
    mw.visitJumpInsn(167, _end_if);
    mw.visitLabel(_not_null);
    mw.visitVarInsn(25, context.var("out"));
    mw.visitVarInsn(21, context.var("seperator"));
    mw.visitVarInsn(25, context.fieldName());
    mw.visitVarInsn(25, context.var("enum"));
    if (writeEnumUsingToString) {
        mw.visitMethodInsn(182, "java/lang/Object", "toString", "()Ljava/lang/String;");
        mw.visitMethodInsn(182, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue", "(CLjava/lang/String;Ljava/lang/String;)V");
    } else {
        mw.visitMethodInsn(182, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue", "(CLjava/lang/String;Ljava/lang/Enum;)V");
    }
    _seperator(mw, context);
    mw.visitLabel(_end_if);
    mw.visitLabel(_end);
}
项目:asch-java    文件:TransactionInfo.java   
@JSONField(serialize = false)
public TransactionType getTransactionType() {
    return transactionType;
}
项目:pay4j    文件:AlipayRefundResult.java   
@JSONField(serialize = false)
public boolean isRefundSuccess(int num) {
    return String.valueOf(num).equals(successNum);
}
项目:GitHub    文件:BuilderTest3_private.java   
@JSONField(name="id")
public VOBuilder kkId(int id) {
    vo.id = id;
    return this;
}
项目:framework    文件:Follwers.java   
@JSONField(name = "next_openid")
public void setNextOpenid(String nextOpenid) {
    this.nextOpenid = nextOpenid;
}
项目:GitHub    文件:TestEntity.java   
@JSONField(deserialize = true)
public void setA3(String a3) {
    this.a3 = a3;
}
项目:rmq4note    文件:RemotingCommand.java   
@JSONField(serialize = false)
public boolean isOnewayRPC() {
    int bits = 1 << RPC_ONEWAY;
    return (this.flag & bits) == bits;
}
项目:GitHub    文件:CancelPolicyDTO.java   
@JSONField(name="DESC")
public void setDescription(String description) {
    this.description = description;
}
项目:framework    文件:MenuButton.java   
@JSONField(name = "sub_button")
public void setSubButton(List<MenuButton> subButton) {
    this.subButton = subButton;
}
项目:framework    文件:CustomerServices.java   
@JSONField(name = "kf_nick")
public void setKfNick(String kfNick) {
    this.kfNick = kfNick;
}
项目:GitHub    文件:UniqueIDDTO.java   
@JSONField(name="CName")
public String getCompanyName() {
    return companyName;
}
项目:GitHub    文件:UniqueIDDTO.java   
@JSONField(name="CName")
public void setCompanyName(String companyName) {
    this.companyName = companyName;
}
项目:framework    文件:MenuButton.java   
@JSONField(name = "sub_button")
public List<MenuButton> getSubButton() {
    return subButton;
}
项目:GitHub    文件:TestEntity.java   
@JSONField(deserialize = false)
public void setA2(String a2) {
    this.a2 = a2;
}
项目:GitHub    文件:AbstractDTO.java   
@JSONField(name="KV")
public void setKeepgoingValidate(boolean keepgoingValidate) {
    this.keepgoingValidate = keepgoingValidate;
}
项目:GitHub    文件:Bug_for_dragoon26.java   
@JSONField(name = "mid")
public void setId(Long id) {
    this.id = id;
}
项目:GitHub    文件:AbstractDTO.java   
@JSONField(name="CR")
public void setCheckCircularReference(boolean checkCircularReference) {
    this.checkCircularReference = checkCircularReference;
}
项目:GitHub    文件:Bug_for_issue_555_setter2.java   
@JSONField(serialize = true, deserialize = false)
public void setSpec(Spec spec) {
    this.spec = spec;
}
项目:GitHub    文件:LabelIncludeTest3.java   
@JSONField(label = "secret")
public String getPassword() {
    return password;
}
项目:framework    文件:User.java   
/**
 * 用户所在的分组ID
 */
@JSONField(name = "groupid")
public int getGroupId() {
    return groupId;
}
项目:GitHub    文件:IncomingDataPoint_ext_double.java   
/** @return the TSUID */
@JSONField(name = "tsuid")
public final String getTSUID() {
    return tsuid;
}
项目:GitHub    文件:Issue101_field_NoneASM.java   
@JSONField(serialzeFeatures=SerializerFeature.DisableCircularReferenceDetect)
public Object getB() {
    return b;
}
项目:framework    文件:CustomerServices.java   
@JSONField(name = "status")
public void setStatus(Integer status) {
    this.status = status;
}
项目:uavstack    文件:ASMSerializerFactory.java   
private void _enum(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context) {
    boolean writeEnumUsingToString = false;
    JSONField annotation = property.getAnnotation(JSONField.class);
    if (annotation != null) {
        for (SerializerFeature feature : annotation.serialzeFeatures()) {
            if (feature == SerializerFeature.WriteEnumUsingToString) {
                writeEnumUsingToString = true;
            }
        }
    }

    Label _not_null = new Label();
    Label _end_if = new Label();
    Label _end = new Label();

    _nameApply(mw, property, context, _end);
    _get(mw, context, property);
    mw.visitTypeInsn(CHECKCAST, "java/lang/Enum"); // cast
    mw.visitVarInsn(ASTORE, context.var("enum"));

    _filters(mw, property, context, _end);

    mw.visitVarInsn(ALOAD, context.var("enum"));
    mw.visitJumpInsn(IFNONNULL, _not_null);
    _if_write_null(mw, property, context);
    mw.visitJumpInsn(GOTO, _end_if);

    mw.visitLabel(_not_null);
    mw.visitVarInsn(ALOAD, context.var("out"));
    mw.visitVarInsn(ILOAD, context.var("seperator"));
    mw.visitVarInsn(ALOAD, context.fieldName());
    mw.visitVarInsn(ALOAD, context.var("enum"));

    if (writeEnumUsingToString) {
        mw.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
        mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue",
                           "(CLjava/lang/String;Ljava/lang/String;)V");
    } else {
        mw.visitMethodInsn(INVOKEVIRTUAL, "com/alibaba/fastjson/serializer/SerializeWriter", "writeFieldValue",
                           "(CLjava/lang/String;Ljava/lang/Enum;)V");
    }

    _seperator(mw, context);

    mw.visitLabel(_end_if);

    mw.visitLabel(_end);
}
项目:GitHub    文件:IncomingDataPoint.java   
/** @param tsuid the TSUID to set */
@JSONField(name = "tsuid")
public final void setTSUID(String tsuid) {
    this.tsuid = tsuid;
}
项目:GitHub    文件:Issue1246.java   
@Override
@JSONField(serialize = false)
public String getX() {
    return x;
}
项目:GitHub    文件:Issue1458.java   
@JSONCreator
public HostPoint(@JSONField(name = "address") HostAddress addr) {
    this.address = addr;
}
项目:GitHub    文件:Issue1458.java   
@JSONCreator
public Fingerprint(@JSONField(name = "source") String fingerprint) {
    this.source = fingerprint;
}
项目:framework    文件:User.java   
/**
 * 用户关注时间,为时间戳。
 * 如果用户曾多次关注,则取最后关注时间
 */

@JSONField(name = "subscribe_time")
public String getSubscribeTime() {
    return subscribeTime;
}
项目:framework    文件:User.java   
@JSONField(name = "groupid")
public void setGroupId(int groupId) {
    this.groupId = groupId;
}
项目:GitHub    文件:Issue1487.java   
@JSONField(name = "_id")
public void set_id(Long _id) {
    this._id = _id;
}
项目:GitHub    文件:JSONObjectTest3.java   
@JSONField
void setBig(boolean value);