mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Change @DoNotHydrate to work on fields, not types.
There was a circular reference when hydrating a domain with a subordinate host, since the host references the domain. To fix this, I redid @DoNotHydrate to be the way it should have been, rather than the hack I had originally submitted. I also beefed up the unit tests of the epp resource types to check for cycles. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135792416
This commit is contained in:
parent
27ec47051e
commit
cb8320ff40
12 changed files with 151 additions and 118 deletions
|
@ -209,15 +209,15 @@ public class ModelUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a map from field names (including non-public and inherited fields) to values.
|
||||
* Returns a map from Field objects (including non-public and inherited fields) to values.
|
||||
*
|
||||
* <p>This turns arrays into {@link List} objects so that ImmutableObject can more easily use the
|
||||
* returned map in its implementation of {@link ImmutableObject#toString} and {@link
|
||||
* ImmutableObject#equals}, which work by comparing and printing these maps.
|
||||
*/
|
||||
static Map<String, Object> getFieldValues(Object instance) {
|
||||
static Map<Field, Object> getFieldValues(Object instance) {
|
||||
// Don't make this ImmutableMap because field values can be null.
|
||||
Map<String, Object> values = new LinkedHashMap<>();
|
||||
Map<Field, Object> values = new LinkedHashMap<>();
|
||||
for (Field field : getAllFields(instance.getClass()).values()) {
|
||||
Object value = getFieldValue(instance, field);
|
||||
if (value != null && value.getClass().isArray()) {
|
||||
|
@ -234,7 +234,7 @@ public class ModelUtils {
|
|||
return Array.getLength(arrayValue);
|
||||
}};
|
||||
}
|
||||
values.put(field.getName(), value);
|
||||
values.put(field, value);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue