lowentry.ue4.libs.jackson.databind.introspect.ConcreteBeanPropertyBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lowentryue4 Show documentation
Show all versions of lowentryue4 Show documentation
A Java library for the Low Entry UE4 plugins.
package lowentry.ue4.libs.jackson.databind.introspect;
import java.util.Collections;
import java.util.List;
import lowentry.ue4.libs.jackson.annotation.JsonFormat;
import lowentry.ue4.libs.jackson.annotation.JsonInclude;
import lowentry.ue4.libs.jackson.databind.AnnotationIntrospector;
import lowentry.ue4.libs.jackson.databind.BeanProperty;
import lowentry.ue4.libs.jackson.databind.PropertyMetadata;
import lowentry.ue4.libs.jackson.databind.PropertyName;
import lowentry.ue4.libs.jackson.databind.cfg.MapperConfig;
/**
* Intermediate {@link BeanProperty} class shared by concrete readable- and
* writable property implementations for sharing common functionality.
*
* @since 2.7
*/
@SuppressWarnings("all")
public abstract class ConcreteBeanPropertyBase
implements BeanProperty, java.io.Serializable
{
private static final long serialVersionUID = 1;
/**
* Additional information about property
*
* @since 2.3
*/
protected final PropertyMetadata _metadata;
/**
* @since 2.9
*/
protected transient List _aliases;
protected ConcreteBeanPropertyBase(PropertyMetadata md) {
_metadata = (md == null) ? PropertyMetadata.STD_REQUIRED_OR_OPTIONAL : md;
}
protected ConcreteBeanPropertyBase(ConcreteBeanPropertyBase src) {
_metadata = src._metadata;
}
@Override
public boolean isRequired() { return _metadata.isRequired(); }
@Override
public PropertyMetadata getMetadata() { return _metadata; }
@Override
public boolean isVirtual() { return false; }
@Override
@Deprecated
public final JsonFormat.Value findFormatOverrides(AnnotationIntrospector intr) {
JsonFormat.Value f = null;
if (intr != null) {
AnnotatedMember member = getMember();
if (member != null) {
f = intr.findFormat(member);
}
}
if (f == null) {
f = EMPTY_FORMAT;
}
return f;
}
@Override
public JsonFormat.Value findPropertyFormat(MapperConfig> config, Class> baseType)
{
JsonFormat.Value v1 = config.getDefaultPropertyFormat(baseType);
JsonFormat.Value v2 = null;
AnnotationIntrospector intr = config.getAnnotationIntrospector();
if (intr != null) {
AnnotatedMember member = getMember();
if (member != null) {
v2 = intr.findFormat(member);
}
}
if (v1 == null) {
return (v2 == null) ? EMPTY_FORMAT : v2;
}
return (v2 == null) ? v1 : v1.withOverrides(v2);
}
@Override
public JsonInclude.Value findPropertyInclusion(MapperConfig> config, Class> baseType)
{
AnnotationIntrospector intr = config.getAnnotationIntrospector();
AnnotatedMember member = getMember();
if (member == null) {
JsonInclude.Value def = config.getDefaultPropertyInclusion(baseType);
return def;
}
JsonInclude.Value v0 = config.getDefaultInclusion(baseType, member.getRawType());
if (intr == null) {
return v0;
}
JsonInclude.Value v = intr.findPropertyInclusion(member);
if (v0 == null) {
return v;
}
return v0.withOverrides(v);
}
@Override
public List findAliases(MapperConfig> config)
{
List aliases = _aliases;
if (aliases == null) {
AnnotationIntrospector intr = config.getAnnotationIntrospector();
if (intr != null) {
final AnnotatedMember member = getMember();
if (member != null) {
aliases = intr.findPropertyAliases(member);
}
}
if (aliases == null) {
aliases = Collections.emptyList();
}
_aliases = aliases;
}
return aliases;
}
}