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

项目:GitHub    文件:JavaBeanInfo.java   
private static Method getFactoryMethod(Class<?> clazz, Method[] methods) {
    Method factoryMethod = null;

    for (Method method : methods) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        if (!clazz.isAssignableFrom(method.getReturnType())) {
            continue;
        }

        JSONCreator annotation = method.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (factoryMethod != null) {
                throw new JSONException("multi-JSONCreator");
            }

            factoryMethod = method;
            // 不应该break,否则多个静态工厂方法上存在 JSONCreator 注解时,并不会触发上述异常抛出
        }
    }
    return factoryMethod;
}
项目:pay4j    文件:WeixinPayAccount.java   
/**
 * 支付商户信息
 *
 * @param id             公众号唯一的身份ID(必填)
 * @param secret         公众号调用接口的凭证(最好填写)
 * @param paySignKey     支付密钥字符串(必填)
 * @param mchId          微信支付分配的商户号(必填)
 * @param certificateKey 加载支付证书文件的密码(默认为商户号)
 * @param deviceInfo     微信支付分配的设备号(非必填)
 * @param partnerId      财付通的商户号(非必填)
 * @param subId          微信分配的子商户公众账号ID(非必填)
 * @param subMchId       微信支付分配的子商户号(非必填)
 */
@JSONCreator
public WeixinPayAccount(@JSONField(name = "id") String id,
                        @JSONField(name = "secret") String secret,
                        @JSONField(name = "paySignKey") String paySignKey,
                        @JSONField(name = "mchId") String mchId,
                        @JSONField(name = "certificateKey") String certificateKey,
                        @JSONField(name = "deviceInfo") String deviceInfo,
                        @JSONField(name = "partnerId") String partnerId,
                        @JSONField(name = "subId") String subId,
                        @JSONField(name = "subMchId") String subMchId) {
    super(id, secret);
    this.paySignKey = paySignKey;
    this.mchId = mchId;
    this.certificateKey = certificateKey;
    this.deviceInfo = deviceInfo;
    this.partnerId = partnerId;
    this.subId = subId;
    this.subMchId = subMchId;
}
项目:boohee_v5.6    文件:DeserializeBeanInfo.java   
public static Constructor<?> getCreatorConstructor(Class<?> clazz) {
    Constructor[] declaredConstructors = clazz.getDeclaredConstructors();
    int length = declaredConstructors.length;
    int i = 0;
    while (i < length) {
        Constructor<?> constructor = declaredConstructors[i];
        if (((JSONCreator) constructor.getAnnotation(JSONCreator.class)) == null) {
            i++;
        } else if (null == null) {
            return constructor;
        } else {
            throw new JSONException("multi-json creator");
        }
    }
    return null;
}
项目:boohee_v5.6    文件:DeserializeBeanInfo.java   
public static Method getFactoryMethod(Class<?> clazz) {
    Method[] declaredMethods = clazz.getDeclaredMethods();
    int length = declaredMethods.length;
    int i = 0;
    while (i < length) {
        Method method = declaredMethods[i];
        if (!Modifier.isStatic(method.getModifiers()) || !clazz.isAssignableFrom(method.getReturnType()) || ((JSONCreator) method.getAnnotation(JSONCreator.class)) == null) {
            i++;
        } else if (null == null) {
            return method;
        } else {
            throw new JSONException("multi-json creator");
        }
    }
    return null;
}
项目:uavstack    文件:DeserializeBeanInfo.java   
public static Constructor<?> getCreatorConstructor(Class<?> clazz) {
    Constructor<?> creatorConstructor = null;

    for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
        JSONCreator annotation = constructor.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (creatorConstructor != null) {
                throw new JSONException("multi-json creator");
            }

            creatorConstructor = constructor;
            break;
        }
    }
    return creatorConstructor;
}
项目:uavstack    文件:DeserializeBeanInfo.java   
public static Method getFactoryMethod(Class<?> clazz) {
    Method factoryMethod = null;

    for (Method method : clazz.getDeclaredMethods()) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        if (!clazz.isAssignableFrom(method.getReturnType())) {
            continue;
        }

        JSONCreator annotation = method.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (factoryMethod != null) {
                throw new JSONException("multi-json creator");
            }

            factoryMethod = method;
            break;
        }
    }
    return factoryMethod;
}
项目:itmarry    文件:DeserializeBeanInfo.java   
public static Constructor<?> getCreatorConstructor(Class<?> clazz) {
    Constructor<?> creatorConstructor = null;

    for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
        JSONCreator annotation = constructor.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (creatorConstructor != null) {
                throw new JSONException("multi-json creator");
            }

            creatorConstructor = constructor;
            break;
        }
    }
    return creatorConstructor;
}
项目:itmarry    文件:DeserializeBeanInfo.java   
public static Method getFactoryMethod(Class<?> clazz) {
    Method factoryMethod = null;

    for (Method method : clazz.getDeclaredMethods()) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        if (!clazz.isAssignableFrom(method.getReturnType())) {
            continue;
        }

        JSONCreator annotation = method.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (factoryMethod != null) {
                throw new JSONException("multi-json creator");
            }

            factoryMethod = method;
            break;
        }
    }
    return factoryMethod;
}
项目:android_http_demo    文件:DeserializeBeanInfo.java   
public static Constructor<?> getCreatorConstructor(Class<?> clazz) {
    Constructor<?> creatorConstructor = null;

    for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
        JSONCreator annotation = constructor.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (creatorConstructor != null) {
                throw new JSONException("multi-json creator");
            }

            creatorConstructor = constructor;
            break;
        }
    }
    return creatorConstructor;
}
项目:android_http_demo    文件:DeserializeBeanInfo.java   
public static Method getFactoryMethod(Class<?> clazz) {
    Method factoryMethod = null;

    for (Method method : clazz.getDeclaredMethods()) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        if (!clazz.isAssignableFrom(method.getReturnType())) {
            continue;
        }

        JSONCreator annotation = method.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (factoryMethod != null) {
                throw new JSONException("multi-json creator");
            }

            factoryMethod = method;
            break;
        }
    }
    return factoryMethod;
}
项目:AndroidNio    文件:DeserializeBeanInfo.java   
public static Constructor<?> getCreatorConstructor(Class<?> clazz) {
    Constructor<?> creatorConstructor = null;

    for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
        JSONCreator annotation = constructor.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (creatorConstructor != null) {
                throw new JSONException("multi-json creator");
            }

            creatorConstructor = constructor;
            break;
        }
    }
    return creatorConstructor;
}
项目:AndroidNio    文件:DeserializeBeanInfo.java   
public static Method getFactoryMethod(Class<?> clazz) {
    Method factoryMethod = null;

    for (Method method : clazz.getDeclaredMethods()) {
        if (!Modifier.isStatic(method.getModifiers())) {
            continue;
        }

        if (!clazz.isAssignableFrom(method.getReturnType())) {
            continue;
        }

        JSONCreator annotation = method.getAnnotation(JSONCreator.class);
        if (annotation != null) {
            if (factoryMethod != null) {
                throw new JSONException("multi-json creator");
            }

            factoryMethod = method;
            break;
        }
    }
    return factoryMethod;
}
项目:GitHub    文件:FactoryTest.java   
@JSONCreator
public VO(@JSONField(name = "b") boolean b, @JSONField(name = "i") int i, @JSONField(name = "l") long l,
          @JSONField(name = "f") float f){
    super();
    this.b = b;
    this.i = i;
    this.l = l;
    this.f = f;
}
项目:GitHub    文件:FactoryTest.java   
@JSONCreator
public static V1 create(@JSONField(name = "b") boolean b, @JSONField(name = "i") int i,
                        @JSONField(name = "l") long l, @JSONField(name = "f") float f) {
    V1 v = new V1(b);
    v.i = i;
    v.l = l;
    v.f = f;

    return v;
}
项目: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;
}
项目:GitHub    文件:FactoryTest_error.java   
@JSONCreator
public static V1 create(@JSONField(name = "b") boolean b, @JSONField(name = "i") int i,
                        @JSONField(name = "l") long l, @JSONField(name = "f") float f) {
    throw new IllegalStateException();
}
项目:GitHub    文件:DefaultObjectDeserializerTest6.java   
@JSONCreator
public Entity(@JSONField(name = "value") Map<Object, Map<Object, Object>> value){
    this.value = value;
}
项目:GitHub    文件:IntegerFieldDeserializerTest3.java   
@JSONCreator
public Entity(@JSONField(name="f1") int f1, @JSONField(name="f2") Integer f2){
    this.f1 = f1;
    this.f2 = f2;
}
项目:GitHub    文件:BooleanFieldDeserializerTest2.java   
@JSONCreator
public Entity(@JSONField(name = "f1") Boolean f1, @JSONField(name = "f2") Boolean f2){
    this.f1 = f1;
    this.f2 = f2;
}
项目:GitHub    文件:LongFieldDeserializerTest3.java   
@JSONCreator
public Entity(@JSONField(name = "f1") long f1, @JSONField(name = "f2") Long f2){
    this.f1 = f1;
    this.f2 = f2;
}
项目:GitHub    文件:JSONCreatorTest8.java   
@JSONCreator
public Entity(@JSONField(name = "id") int id) {
    this.id = id;
}
项目:GitHub    文件:JSONCreatorTest7.java   
@JSONCreator
public Entity(@JSONField(name = "values") List<Value> values){
    this.values = values;
}
项目:GitHub    文件:RefTest13.java   
@JSONCreator
public Entity(@JSONField(name = "id") int id, @JSONField(name = "child") Child child){
    super();
    this.id = id;
    this.child = child;
}
项目:GitHub    文件:RefTest12.java   
@JSONCreator
public Entity(@JSONField(name = "id") int id, @JSONField(name = "child") Child child){
    super();
    this.id = id;
    this.child = child;
}
项目:GitHub    文件:Bug_for_issue_489.java   
@JSONCreator
public Foo(@JSONField(name = "foo") final String bar){
    this.bar = bar;
}
项目:GitHub    文件:Issue1085.java   
@JSONCreator
public static AbstractModel createInstance() {
    return new Model();
}
项目:pay4j    文件:WeixinAccount.java   
@JSONCreator
public WeixinAccount(@JSONField(name = "id") String id,
        @JSONField(name = "secret") String secret) {
    this.id = id;
    this.secret = secret;
}
项目:GitHub    文件:Issue1344.java   
@JSONCreator
public TestException() {

}