本文整理汇总了Java中org.codehaus.jackson.annotate.JsonIgnoreProperties类的典型用法代码示例。如果您正苦于以下问题:Java JsonIgnoreProperties类的具体用法?Java JsonIgnoreProperties怎么用?Java JsonIgnoreProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonIgnoreProperties类属于org.codehaus.jackson.annotate包,在下文中一共展示了JsonIgnoreProperties类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findIgnoreUnknownProperties
import org.codehaus.jackson.annotate.JsonIgnoreProperties; //导入依赖的package包/类
public Boolean findIgnoreUnknownProperties(AnnotatedClass paramAnnotatedClass)
{
JsonIgnoreProperties localJsonIgnoreProperties = (JsonIgnoreProperties)paramAnnotatedClass.getAnnotation(JsonIgnoreProperties.class);
if (localJsonIgnoreProperties == null)
return null;
return Boolean.valueOf(localJsonIgnoreProperties.ignoreUnknown());
}
示例2: findPropertiesToIgnore
import org.codehaus.jackson.annotate.JsonIgnoreProperties; //导入依赖的package包/类
public String[] findPropertiesToIgnore(AnnotatedClass paramAnnotatedClass)
{
JsonIgnoreProperties localJsonIgnoreProperties = (JsonIgnoreProperties)paramAnnotatedClass.getAnnotation(JsonIgnoreProperties.class);
if (localJsonIgnoreProperties == null)
return null;
return localJsonIgnoreProperties.value();
}
示例3: createMixInAnnotation
import org.codehaus.jackson.annotate.JsonIgnoreProperties; //导入依赖的package包/类
/**
* 创建jackson的代理注解接口类 <br>
* 2013-10-25 上午11:59:50
*
* @param names 要生成的字段
* @return 代理接口类
*/
private Class<?> createMixInAnnotation(String[] names) {
Class<?> clazz = null;
clazz = proxyMixInAnnotationMap.get(StringHelper.hashCodeOfStringArray(names));
if (clazz != null) {
return clazz;
}
ClassPool pool = ClassPool.getDefault();
// 创建代理接口
CtClass cc = pool.makeInterface("ProxyMixInAnnotation" + System.currentTimeMillis()
+ proxyIndex++);
ClassFile ccFile = cc.getClassFile();
ConstPool constpool = ccFile.getConstPool();
// create the annotation
AnnotationsAttribute attr = new AnnotationsAttribute(constpool,
AnnotationsAttribute.visibleTag);
// 创建JsonIgnoreProperties注解
Annotation jsonIgnorePropertiesAnnotation = new Annotation(
JsonIgnoreProperties.class.getName(), constpool);
BooleanMemberValue ignoreUnknownMemberValue = new BooleanMemberValue(false, constpool);
ArrayMemberValue arrayMemberValue = new ArrayMemberValue(constpool);// value的数组成员
Collection<MemberValue> memberValues = new HashSet<MemberValue>();
for (int i = 0; i < names.length; i++) {
String name = names[i];
StringMemberValue memberValue = new StringMemberValue(constpool);// 将name值设入注解内
memberValue.setValue(name);
memberValues.add(memberValue);
}
arrayMemberValue.setValue(memberValues.toArray(new MemberValue[]{}));
jsonIgnorePropertiesAnnotation.addMemberValue("value", arrayMemberValue);
jsonIgnorePropertiesAnnotation.addMemberValue("ignoreUnknown", ignoreUnknownMemberValue);
attr.addAnnotation(jsonIgnorePropertiesAnnotation);
ccFile.addAttribute(attr);
// generate the class
try {
clazz = cc.toClass();
proxyMixInAnnotationMap.put(StringHelper.hashCodeOfStringArray(names), clazz);
// JsonIgnoreProperties ignoreProperties = (JsonIgnoreProperties)
// clazz
// .getAnnotation(JsonIgnoreProperties.class);
// EntityHelper.print(ignoreProperties);
//
// EntityHelper.print(clazz);
// try {
// Object instance = clazz.newInstance();
// EntityHelper.print(instance);
//
// } catch (InstantiationException e) {
// e.printStackTrace();
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// }
} catch (CannotCompileException e) {
e.printStackTrace();
}
// right
// mthd.getMethodInfo().addAttribute(attr);
return clazz;
}