本文整理匯總了Java中com.google.gson.ExclusionStrategy.shouldSkipClass方法的典型用法代碼示例。如果您正苦於以下問題:Java ExclusionStrategy.shouldSkipClass方法的具體用法?Java ExclusionStrategy.shouldSkipClass怎麽用?Java ExclusionStrategy.shouldSkipClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gson.ExclusionStrategy
的用法示例。
在下文中一共展示了ExclusionStrategy.shouldSkipClass方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: excludeClass
import com.google.gson.ExclusionStrategy; //導入方法依賴的package包/類
public boolean excludeClass(Class<?> clazz, boolean serialize) {
if (version != Excluder.IGNORE_VERSIONS
&& !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) {
return true;
}
if (!serializeInnerClasses && isInnerClass(clazz)) {
return true;
}
if (isAnonymousOrLocal(clazz)) {
return true;
}
List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
for (ExclusionStrategy exclusionStrategy : list) {
if (exclusionStrategy.shouldSkipClass(clazz)) {
return true;
}
}
return false;
}
示例2: excludeClass
import com.google.gson.ExclusionStrategy; //導入方法依賴的package包/類
public boolean excludeClass(Class<?> clazz, boolean serialize) {
if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) clazz.getAnnotation(Since.class), (Until) clazz.getAnnotation(Until.class))) {
return true;
}
if (!this.serializeInnerClasses && isInnerClass(clazz)) {
return true;
}
if (isAnonymousOrLocal(clazz)) {
return true;
}
for (ExclusionStrategy exclusionStrategy : serialize ? this.serializationStrategies : this.deserializationStrategies) {
if (exclusionStrategy.shouldSkipClass(clazz)) {
return true;
}
}
return false;
}
示例3: excludeClass
import com.google.gson.ExclusionStrategy; //導入方法依賴的package包/類
public boolean excludeClass(Class<?> clazz, boolean serialize) {
if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) clazz.getAnnotation(Since
.class), (Until) clazz.getAnnotation(Until.class))) {
return true;
}
if (!this.serializeInnerClasses && isInnerClass(clazz)) {
return true;
}
if (isAnonymousOrLocal(clazz)) {
return true;
}
for (ExclusionStrategy exclusionStrategy : serialize ? this.serializationStrategies :
this.deserializationStrategies) {
if (exclusionStrategy.shouldSkipClass(clazz)) {
return true;
}
}
return false;
}