Java Code Examples for com.google.gson.internal.Excluder#excludeField()
The following examples show how to use
com.google.gson.internal.Excluder#excludeField() .
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: UnknownPropertiesTypeAdapterFactory.java From sentry-android with MIT License | 6 votes |
private static Collection<String> getPropertyNames( final Class<?> clazz, final Excluder excluder, final FieldNamingStrategy fieldNamingStrategy) { final Collection<String> propertyNames = new ArrayList<>(); // Class fields are declared per class so we have to traverse the whole hierarchy for (Class<?> i = clazz; i.getSuperclass() != null && i != Object.class; i = i.getSuperclass()) { for (final Field declaredField : i.getDeclaredFields()) { // If the class field is not excluded if (!excluder.excludeField(declaredField, false)) { // We can translate the field name to its property name counter-part final String propertyName = fieldNamingStrategy.translateName(declaredField); propertyNames.add(propertyName); } } } return propertyNames; }
Example 2
Source File: LaReflectiveTypeAdapterFactory.java From lastaflute with Apache License 2.0 | 4 votes |
protected static boolean excludeField(Field f, boolean serialize, Excluder excluder) { return !excluder.excludeClass(f.getType(), serialize) && !excluder.excludeField(f, serialize); }
Example 3
Source File: ReflectiveTypeAdapterFactory.java From gson with Apache License 2.0 | 4 votes |
static boolean excludeField(Field f, boolean serialize, Excluder excluder) { return !excluder.excludeClass(f.getType(), serialize) && !excluder.excludeField(f, serialize); }
Example 4
Source File: ReflectiveTypeAdapterFactory.java From framework with GNU Affero General Public License v3.0 | 4 votes |
static boolean excludeField(Field f, boolean serialize, Excluder excluder) { return !excluder.excludeClass(f.getType(), serialize) && !excluder.excludeField(f, serialize); }