本文整理匯總了Java中com.alibaba.fastjson.annotation.JSONField類的典型用法代碼示例。如果您正苦於以下問題:Java JSONField類的具體用法?Java JSONField怎麽用?Java JSONField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JSONField類屬於com.alibaba.fastjson.annotation包,在下文中一共展示了JSONField類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isSymmetric
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@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;
}
示例2: createFieldDeserializer
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
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);
}
示例3: getSupperMethodAnnotation
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
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;
}
示例4: createFieldDeserializer
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
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);
}
示例5: FieldSerializer
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
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;
}
}
}
}
示例6: getAnnotation
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
public JSONField getAnnotation() {
if (this.fieldAnnotation != null) {
return this.fieldAnnotation;
}
return this.methodAnnotation;
}
示例7: getPrimaryKey
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@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;
}
示例8: getType
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(serialize = false)
public RemotingCommandType getType() {
if (this.isResponseType()) {
return RemotingCommandType.RESPONSE_COMMAND;
}
return RemotingCommandType.REQUEST_COMMAND;
}
示例9: _enum
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
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);
}
示例10: getTransactionType
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(serialize = false)
public TransactionType getTransactionType() {
return transactionType;
}
示例11: isRefundSuccess
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(serialize = false)
public boolean isRefundSuccess(int num) {
return String.valueOf(num).equals(successNum);
}
示例12: kkId
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(name="id")
public VOBuilder kkId(int id) {
vo.id = id;
return this;
}
示例13: setNextOpenid
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(name = "next_openid")
public void setNextOpenid(String nextOpenid) {
this.nextOpenid = nextOpenid;
}
示例14: setA3
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(deserialize = true)
public void setA3(String a3) {
this.a3 = a3;
}
示例15: isOnewayRPC
import com.alibaba.fastjson.annotation.JSONField; //導入依賴的package包/類
@JSONField(serialize = false)
public boolean isOnewayRPC() {
int bits = 1 << RPC_ONEWAY;
return (this.flag & bits) == bits;
}