下面列出了com.fasterxml.jackson.databind.introspect.Annotated#hasAnnotation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("unchecked")
@Override
public Object findSerializer(Annotated am) {
if (am.hasAnnotation(ManyToOne.class)) {
return new ManyToOneSerializer((Class<AbstractEntity>) am.getRawType());
} else {
return super.findDeserializer(am);
}
}
@Override
public Object findDeserializer(Annotated am) {
if (am.hasAnnotation(ManyToOne.class)) {
return new ManyToOneDeserializer(am.getRawType());
} else {
return super.findDeserializer(am);
}
}
private boolean isId(Annotated annotated) {
return annotated.hasAnnotation(Id.class)
|| annotated.hasAnnotation(javax.persistence.Id.class)
|| annotated.hasAnnotation(Identifier.class)
|| annotated.getName().equals("id");
}
private PropertyName getMappedName(Annotated annotated) {
if (annotated.hasAnnotation(Table.class)) {
Table table = annotated.getAnnotation(Table.class);
return new PropertyName(table.name());
} if (annotated.hasAnnotation(View.class)) {
View view = annotated.getAnnotation(View.class);
return new PropertyName(view.name());
} else if (annotated.hasAnnotation(Column.class)) {
Column column = annotated.getAnnotation(Column.class);
return new PropertyName(column.name());
} else {
return null;
}
}
@Override
public Object findSerializer(Annotated am) {
if (am.hasAnnotation(Obfuscate.class)) {
return OBFUSCATE_SERIALIZER;
} else {
return null;
}
}
@Override
public boolean hasCreatorAnnotation(Annotated a) {
return a.hasAnnotation(RosettaCreator.class);
}