Skip to content

Commit 475ebbf

Browse files
committed
Minor annotation introspector refactoring
1 parent 000f489 commit 475ebbf

File tree

2 files changed

+103
-94
lines changed

2 files changed

+103
-94
lines changed

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

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ public JavaType refineDeserializationType(final MapperConfig<?> config,
13141314

13151315
/*
13161316
/**********************************************************
1317-
/* Deserialization: class annotations
1317+
/* Deserialization: value instantiation, Creators
13181318
/**********************************************************
13191319
*/
13201320

@@ -1365,76 +1365,6 @@ public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) {
13651365
return null;
13661366
}
13671367

1368-
/*
1369-
/**********************************************************
1370-
/* Deserialization: property annotations
1371-
/**********************************************************
1372-
*/
1373-
1374-
/**
1375-
* Method for checking whether given property accessors (method,
1376-
* field) has an annotation that suggests property name to use
1377-
* for deserialization (reading JSON into POJOs).
1378-
* Should return null if no annotation
1379-
* is found; otherwise a non-null name (possibly
1380-
* {@link PropertyName#USE_DEFAULT}, which means "use default heuristics").
1381-
*
1382-
* @param ann Annotated entity to check
1383-
*
1384-
* @return Name to use if found; {@code null} if not.
1385-
*
1386-
* @since 2.1
1387-
*/
1388-
public PropertyName findNameForDeserialization(Annotated ann) {
1389-
return null;
1390-
}
1391-
1392-
/**
1393-
* Method for checking whether given method has an annotation
1394-
* that suggests that the method is to serve as "any setter";
1395-
* method to be used for setting values of any properties for
1396-
* which no dedicated setter method is found.
1397-
*
1398-
* @param ann Annotated entity to check
1399-
*
1400-
* @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit
1401-
* "any setter" marker found; {@code null} otherwise.
1402-
*
1403-
* @since 2.9
1404-
*/
1405-
public Boolean hasAnySetter(Annotated ann) {
1406-
return null;
1407-
}
1408-
1409-
/**
1410-
* Method for finding possible settings for property, given annotations
1411-
* on an accessor.
1412-
*
1413-
* @param ann Annotated entity to check
1414-
*
1415-
* @return Setter info value found, if any;
1416-
* {@code JsonSetter.Value.empty()} if none (should not return {@code null})
1417-
*
1418-
* @since 2.9
1419-
*/
1420-
public JsonSetter.Value findSetterInfo(Annotated ann) {
1421-
return JsonSetter.Value.empty();
1422-
}
1423-
1424-
/**
1425-
* Method for finding merge settings for property, if any.
1426-
*
1427-
* @param ann Annotated entity to check
1428-
*
1429-
* @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit
1430-
* merge enable/disable found; {@code null} otherwise.
1431-
*
1432-
* @since 2.9
1433-
*/
1434-
public Boolean findMergeInfo(Annotated ann) {
1435-
return null;
1436-
}
1437-
14381368
/**
14391369
* Method called to check whether potential Creator (constructor or static factory
14401370
* method) has explicit annotation to indicate it as actual Creator; and if so,
@@ -1504,6 +1434,76 @@ public JsonCreator.Mode findCreatorBinding(Annotated ann) {
15041434
return null;
15051435
}
15061436

1437+
/*
1438+
/**********************************************************
1439+
/* Deserialization: other property annotations
1440+
/**********************************************************
1441+
*/
1442+
1443+
/**
1444+
* Method for checking whether given property accessors (method,
1445+
* field) has an annotation that suggests property name to use
1446+
* for deserialization (reading JSON into POJOs).
1447+
* Should return null if no annotation
1448+
* is found; otherwise a non-null name (possibly
1449+
* {@link PropertyName#USE_DEFAULT}, which means "use default heuristics").
1450+
*
1451+
* @param ann Annotated entity to check
1452+
*
1453+
* @return Name to use if found; {@code null} if not.
1454+
*
1455+
* @since 2.1
1456+
*/
1457+
public PropertyName findNameForDeserialization(Annotated ann) {
1458+
return null;
1459+
}
1460+
1461+
/**
1462+
* Method for checking whether given method has an annotation
1463+
* that suggests that the method is to serve as "any setter";
1464+
* method to be used for setting values of any properties for
1465+
* which no dedicated setter method is found.
1466+
*
1467+
* @param ann Annotated entity to check
1468+
*
1469+
* @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit
1470+
* "any setter" marker found; {@code null} otherwise.
1471+
*
1472+
* @since 2.9
1473+
*/
1474+
public Boolean hasAnySetter(Annotated ann) {
1475+
return null;
1476+
}
1477+
1478+
/**
1479+
* Method for finding possible settings for property, given annotations
1480+
* on an accessor.
1481+
*
1482+
* @param ann Annotated entity to check
1483+
*
1484+
* @return Setter info value found, if any;
1485+
* {@code JsonSetter.Value.empty()} if none (should not return {@code null})
1486+
*
1487+
* @since 2.9
1488+
*/
1489+
public JsonSetter.Value findSetterInfo(Annotated ann) {
1490+
return JsonSetter.Value.empty();
1491+
}
1492+
1493+
/**
1494+
* Method for finding merge settings for property, if any.
1495+
*
1496+
* @param ann Annotated entity to check
1497+
*
1498+
* @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit
1499+
* merge enable/disable found; {@code null} otherwise.
1500+
*
1501+
* @since 2.9
1502+
*/
1503+
public Boolean findMergeInfo(Annotated ann) {
1504+
return null;
1505+
}
1506+
15071507
/**
15081508
* @param am Annotated method to check
15091509
*

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

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,11 @@ public JavaType refineDeserializationType(MapperConfig<?> config,
689689
return _primary.refineDeserializationType(config, a, t);
690690
}
691691

692-
// // // Deserialization: class annotations
692+
/*
693+
/**********************************************************************
694+
/* Deserialization: value instantiation, Creators
695+
/**********************************************************************
696+
*/
693697

694698
@Override
695699
public Object findValueInstantiator(AnnotatedClass ac) {
@@ -709,7 +713,33 @@ public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) {
709713
return (result == null) ? _secondary.findPOJOBuilderConfig(ac) : result;
710714
}
711715

712-
// // // Deserialization: method annotations
716+
@Override
717+
@Deprecated // since 2.9
718+
public boolean hasCreatorAnnotation(Annotated a) {
719+
return _primary.hasCreatorAnnotation(a) || _secondary.hasCreatorAnnotation(a);
720+
}
721+
722+
@Override
723+
@Deprecated // since 2.9
724+
public JsonCreator.Mode findCreatorBinding(Annotated a) {
725+
JsonCreator.Mode mode = _primary.findCreatorBinding(a);
726+
if (mode != null) {
727+
return mode;
728+
}
729+
return _secondary.findCreatorBinding(a);
730+
}
731+
732+
@Override
733+
public JsonCreator.Mode findCreatorAnnotation(MapperConfig<?> config, Annotated a) {
734+
JsonCreator.Mode mode = _primary.findCreatorAnnotation(config, a);
735+
return (mode == null) ? _secondary.findCreatorAnnotation(config, a) : mode;
736+
}
737+
738+
/*
739+
/**********************************************************************
740+
/* Deserialization: other method annotations
741+
/**********************************************************************
742+
*/
713743

714744
@Override
715745
public PropertyName findNameForDeserialization(Annotated a)
@@ -745,27 +775,6 @@ public Boolean findMergeInfo(Annotated a) {
745775
return b;
746776
}
747777

748-
@Override
749-
@Deprecated // since 2.9
750-
public boolean hasCreatorAnnotation(Annotated a) {
751-
return _primary.hasCreatorAnnotation(a) || _secondary.hasCreatorAnnotation(a);
752-
}
753-
754-
@Override
755-
@Deprecated // since 2.9
756-
public JsonCreator.Mode findCreatorBinding(Annotated a) {
757-
JsonCreator.Mode mode = _primary.findCreatorBinding(a);
758-
if (mode != null) {
759-
return mode;
760-
}
761-
return _secondary.findCreatorBinding(a);
762-
}
763-
764-
@Override
765-
public JsonCreator.Mode findCreatorAnnotation(MapperConfig<?> config, Annotated a) {
766-
JsonCreator.Mode mode = _primary.findCreatorAnnotation(config, a);
767-
return (mode == null) ? _secondary.findCreatorAnnotation(config, a) : mode;
768-
}
769778

770779
@Override
771780
@Deprecated // since 2.9

0 commit comments

Comments
 (0)