当前位置: 首页>>代码示例>>Java>>正文


Java Expose.serialize方法代码示例

本文整理汇总了Java中com.google.gson.annotations.Expose.serialize方法的典型用法代码示例。如果您正苦于以下问题:Java Expose.serialize方法的具体用法?Java Expose.serialize怎么用?Java Expose.serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gson.annotations.Expose的用法示例。


在下文中一共展示了Expose.serialize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toMap

import com.google.gson.annotations.Expose; //导入方法依赖的package包/类
public Map<String, Object> toMap(Object requestObject) {
    Map<String, Object> valuesToWrite = new HashMap<>();
    for (Field field : requestObject.getClass().getDeclaredFields()) {
        if (Modifier.isStatic(field.getModifiers())) {
            continue;
        }
        if (Modifier.isPrivate(field.getModifiers())) {
            continue;
        }
        Expose expose = field.getAnnotation(Expose.class);
        if (expose != null && !expose.serialize()) {
            continue;
        }
        Object value = ReflectionUtils.getValue(field, requestObject);
        if (value == null) {
            continue;
        }
        SerializedName serializedName = field.getAnnotation(SerializedName.class);
        String nameToUse = serializedName != null ? serializedName.value() : field.getName();
        Object valueToUse = determineCorrectValue(value);
        if (valueToUse != null) {
            valuesToWrite.put(nameToUse, valueToUse);
        }
    }
    return valuesToWrite;
}
 
开发者ID:vmware,项目名称:workflowTools,代码行数:27,代码来源:MapObjectConverter.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:34,代码来源:Excluder.java

示例3: 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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:Excluder.java

示例4: 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.serialize();
}
 
开发者ID:IAmPhoenix,项目名称:Minecraft-API-Protocol,代码行数:8,代码来源:ExposeAnnotationSerializationExclusionStrategy.java

示例5: 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();
}
 
开发者ID:vmware,项目名称:workflowTools,代码行数:12,代码来源:ImprovedExclusionStrategy.java

示例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;
}
 
开发者ID:greensopinion,项目名称:swagger-jaxrs-maven,代码行数:12,代码来源:GsonIntrospector.java

示例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;
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:42,代码来源:Excluder.java

示例8: 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.serialize();
}
 
开发者ID:macoscope,项目名称:RoomBookerMVP,代码行数:6,代码来源:JsonExclusionStrategy.java

示例9: 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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:78,代码来源:ReflectiveTypeAdapterFactory.java

示例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.serialize();
}
 
开发者ID:cerndb,项目名称:dbod-webapp,代码行数:6,代码来源:AnnotationExclusionStrategySerialization.java


注:本文中的com.google.gson.annotations.Expose.serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。