本文整理汇总了Java中com.fasterxml.jackson.databind.introspect.Annotated.getAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java Annotated.getAnnotation方法的具体用法?Java Annotated.getAnnotation怎么用?Java Annotated.getAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.introspect.Annotated
的用法示例。
在下文中一共展示了Annotated.getAnnotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSerializer
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findSerializer(Annotated annotatedMethod) {
IdFormat annotation = annotatedMethod.getAnnotation(IdFormat.class);
if (annotatedMethod.getRawType() == UUID.class) {
if (annotation != null) {
switch (annotation.value()) {
case RAW:
return UUIDSerializer.class;
case URL62:
return FriendlyIdSerializer.class;
}
}
return FriendlyIdSerializer.class;
} else {
return null;
}
}
示例2: findDeserializer
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findDeserializer(Annotated annotatedMethod) {
IdFormat annotation = annotatedMethod.getAnnotation(IdFormat.class);
if (rawDeserializationType(annotatedMethod) == UUID.class) {
if (annotation != null) {
switch (annotation.value()) {
case RAW:
return UUIDDeserializer.class;
case URL62:
return FriendlyIdDeserializer.class;
}
}
return FriendlyIdDeserializer.class;
} else {
return null;
}
}
示例3: findDeserializationConverter
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findDeserializationConverter(Annotated a) {
JtToMap ann = a.getAnnotation(JtToMap.class);
if (ann == null) {
return null;
}
JavaType javaType = a.getType();
if(a instanceof AnnotatedMethod) {
AnnotatedMethod am = (AnnotatedMethod) a;
if(am.getParameterCount() == 1) {
javaType = am.getParameterType(0);
} else {
throw new RuntimeException("Invalid property setter: " + am.getAnnotated());
}
}
return new DeserializationConverterImpl(ann, new Ctx(a, javaType));
}
示例4: findNameForSerialization
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public PropertyName findNameForSerialization(Annotated a) {
if (!(a instanceof AnnotatedField) && !(a instanceof AnnotatedMethod)) {
return super.findNameForSerialization(a);
}
IndexableProperty property = a.getAnnotation(IndexableProperty.class);
if (property != null && !property.name().isEmpty()) {
return new PropertyName(property.name());
}
IndexableComponent component = a.getAnnotation(IndexableComponent.class);
if (component != null && !component.name().isEmpty()) {
return new PropertyName(component.name());
}
IndexableProperties properties = a.getAnnotation(IndexableProperties.class);
if (properties != null && !properties.name().isEmpty()) {
return new PropertyName(properties.name());
}
return PropertyName.USE_DEFAULT;
}
示例5: findSerializationInclusion
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public JsonInclude.Include findSerializationInclusion(Annotated a, JsonInclude.Include defValue) {
IndexableProperty property = a.getAnnotation(IndexableProperty.class);
if (property != null && property.jsonInclude() != com.github.aureliano.evtbridge.output.elasticsearch.enumeration.JsonInclude.DEFAULT) {
return JsonInclude.Include.valueOf(property.jsonInclude().toString());
}
IndexableComponent component = a.getAnnotation(IndexableComponent.class);
if (component != null && component.jsonInclude() != com.github.aureliano.evtbridge.output.elasticsearch.enumeration.JsonInclude.DEFAULT) {
return JsonInclude.Include.valueOf(component.jsonInclude().toString());
}
IndexableProperties properties = a.getAnnotation(IndexableProperties.class);
if (properties != null && properties.jsonInclude() != com.github.aureliano.evtbridge.output.elasticsearch.enumeration.JsonInclude.DEFAULT) {
return JsonInclude.Include.valueOf(properties.jsonInclude().toString());
}
return defValue;
}
示例6: findNameForDeserialization
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public PropertyName findNameForDeserialization(Annotated a) {
if (!(a instanceof AnnotatedField) && !(a instanceof AnnotatedMethod)) {
return super.findNameForDeserialization(a);
}
IndexableProperty property = a.getAnnotation(IndexableProperty.class);
if (property != null && !property.name().isEmpty()) {
return new PropertyName(property.name());
}
IndexableComponent component = a.getAnnotation(IndexableComponent.class);
if (component != null && !component.name().isEmpty()) {
return new PropertyName(component.name());
}
IndexableProperties properties = a.getAnnotation(IndexableProperties.class);
if (properties != null && !properties.name().isEmpty()) {
return new PropertyName(properties.name());
}
return PropertyName.USE_DEFAULT;
}
示例7: getPropertyName
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
private PropertyName getPropertyName( Annotated annotated ) {
Column column = annotated.getAnnotation( Column.class );
if ( column != null && StringUtil.isNotEmpty(annotated.getName()) ) {
String name = column.name();
name = StringUtil.toUncamel( name );
name = StringUtil.toCamel( name );
return new PropertyName( name );
}
JsonProperty jsonProperty = annotated.getAnnotation( JsonProperty.class );
if( jsonProperty != null ) {
if( StringUtil.isNotEmpty(jsonProperty.value()) ) {
return new PropertyName( jsonProperty.value() );
} else {
return PropertyName.USE_DEFAULT;
}
}
return null;
}
示例8: findPropertyDescription
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public String findPropertyDescription(Annotated a)
{
ApiParam apiParam = a.getAnnotation(ApiParam.class);
if (apiParam != null) {
return apiParam.description();
}
ApiModel model = a.getAnnotation(ApiModel.class);
if (model != null && !"".equals(model.description())) {
return model.description();
}
ApiModelProperty prop = a.getAnnotation(ApiModelProperty.class);
if (prop != null) {
return prop.value();
}
return null;
}
示例9: findSubtypes
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public List<NamedType> findSubtypes(Annotated a)
{
final ApiModel api = a.getAnnotation(ApiModel.class);
if (api != null) {
final Class<?>[] classes = api.subTypes();
final List<NamedType> names = new ArrayList<>(classes.length);
for (Class<?> subType : classes) {
names.add(new NamedType(subType));
}
if (!names.isEmpty()) {
return names;
}
}
return Collections.emptyList();
}
示例10: findSerializer
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findSerializer(Annotated a) {
final JsonId ann = a.getAnnotation(JsonId.class);
if (ann != null) {
return new JsonSerializer<Long>() {
@Override
public void serialize(Long value, JsonGenerator jgen,
SerializerProvider provider) throws IOException,
JsonProcessingException {
jgen.writeString(baseUrl + ann.path().replace("{id}", value.toString()));
}
};
} else {
return super.findSerializer(a);
}
}
示例11: findSubtypes
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
/** report all non-alias plugin types */
@Override
public List<NamedType> findSubtypes(Annotated a) {
Pluggable pluggable = a.getAnnotation(Pluggable.class);
PluginMap pluginMap;
if (pluggable != null) {
pluginMap = pluginRegistry.byCategory().get(pluggable.value());
} else if (pluginRegistry.byClass().containsKey(a.getRawType())) {
pluginMap = pluginRegistry.byClass().get(a.getRawType());
} else {
return null;
}
List<NamedType> result = new ArrayList<>(pluginMap.asBiMap().size());
for (Map.Entry<String, Class<?>> type : pluginMap.asBiMap().entrySet()) {
result.add(new NamedType(type.getValue(), type.getKey()));
}
return result;
}
示例12: findSerializer
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findSerializer(Annotated am) {
MaskableSensitiveData annotation = am.getAnnotation(MaskableSensitiveData.class);
if (annotation != null) {
return MaskableSerializerFactory.createSerializer(am.getType(), annotation);
}
return null;
}
示例13: findNameForSerialization
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public PropertyName findNameForSerialization(Annotated a) {
ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class);
if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) {
return PropertyName.construct(apiName.name());
}
return null;
}
示例14: findNameForDeserialization
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public PropertyName findNameForDeserialization(Annotated a) {
ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class);
if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) {
return PropertyName.construct(apiName.name());
}
return null;
}
示例15: findSerializationConverter
import com.fasterxml.jackson.databind.introspect.Annotated; //导入方法依赖的package包/类
@Override
public Object findSerializationConverter(Annotated a) {
JtToMap ann = a.getAnnotation(JtToMap.class);
if (ann == null) {
return null;
}
return new SerializationConverterImpl(ann, new Ctx(a, a.getType()));
}