in jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java [812:849]
private void initAnnotationInspectors() throws Exception {
for (Entry<String, String> entry : annotationInspectors.entrySet()) {
String key = entry.getKey();
String avClass = entry.getValue();
if (key.equals("primary") && !StringUtils.isEmpty(avClass)) {
try {
primary = (AnnotationIntrospector) Class.forName(avClass).getConstructor().newInstance();
} catch (Exception e) {
throw new InstantiationException("JsonMapperService: Error instantiating " + avClass + " for " + key);
}
} else if (key.equals("secondary") && avClass != null) {
try {
secondary = (AnnotationIntrospector) Class.forName(avClass).getConstructor().newInstance();
} catch (Exception e) {
throw new InstantiationException("JsonMapperService: Error instantiating " + avClass + " for " + key);
}
}
}
if (primary == null) {
primary = new JacksonAnnotationIntrospector(); // support default
getLogger().info("using default introspector:" + primary.getClass().getName());
mapper.setAnnotationIntrospector(primary);
} else if (primary != null && secondary != null) {
AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
mapper.setAnnotationIntrospector(pair);
} else {
mapper.setAnnotationIntrospector(primary);
}
if (primary instanceof LogEnabled) {
((LogEnabled) primary).enableLogging(getLogger().getChildLogger(primary.getClass().getSimpleName()));
getLogger().info("setting primary introspector logger: " + primary.getClass().getSimpleName());
}
if (secondary instanceof LogEnabled) {
((LogEnabled) secondary).enableLogging(getLogger().getChildLogger(secondary.getClass().getSimpleName()));
getLogger().info("setting secondary introspector logger: " + secondary.getClass().getSimpleName());
}
}