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/introspect/AnnotationMap.java
package com.fasterxml.jackson.databind.introspect;
import java.lang.annotation.Annotation;
import java.util.*;
import com.fasterxml.jackson.databind.util.Annotations;
/**
* Simple helper class used to keep track of collection of
* Jackson Annotations associated with annotatable things
* (methods, constructors, classes).
* Note that only Jackson-owned annotations are tracked (for now?).
*/
public final class AnnotationMap implements Annotations
{
protected HashMap<Class<?>,Annotation> _annotations;
public AnnotationMap() { }
public static AnnotationMap of(Class<?> type, Annotation value) {
HashMap<Class<?>,Annotation> ann = new HashMap<>(4);
ann.put(type, value);
return new AnnotationMap(ann);
}
AnnotationMap(HashMap<Class<?>,Annotation> a) {
_annotations = a;
}
/*
/**********************************************************
/* Annotations impl
/**********************************************************
*/
@SuppressWarnings("unchecked")
@Override
public <A extends Annotation> A get(Class<A> cls)
{
if (_annotations == null) {
return null;
}
return (A) _annotations.get(cls);
}
@Override
public boolean has(Class<?> cls)
{
if (_annotations == null) {
return false;
}
return _annotations.containsKey(cls);
}
/**
* Helper method that can be used for a "bulk" check to see if at least
* one of given annotation types is included within this map.
*
* @since 2.7
*/
@Override
public boolean hasOneOf(Class<? extends Annotation>[] annoClasses) {
if (_annotations != null) {
for (int i = 0, end = annoClasses.length; i < end; ++i) {
if (_annotations.containsKey(annoClasses[i])) {
return true;
}
}
}
return false;
}
/*
/**********************************************************
/* Other API
/**********************************************************
*/
/**
* @since 2.3
*/
public Iterable<Annotation> annotations() {
if (_annotations == null || _annotations.size() == 0) {
return Collections.emptyList();
}
return _annotations.values();
}
public static AnnotationMap merge(AnnotationMap primary, AnnotationMap secondary)
{
if (primary == null || primary._annotations == null || primary._annotations.isEmpty()) {
return secondary;
}
if (secondary == null || secondary._annotations == null || secondary._annotations.isEmpty()) {
return primary;
}
HashMap<Class<?>,Annotation> annotations = new HashMap<Class<?>,Annotation>();
// add secondary ones first
for (Annotation ann : secondary._annotations.values()) {
annotations.put(ann.annotationType(), ann);
}
// to be overridden by primary ones
for (Annotation ann : primary._annotations.values()) {
annotations.put(ann.annotationType(), ann);
}
return new AnnotationMap(annotations);
}
@Override
public int size() {
return (_annotations == null) ? 0 : _annotations.size();
}
/**
* Method called to add specified annotation in the Map, but
* only if it didn't yet exist.
*/
public boolean addIfNotPresent(Annotation ann)
{
if (_annotations == null || !_annotations.containsKey(ann.annotationType())) {
_add(ann);
return true;
}
return false;
}
/**
* Method called to add specified annotation in the Map.
*
* @return True if the addition changed the contents, that is, this map did not
* already have specified annotation
*/
public boolean add(Annotation ann) {
return _add(ann);
}
@Override
public String toString() {
if (_annotations == null) {
return "[null]";
}
return _annotations.toString();
}
/*
/**********************************************************
/* Helper methods
/**********************************************************
*/
protected final boolean _add(Annotation ann) {
if (_annotations == null) {
_annotations = new HashMap<Class<?>,Annotation>();
}
Annotation previous = _annotations.put(ann.annotationType(), ann);
return (previous == null) || !previous.equals(ann);
}
}
⏎ com/fasterxml/jackson/databind/introspect/AnnotationMap.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, ≈154🔥, 0💬
Popular Posts:
What is ojdbc.jar - JDBC Driver for Oracle? ojdbc.jar is a JDBC driver from Oracle that provides dat...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
What Is wstx-asl-3.2.8.jar? wstx-asl-3.2.8.jar is JAR file for the ASL component of Woodstox 3.2.8. ...