Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Jackson Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/util/SimpleBeanPropertyDefinition.java
package com.fasterxml.jackson.databind.util;
import java.util.Collections;
import java.util.Iterator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.type.TypeFactory;
/**
* Simple immutable {@link BeanPropertyDefinition} implementation that can
* be wrapped around a {@link AnnotatedMember} that is a simple
* accessor (getter) or mutator (setter, constructor parameter)
* (or both, for fields).
*/
public class SimpleBeanPropertyDefinition
extends BeanPropertyDefinition
{
protected final AnnotationIntrospector _annotationIntrospector;
/**
* Member that defines logical property. Assumption is that it
* should be a 'simple' accessor; meaning a zero-argument getter,
* single-argument setter or constructor parameter.
*<p>
* NOTE: for "virtual" properties, this is null.
*/
protected final AnnotatedMember _member;
/**
* @since 2.5
*/
protected final PropertyMetadata _metadata;
/**
* @since 2.5
*/
protected final PropertyName _fullName;
/**
* @since 2.5
*/
protected final JsonInclude.Value _inclusion;
/*
/**********************************************************
/* Construction
/**********************************************************
*/
/**
* @since 2.9
*/
protected SimpleBeanPropertyDefinition(AnnotationIntrospector intr,
AnnotatedMember member, PropertyName fullName, PropertyMetadata metadata,
JsonInclude.Value inclusion)
{
_annotationIntrospector = intr;
_member = member;
_fullName = fullName;
_metadata = (metadata == null) ? PropertyMetadata.STD_OPTIONAL: metadata;
_inclusion = inclusion;
}
/**
* @since 2.2
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member)
{
return new SimpleBeanPropertyDefinition(config.getAnnotationIntrospector(),
member, PropertyName.construct(member.getName()), null, EMPTY_INCLUDE);
}
/**
* @since 2.5
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name) {
return construct(config, member, name, null, EMPTY_INCLUDE);
}
/**
* Method called to create instance for virtual properties.
*
* @since 2.5
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name, PropertyMetadata metadata,
JsonInclude.Include inclusion)
{
JsonInclude.Value inclValue
= ((inclusion == null) || (inclusion == JsonInclude.Include.USE_DEFAULTS))
? EMPTY_INCLUDE : JsonInclude.Value.construct(inclusion, null);
return new SimpleBeanPropertyDefinition(config.getAnnotationIntrospector(),
member, name, metadata, inclValue);
}
/**
* @since 2.7
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name, PropertyMetadata metadata,
JsonInclude.Value inclusion) {
return new SimpleBeanPropertyDefinition(config.getAnnotationIntrospector(),
member, name, metadata, inclusion);
}
/*
/**********************************************************
/* Fluent factories
/**********************************************************
*/
@Override
public BeanPropertyDefinition withSimpleName(String newName) {
if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) {
return this;
}
return new SimpleBeanPropertyDefinition(_annotationIntrospector,
_member, new PropertyName(newName), _metadata, _inclusion);
}
@Override
public BeanPropertyDefinition withName(PropertyName newName) {
if (_fullName.equals(newName)) {
return this;
}
return new SimpleBeanPropertyDefinition(_annotationIntrospector,
_member, newName, _metadata, _inclusion);
}
/**
* @since 2.5
*/
public BeanPropertyDefinition withMetadata(PropertyMetadata metadata) {
if (metadata.equals(_metadata)) {
return this;
}
return new SimpleBeanPropertyDefinition(_annotationIntrospector,
_member, _fullName, metadata, _inclusion);
}
/**
* @since 2.5
*/
public BeanPropertyDefinition withInclusion(JsonInclude.Value inclusion) {
if (_inclusion == inclusion) {
return this;
}
return new SimpleBeanPropertyDefinition(_annotationIntrospector,
_member, _fullName, _metadata, inclusion);
}
/*
/**********************************************************
/* Basic property information, name, type
/**********************************************************
*/
@Override
public String getName() { return _fullName.getSimpleName(); }
@Override
public PropertyName getFullName() { return _fullName; }
@Override
public boolean hasName(PropertyName name) {
return _fullName.equals(name);
}
@Override
public String getInternalName() { return getName(); }
@Override
public PropertyName getWrapperName() {
if ((_annotationIntrospector == null) || (_member == null)) {
return null;
}
return _annotationIntrospector.findWrapperName(_member);
}
// hmmh. what should we claim here?
@Override public boolean isExplicitlyIncluded() { return false; }
@Override public boolean isExplicitlyNamed() { return false; }
/**
* We will indicate that property is optional, since there is nothing
* to indicate whether it might be required.
*/
@Override
public PropertyMetadata getMetadata() {
return _metadata;
}
@Override
public JavaType getPrimaryType() {
if (_member == null) {
return TypeFactory.unknownType();
}
return _member.getType();
}
@Override
public Class<?> getRawPrimaryType() {
if (_member == null) {
return Object.class;
}
return _member.getRawType();
}
@Override
public JsonInclude.Value findInclusion() {
return _inclusion;
}
/*
/**********************************************************
/* Access to accessors (fields, methods etc)
/**********************************************************
*/
@Override
public boolean hasGetter() { return (getGetter() != null); }
@Override
public boolean hasSetter() { return (getSetter() != null); }
@Override
public boolean hasField() { return (_member instanceof AnnotatedField); }
@Override
public boolean hasConstructorParameter() { return (_member instanceof AnnotatedParameter); }
@Override
public AnnotatedMethod getGetter() {
if ((_member instanceof AnnotatedMethod)
&& ((AnnotatedMethod) _member).getParameterCount() == 0) {
return (AnnotatedMethod) _member;
}
return null;
}
@Override
public AnnotatedMethod getSetter() {
if ((_member instanceof AnnotatedMethod)
&& ((AnnotatedMethod) _member).getParameterCount() == 1) {
return (AnnotatedMethod) _member;
}
return null;
}
@Override
public AnnotatedField getField() {
return (_member instanceof AnnotatedField) ? (AnnotatedField) _member : null;
}
@Override
public AnnotatedParameter getConstructorParameter() {
return (_member instanceof AnnotatedParameter) ? (AnnotatedParameter) _member : null;
}
@Override
public Iterator<AnnotatedParameter> getConstructorParameters() {
AnnotatedParameter param = getConstructorParameter();
if (param == null) {
return ClassUtil.emptyIterator();
}
return Collections.singleton(param).iterator();
}
@Override
public AnnotatedMember getPrimaryMember() { return _member; }
}
⏎ com/fasterxml/jackson/databind/util/SimpleBeanPropertyDefinition.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, ≈239🔥, 0💬
Popular Posts:
JDK 11 jdk.xml.dom.jmod is the JMOD file for JDK 11 XML DOM module. JDK 11 XML DOM module compiled c...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solut...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...