All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xiongyingqi.jackson.annotation.IgnoreProperties Maven / Gradle / Ivy

/**
 * YIXUN_1.5_EE
 */
package com.xiongyingqi.jackson.annotation;

import java.lang.annotation.*;

/**
 * json属性过滤注解,对于同一个pojo来说 @AllowProperty 是与 @IgnoreProperty 是冲突的,如果这两个注解注解了
* 例如以下代码YxResource实体只会显示resourceName和resourceDescribe属性 *

*

 * @IgnoreProperties(
 * 	value = {
 * 		@IgnoreProperty(
 * 			pojo = YxResource.class,
 * 			name = {
 * 				"yxResourceDataRelations",
 * 				"yxResourceSelfRelationsForSublevelResourceId",
 * 				"yxPermisionResourceRelations" }),
 * 		@IgnoreProperty(
 * 			pojo = YxResourceSelfRelation.class,
 * 			name = {
 * 				"yxResourceBySuperiorResourceId",
 * 				"id" })
 *    },
 * 	allow = {
 * 	@AllowProperty(
 * 			pojo = YxResource.class,
 * 			name = { "resourceName" }) })
 * 	@AllowProperty(
 * 			pojo = YxResource.class,
 * 			name = { "resourceDescribe" })
 * 
*

*

* 但是,对于同一个pojo的同一属性来说@AllowProperty是与@IgnoreProperty则会按照@IgnoreProperty过滤的属性名过滤 * 例如以下代码YxResource实体不会显示resourceName属性的值 *

*

 * @IgnoreProperties(
 * 	value = {
 * 	@IgnoreProperty(
 * 			pojo = YxResource.class,
 * 			name = { "resourceName",
 * 				"yxResourceDataRelations",
 * 				"yxResourceSelfRelationsForSublevelResourceId",
 * 				"yxPermisionResourceRelations" }),
 * 	@IgnoreProperty(
 * 			pojo = YxResourceSelfRelation.class,
 * 			name = {
 * 				"yxResourceBySuperiorResourceId",
 * 				"id" })
 *    },
 * 	allow = {
 * 	@AllowProperty(
 * 			pojo = YxResource.class,
 * 			name = { "resourceName" }) })
 * 
* * @author 瑛琪 xiongyingqi.com * @version 2013-9-27 下午4:18:39 */ @Documented @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface IgnoreProperties { /** * 要过滤的属性 * * @return */ IgnoreProperty[] value() default @IgnoreProperty(pojo = Object.class, name = ""); /** * 允许的属性 * * @return */ AllowProperty[] allow() default @AllowProperty(pojo = Object.class, name = ""); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy