本文整理汇总了Java中com.google.gson.annotations.Expose.deserialize方法的典型用法代码示例。如果您正苦于以下问题:Java Expose.deserialize方法的具体用法?Java Expose.deserialize怎么用?Java Expose.deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gson.annotations.Expose
的用法示例。
在下文中一共展示了Expose.deserialize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: excludeField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public boolean excludeField(Field field, boolean serialize) {
if ((this.modifiers & field.getModifiers()) != 0) {
return true;
}
if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) field.getAnnotation(Since.class), (Until) field.getAnnotation(Until.class))) {
return true;
}
if (field.isSynthetic()) {
return true;
}
if (this.requireExpose) {
Expose annotation = (Expose) field.getAnnotation(Expose.class);
if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
return true;
}
}
if (!this.serializeInnerClasses && isInnerClass(field.getType())) {
return true;
}
if (isAnonymousOrLocal(field.getType())) {
return true;
}
List<ExclusionStrategy> list = serialize ? this.serializationStrategies : this.deserializationStrategies;
if (!list.isEmpty()) {
FieldAttributes fieldAttributes = new FieldAttributes(field);
for (ExclusionStrategy exclusionStrategy : list) {
if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
return true;
}
}
}
return false;
}
示例2: excludeField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public boolean excludeField(Field field, boolean serialize) {
if ((this.modifiers & field.getModifiers()) != 0) {
return true;
}
if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) field.getAnnotation(Since
.class), (Until) field.getAnnotation(Until.class))) {
return true;
}
if (field.isSynthetic()) {
return true;
}
if (this.requireExpose) {
Expose annotation = (Expose) field.getAnnotation(Expose.class);
if (annotation == null || (serialize ? !annotation.serialize() : !annotation
.deserialize())) {
return true;
}
}
if (!this.serializeInnerClasses && isInnerClass(field.getType())) {
return true;
}
if (isAnonymousOrLocal(field.getType())) {
return true;
}
List<ExclusionStrategy> list = serialize ? this.serializationStrategies : this
.deserializationStrategies;
if (!list.isEmpty()) {
FieldAttributes fieldAttributes = new FieldAttributes(field);
for (ExclusionStrategy exclusionStrategy : list) {
if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
return true;
}
}
}
return false;
}
示例3: shouldSkipField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public boolean shouldSkipField(FieldAttributes f) {
Expose annotation = f.getAnnotation(Expose.class);
if (annotation == null) {
return true;
}
return !annotation.deserialize();
}
开发者ID:IAmPhoenix,项目名称:Minecraft-API-Protocol,代码行数:8,代码来源:ExposeAnnotationDeserializationExclusionStrategy.java
示例4: shouldSkipField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
@Override
public boolean shouldSkipField(final FieldAttributes fieldAttributes) {
Expose exposeAnnotation = fieldAttributes.getAnnotation(Expose.class);
if (exposeAnnotation == null) {
return false;
}
if (useForSerialization) {
return !exposeAnnotation.serialize();
}
return !exposeAnnotation.deserialize();
}
示例5: fromMap
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public <T> T fromMap(Map values, Class<T> objectClass) {
Object createdObject = ReflectionUtils.newInstance(objectClass);
for (Field field : objectClass.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers())) {
continue;
}
Expose exposeAnnotation = field.getAnnotation(Expose.class);
if (exposeAnnotation != null && !exposeAnnotation.deserialize()) {
continue;
}
String nameToUse = determineNameToUseForField(field);
if (!values.containsKey(nameToUse)) {
continue;
}
Object valueToConvert = values.get(nameToUse);
setFieldValue(createdObject, field, valueToConvert);
}
new PostDeserializeHandler().invokePostDeserializeMethods(createdObject);
return (T) createdObject;
}
示例6: isExcluded
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
private boolean isExcluded(Field f) {
int modifiers = f.getModifiers();
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers)) {
return true;
}
Expose expose = f.getAnnotation(Expose.class);
if (expose != null && !expose.deserialize() && !expose.serialize()) {
return true;
}
return false;
}
示例7: excludeField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public boolean excludeField(Field field, boolean serialize) {
if ((modifiers & field.getModifiers()) != 0) {
return true;
}
if (version != Excluder.IGNORE_VERSIONS
&& !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) {
return true;
}
if (field.isSynthetic()) {
return true;
}
if (requireExpose) {
Expose annotation = field.getAnnotation(Expose.class);
if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
return true;
}
}
if (!serializeInnerClasses && isInnerClass(field.getType())) {
return true;
}
if (isAnonymousOrLocal(field.getType())) {
return true;
}
List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
if (!list.isEmpty()) {
FieldAttributes fieldAttributes = new FieldAttributes(field);
for (ExclusionStrategy exclusionStrategy : list) {
if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
return true;
}
}
}
return false;
}
示例8: excludeField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
private boolean excludeField(Field paramField, boolean paramBoolean)
{
if (!this.excluder.excludeClass(paramField.getType(), paramBoolean))
{
Excluder localExcluder = this.excluder;
int i;
if ((localExcluder.modifiers & paramField.getModifiers()) != 0) {
i = 1;
}
while (i == 0)
{
return true;
if ((localExcluder.version != -1.0D) && (!localExcluder.isValidVersion((Since)paramField.getAnnotation(Since.class), (Until)paramField.getAnnotation(Until.class)))) {
i = 1;
} else {
label140:
label270:
if (paramField.isSynthetic())
{
i = 1;
}
else
{
if (localExcluder.requireExpose)
{
Expose localExpose = (Expose)paramField.getAnnotation(Expose.class);
if (localExpose != null)
{
if (!paramBoolean) {
break label140;
}
if (localExpose.serialize()) {
break label150;
}
}
while (!localExpose.deserialize())
{
i = 1;
break;
}
}
label150:
if ((!localExcluder.serializeInnerClasses) && (Excluder.isInnerClass(paramField.getType())))
{
i = 1;
}
else if (Excluder.isAnonymousOrLocal(paramField.getType()))
{
i = 1;
}
else
{
if (paramBoolean) {}
for (List localList = localExcluder.serializationStrategies;; localList = localExcluder.deserializationStrategies)
{
if (localList.isEmpty()) {
break label270;
}
new FieldAttributes(paramField);
Iterator localIterator = localList.iterator();
do
{
if (!localIterator.hasNext()) {
break;
}
} while (!((ExclusionStrategy)localIterator.next()).shouldSkipField$6e8224bb());
i = 1;
break;
}
i = 0;
}
}
}
}
}
return false;
}
示例9: shouldSkipField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
@Override
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
final Expose expose = fieldAttributes.getAnnotation(Expose.class);
return expose != null && !expose.deserialize();
}
示例10: shouldSkipField
import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
@Override
public boolean shouldSkipField(FieldAttributes f) {
final Expose expose = f.getAnnotation(Expose.class);
return expose != null && !expose.deserialize();
}