Skip to content

Commit e711d7e

Browse files
authored
Remove almost all deprecated methods from (Basic)BeanDescription (#4527)
1 parent 04ead23 commit e711d7e

File tree

2 files changed

+1
-112
lines changed

2 files changed

+1
-112
lines changed

src/main/java/com/fasterxml/jackson/databind/BeanDescription.java

+1-43
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package com.fasterxml.jackson.databind;
22

3-
import java.lang.reflect.Constructor;
4-
import java.lang.reflect.Method;
53
import java.util.*;
64

75
import com.fasterxml.jackson.annotation.JsonCreator;
86
import com.fasterxml.jackson.annotation.JsonFormat;
97
import com.fasterxml.jackson.annotation.JsonInclude;
8+
109
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
1110
import com.fasterxml.jackson.databind.introspect.*;
12-
import com.fasterxml.jackson.databind.type.TypeBindings;
1311
import com.fasterxml.jackson.databind.util.Annotations;
1412
import com.fasterxml.jackson.databind.util.Converter;
1513

@@ -82,26 +80,6 @@ public boolean isNonStaticInnerClass() {
8280
*/
8381
public abstract boolean hasKnownClassAnnotations();
8482

85-
/**
86-
* Accessor for type bindings that may be needed to fully resolve
87-
* types of member object, such as return and argument types of
88-
* methods and constructors, and types of fields.
89-
*
90-
* @deprecated Since 2.7, should not need to access bindings directly
91-
*/
92-
@Deprecated
93-
public abstract TypeBindings bindingsForBeanType();
94-
95-
/**
96-
* Method for resolving given JDK type, using this bean as the
97-
* generic type resolution context.
98-
*
99-
* @deprecated Since 2.8, should simply call <code>getType</code> of
100-
* property accessor directly.
101-
*/
102-
@Deprecated
103-
public abstract JavaType resolveType(java.lang.reflect.Type jdkType);
104-
10583
/**
10684
* Method for accessing collection of annotations the bean
10785
* class has.
@@ -129,14 +107,6 @@ public boolean isNonStaticInnerClass() {
129107
*/
130108
public abstract List<BeanPropertyDefinition> findBackReferences();
131109

132-
/**
133-
* Method for locating all back-reference properties (setters, fields) bean has
134-
*
135-
* @deprecated Since 2.9 use {@link #findBackReferences()} instead
136-
*/
137-
@Deprecated
138-
public abstract Map<String,AnnotatedMember> findBackReferenceProperties();
139-
140110
/*
141111
/**********************************************************
142112
/* Basic API for finding creator members
@@ -196,18 +166,6 @@ public boolean isNonStaticInnerClass() {
196166
*/
197167
public abstract AnnotatedConstructor findDefaultConstructor();
198168

199-
/**
200-
* @deprecated Since 2.13: instead use {@link #getConstructors()}, filter.
201-
*/
202-
@Deprecated
203-
public abstract Constructor<?> findSingleArgConstructor(Class<?>... argTypes);
204-
205-
/**
206-
* @deprecated Since 2.13: instead use {@link #getFactoryMethods()}, filter.
207-
*/
208-
@Deprecated
209-
public abstract Method findFactoryMethod(Class<?>... expArgTypes);
210-
211169
/*
212170
/**********************************************************
213171
/* Basic API for finding property accessors

src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java

-69
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
1313
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
1414
import com.fasterxml.jackson.databind.cfg.MapperConfig;
15-
import com.fasterxml.jackson.databind.type.TypeBindings;
1615
import com.fasterxml.jackson.databind.util.Annotations;
1716
import com.fasterxml.jackson.databind.util.ClassUtil;
1817
import com.fasterxml.jackson.databind.util.Converter;
@@ -271,20 +270,6 @@ public Annotations getClassAnnotations() {
271270
return _classInfo.getAnnotations();
272271
}
273272

274-
@Override
275-
@Deprecated // since 2.7
276-
public TypeBindings bindingsForBeanType() {
277-
return _type.getBindings();
278-
}
279-
280-
@Override
281-
@Deprecated // since 2.8
282-
public JavaType resolveType(java.lang.reflect.Type jdkType) {
283-
// 06-Sep-2020, tatu: Careful wrt [databind#2846][databind#2821],
284-
// call new method added in 2.12
285-
return _config.getTypeFactory().resolveMemberType(jdkType, _type.getBindings());
286-
}
287-
288273
@Override
289274
public AnnotatedConstructor findDefaultConstructor() {
290275
return _classInfo.getDefaultConstructor();
@@ -521,21 +506,6 @@ public List<BeanPropertyDefinition> findBackReferences()
521506
return result;
522507
}
523508

524-
@Deprecated // since 2.9
525-
@Override
526-
public Map<String,AnnotatedMember> findBackReferenceProperties()
527-
{
528-
List<BeanPropertyDefinition> props = findBackReferences();
529-
if (props == null) {
530-
return null;
531-
}
532-
Map<String,AnnotatedMember> result = new HashMap<>();
533-
for (BeanPropertyDefinition prop : props) {
534-
result.put(prop.getName(), prop.getMutator());
535-
}
536-
return result;
537-
}
538-
539509
/*
540510
/**********************************************************
541511
/* Introspection for deserialization, factories
@@ -589,45 +559,6 @@ public List<AnnotatedAndMetadata<AnnotatedMethod, JsonCreator.Mode>> getFactoryM
589559
return result;
590560
}
591561

592-
@Override
593-
@Deprecated // since 2.13
594-
public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
595-
{
596-
for (AnnotatedConstructor ac : _classInfo.getConstructors()) {
597-
// This list is already filtered to only include accessible
598-
if (ac.getParameterCount() == 1) {
599-
Class<?> actArg = ac.getRawParameterType(0);
600-
for (Class<?> expArg : argTypes) {
601-
if (expArg == actArg) {
602-
return ac.getAnnotated();
603-
}
604-
}
605-
}
606-
}
607-
return null;
608-
}
609-
610-
@Override
611-
@Deprecated // since 2.13
612-
public Method findFactoryMethod(Class<?>... expArgTypes)
613-
{
614-
// So, of all single-arg static methods:
615-
for (AnnotatedMethod am : _classInfo.getFactoryMethods()) {
616-
// 24-Oct-2016, tatu: Better ensure it only takes 1 arg, no matter what
617-
if (isFactoryMethod(am) && am.getParameterCount() == 1) {
618-
// And must take one of expected arg types (or supertype)
619-
Class<?> actualArgType = am.getRawParameterType(0);
620-
for (Class<?> expArgType : expArgTypes) {
621-
// And one that matches what we would pass in
622-
if (actualArgType.isAssignableFrom(expArgType)) {
623-
return am.getAnnotated();
624-
}
625-
}
626-
}
627-
}
628-
return null;
629-
}
630-
631562
protected boolean isFactoryMethod(AnnotatedMethod am)
632563
{
633564
// First: return type must be compatible with the introspected class

0 commit comments

Comments
 (0)