private Optional<StyleInfo> determineStyle() { if (declaringType().isPresent()) { DeclaringType type = declaringType().get(); Optional<DeclaringType> enclosing = type.enclosingOf(); if (enclosing.isPresent()) { if (enclosing.get() != type) { Optional<StyleInfo> style = type.style(); if (style.isPresent()) { warnAboutIncompatibleStyles(); } } Optional<StyleInfo> enclosingStyle = enclosing.get().style(); if (enclosingStyle.isPresent()) { return enclosingStyle; } } else { Optional<StyleInfo> style = type.style(); if (style.isPresent()) { return style; } Optional<DeclaringType> topLevel = type.enclosingTopLevel(); if (topLevel.isPresent() && topLevel.get().style().isPresent()) { return topLevel.get().style(); } } } return packageOf().style(); }
@Value.Lazy public boolean isJacksonJsonTypeInfo() { if (declaringType().isPresent()) { DeclaringType type = declaringType().get(); if (type.isJacksonJsonTypeInfo()) { return true; } } return packageOf().isJacksonJsonTypeInfo(); }
@Value.Lazy public boolean isSerialStructural() { if (declaringType().isPresent()) { DeclaringType t = declaringType().get(); if (t.isSerialStructural()) { return true; } if (t.enclosingTopLevel().isPresent()) { if (t.enclosingTopLevel().get().isSerialStructural()) { return true; } } } return packageOf().isSerialStructural(); }
@Value.Lazy public Optional<Long> serialVersion() { if (declaringType().isPresent()) { DeclaringType t = declaringType().get(); if (t.serialVersion().isPresent()) { return t.serialVersion(); } if (t.enclosingTopLevel().isPresent()) { if (t.enclosingTopLevel().get().serialVersion().isPresent()) { return t.enclosingTopLevel().get().serialVersion(); } } } return packageOf().serialVersion(); }