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;
}
java类com.alibaba.fastjson.annotation.JSONCreator的实例源码
JavaBeanInfo.java 文件源码
项目:GitHub
阅读 28
收藏 0
点赞 0
评论 0
WeixinPayAccount.java 文件源码
项目:pay4j
阅读 37
收藏 0
点赞 0
评论 0
/**
* 支付商户信息
*
* @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;
}
DeserializeBeanInfo.java 文件源码
项目:boohee_v5.6
阅读 31
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:boohee_v5.6
阅读 31
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:uavstack
阅读 43
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:uavstack
阅读 26
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:itmarry
阅读 45
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:itmarry
阅读 31
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:android_http_demo
阅读 39
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:android_http_demo
阅读 29
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:AndroidNio
阅读 45
收藏 0
点赞 0
评论 0
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;
}
DeserializeBeanInfo.java 文件源码
项目:AndroidNio
阅读 32
收藏 0
点赞 0
评论 0
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;
}
FactoryTest.java 文件源码
项目:GitHub
阅读 27
收藏 0
点赞 0
评论 0
@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;
}
FactoryTest.java 文件源码
项目:GitHub
阅读 31
收藏 0
点赞 0
评论 0
@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;
}
Issue1458.java 文件源码
项目:GitHub
阅读 30
收藏 0
点赞 0
评论 0
@JSONCreator
public HostPoint(@JSONField(name = "address") HostAddress addr) {
this.address = addr;
}
Issue1458.java 文件源码
项目:GitHub
阅读 26
收藏 0
点赞 0
评论 0
@JSONCreator
public Fingerprint(@JSONField(name = "source") String fingerprint) {
this.source = fingerprint;
}
FactoryTest_error.java 文件源码
项目:GitHub
阅读 40
收藏 0
点赞 0
评论 0
@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();
}
DefaultObjectDeserializerTest6.java 文件源码
项目:GitHub
阅读 36
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "value") Map<Object, Map<Object, Object>> value){
this.value = value;
}
IntegerFieldDeserializerTest3.java 文件源码
项目:GitHub
阅读 41
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name="f1") int f1, @JSONField(name="f2") Integer f2){
this.f1 = f1;
this.f2 = f2;
}
BooleanFieldDeserializerTest2.java 文件源码
项目:GitHub
阅读 28
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "f1") Boolean f1, @JSONField(name = "f2") Boolean f2){
this.f1 = f1;
this.f2 = f2;
}
LongFieldDeserializerTest3.java 文件源码
项目:GitHub
阅读 43
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "f1") long f1, @JSONField(name = "f2") Long f2){
this.f1 = f1;
this.f2 = f2;
}
JSONCreatorTest8.java 文件源码
项目:GitHub
阅读 36
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "id") int id) {
this.id = id;
}
JSONCreatorTest7.java 文件源码
项目:GitHub
阅读 56
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "values") List<Value> values){
this.values = values;
}
RefTest13.java 文件源码
项目:GitHub
阅读 31
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "id") int id, @JSONField(name = "child") Child child){
super();
this.id = id;
this.child = child;
}
RefTest12.java 文件源码
项目:GitHub
阅读 40
收藏 0
点赞 0
评论 0
@JSONCreator
public Entity(@JSONField(name = "id") int id, @JSONField(name = "child") Child child){
super();
this.id = id;
this.child = child;
}
Bug_for_issue_489.java 文件源码
项目:GitHub
阅读 40
收藏 0
点赞 0
评论 0
@JSONCreator
public Foo(@JSONField(name = "foo") final String bar){
this.bar = bar;
}
Issue1085.java 文件源码
项目:GitHub
阅读 35
收藏 0
点赞 0
评论 0
@JSONCreator
public static AbstractModel createInstance() {
return new Model();
}
WeixinAccount.java 文件源码
项目:pay4j
阅读 35
收藏 0
点赞 0
评论 0
@JSONCreator
public WeixinAccount(@JSONField(name = "id") String id,
@JSONField(name = "secret") String secret) {
this.id = id;
this.secret = secret;
}
Issue1344.java 文件源码
项目:GitHub
阅读 38
收藏 0
点赞 0
评论 0
@JSONCreator
public TestException() {
}