Skip to content

Commit 4a40123

Browse files
committed
Add TypeFactory.createDefaultInstance()
1 parent 1643c1e commit 4a40123

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package com.fasterxml.jackson.databind.type;
22

3-
import java.lang.reflect.Array;
4-
import java.lang.reflect.GenericArrayType;
5-
import java.lang.reflect.ParameterizedType;
6-
import java.lang.reflect.Type;
7-
import java.lang.reflect.TypeVariable;
8-
import java.lang.reflect.WildcardType;
3+
import java.lang.reflect.*;
94
import java.util.*;
105
import java.util.concurrent.atomic.AtomicReference;
116
import java.util.stream.BaseStream;
@@ -18,10 +13,7 @@
1813

1914
import com.fasterxml.jackson.databind.JavaType;
2015
import com.fasterxml.jackson.databind.JsonNode;
21-
import com.fasterxml.jackson.databind.util.ArrayBuilders;
22-
import com.fasterxml.jackson.databind.util.ClassUtil;
23-
import com.fasterxml.jackson.databind.util.LRUMap;
24-
import com.fasterxml.jackson.databind.util.LookupCache;
16+
import com.fasterxml.jackson.databind.util.*;
2517

2618
/**
2719
* Class used for creating concrete {@link JavaType} instances,
@@ -70,7 +62,6 @@
7062
* </li>
7163
*</ul>
7264
*/
73-
@SuppressWarnings({"rawtypes" })
7465
public class TypeFactory // note: was final in 2.9, removed from 2.10
7566
implements java.io.Serializable
7667
{
@@ -79,8 +70,6 @@ public class TypeFactory // note: was final in 2.9, removed from 2.10
7970
/**
8071
* Default size used to construct {@link #_typeCache}.
8172
*
82-
* Used to be passed inline.
83-
*
8473
* @since 2.16
8574
*/
8675
public static final int DEFAULT_MAX_CACHE_SIZE = 200;
@@ -222,6 +211,14 @@ protected TypeFactory(LookupCache<Object,JavaType> typeCache, TypeParser p,
222211
_classLoader = classLoader;
223212
}
224213

214+
/**
215+
* Method used to construct a new default/standard {@code TypeFactory}
216+
* instance; an instance which has no custom configuration.
217+
*
218+
* @since 2.19
219+
*/
220+
public static TypeFactory createDefaultInstance() { return new TypeFactory(); }
221+
225222
/**
226223
* "Mutant factory" method which will construct a new instance with specified
227224
* {@link TypeModifier} added as the first modifier to call (in case there
@@ -923,6 +920,7 @@ public ArrayType constructArrayType(JavaType elementType) {
923920
* NOTE: type modifiers are NOT called on Collection type itself; but are called
924921
* for contained types.
925922
*/
923+
@SuppressWarnings({"rawtypes" })
926924
public CollectionType constructCollectionType(Class<? extends Collection> collectionClass,
927925
Class<?> elementClass) {
928926
return constructCollectionType(collectionClass,
@@ -935,6 +933,7 @@ public CollectionType constructCollectionType(Class<? extends Collection> collec
935933
* NOTE: type modifiers are NOT called on Collection type itself; but are called
936934
* for contained types.
937935
*/
936+
@SuppressWarnings({"rawtypes" })
938937
public CollectionType constructCollectionType(Class<? extends Collection> collectionClass,
939938
JavaType elementType)
940939
{
@@ -986,6 +985,7 @@ public CollectionLikeType constructCollectionLikeType(Class<?> collectionClass,
986985
* NOTE: type modifiers are NOT called on constructed type itself; but are called
987986
* for contained types.
988987
*/
988+
@SuppressWarnings({"rawtypes" })
989989
public MapType constructMapType(Class<? extends Map> mapClass,
990990
Class<?> keyClass, Class<?> valueClass) {
991991
JavaType kt, vt;
@@ -1003,6 +1003,7 @@ public MapType constructMapType(Class<? extends Map> mapClass,
10031003
*<p>
10041004
* NOTE: type modifiers are NOT called on constructed type itself.
10051005
*/
1006+
@SuppressWarnings({"rawtypes" })
10061007
public MapType constructMapType(Class<? extends Map> mapClass, JavaType keyType, JavaType valueType) {
10071008
TypeBindings bindings = TypeBindings.createIfNeeded(mapClass, new JavaType[] { keyType, valueType });
10081009
MapType result = (MapType) _fromClass(null, mapClass, bindings);
@@ -1232,6 +1233,7 @@ public JavaType constructParametrizedType(Class<?> parametrized, Class<?> parame
12321233
*<p>
12331234
* This method should only be used if parameterization is completely unavailable.
12341235
*/
1236+
@SuppressWarnings({"rawtypes" })
12351237
public CollectionType constructRawCollectionType(Class<? extends Collection> collectionClass) {
12361238
return constructCollectionType(collectionClass, unknownType());
12371239
}
@@ -1262,6 +1264,7 @@ public CollectionLikeType constructRawCollectionLikeType(Class<?> collectionClas
12621264
*<p>
12631265
* This method should only be used if parameterization is completely unavailable.
12641266
*/
1267+
@SuppressWarnings({"rawtypes" })
12651268
public MapType constructRawMapType(Class<? extends Map> mapClass) {
12661269
return constructMapType(mapClass, unknownType(), unknownType());
12671270
}

0 commit comments

Comments
 (0)