You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// child class in different packagepublicfinalclassCommunityGalleryInnerextendsPirCommunityGalleryResource {
@OverridepublicJsonWritertoJson(JsonWriterjsonWriter) throwsIOException {
jsonWriter.writeStartObject();
// `innerIdentifier()` can't be accessed, as it is privatejsonWriter.writeJsonField("identifier", innerIdentifier());
returnjsonWriter.writeEndObject();
}
publicstaticCommunityGalleryInnerfromJson(JsonReaderjsonReader) throwsIOException {
returnjsonReader.readObject(reader -> {
CommunityGalleryInnerdeserializedCommunityGalleryInner = newCommunityGalleryInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
StringfieldName = reader.getFieldName();
reader.nextToken();
if ("identifier".equals(fieldName)) {
// `withInnerIdentifier()` can't be accessed, as parent class is in a different package and the method is package privatedeserializedCommunityGalleryInner.withInnerIdentifier(CommunityGalleryIdentifier.fromJson(reader));
} else {
reader.skipChildren();
}
}
returndeserializedCommunityGalleryInner;
});
}
}
This is similar to the discriminator issue, which we solved by shadowing the discriminator in child class: #2639
We could do similar things here, though we may need to also override parent flatten properties getter and setter, e.g. in child class:
toJsoncan't access parent class's flattened property getter, as the getter is private(no matter whether they are in the same package)fromJsoncan't access parent class's flattened property setter, as it's package private and parent class is in a different packageParent class:
Child class:
This is similar to the discriminator issue, which we solved by shadowing the discriminator in child class:
#2639
We could do similar things here, though we may need to also override parent flatten properties getter and setter, e.g. in child class: