Java Code Examples for com.google.gson.FieldAttributes#getName()
The following examples show how to use
com.google.gson.FieldAttributes#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Exclusions.java From vraptor4 with Apache License 2.0 | 6 votes |
@Override public boolean shouldSkipField(FieldAttributes f) { SkipSerialization annotation = f.getAnnotation(SkipSerialization.class); if (annotation != null) return true; String fieldName = f.getName(); Class<?> definedIn = f.getDeclaringClass(); for (Entry<String, Class<?>> include : serializee.getIncludes().entries()) { if (isCompatiblePath(include, definedIn, fieldName)) { return false; } } for (Entry<String, Class<?>> exclude : serializee.getExcludes().entries()) { if (isCompatiblePath(exclude, definedIn, fieldName)) { return true; } } Field field = reflectionProvider.getField(definedIn, fieldName); return !serializee.isRecursive() && !shouldSerializeField(field.getType()); }
Example 2
Source File: DuplicateFieldExclusionStrategy.java From opentest with MIT License | 5 votes |
@Override public boolean shouldSkipField(FieldAttributes fieldAttributes) { String fieldName = fieldAttributes.getName(); Class<?> theClass = fieldAttributes.getDeclaringClass(); return isFieldInSuperclass(theClass, fieldName); }
Example 3
Source File: SuperclassExclusionStrategy.java From cosmic with Apache License 2.0 | 5 votes |
public boolean shouldSkipField(FieldAttributes fieldAttributes) { String fieldName = fieldAttributes.getName(); Class<?> theClass = fieldAttributes.getDeclaringClass(); Class<?> superclass = theClass.getSuperclass(); if (this.inheritanceMap.containsKey(theClass)) { if (getField(this.inheritanceMap.get(theClass), fieldName) != null) { return true; } } this.inheritanceMap.put(superclass, theClass); return false; }
Example 4
Source File: GsonUtils.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
public boolean shouldSkipField(FieldAttributes fieldAttributes) { String fieldName = fieldAttributes.getName(); Class<?> theClass = fieldAttributes.getDeclaringClass(); return isFieldInSuperclass(theClass, fieldName); }