当前位置: 首页>>代码示例>>Java>>正文


Java Annotated.getAnnotation方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:Devskiller,项目名称:friendly-id,代码行数:18,代码来源:FriendlyIdAnnotationIntrospector.java

示例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;
	}
}
 
开发者ID:Devskiller,项目名称:friendly-id,代码行数:18,代码来源:FriendlyIdAnnotationIntrospector.java

示例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));
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:18,代码来源:JtModule.java

示例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;
}
 
开发者ID:aureliano,项目名称:evt-bridge,代码行数:24,代码来源:ElasticSearchAnnotationIntrospector.java

示例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;
}
 
开发者ID:aureliano,项目名称:evt-bridge,代码行数:19,代码来源:ElasticSearchAnnotationIntrospector.java

示例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;
}
 
开发者ID:aureliano,项目名称:evt-bridge,代码行数:24,代码来源:ElasticSearchAnnotationIntrospector.java

示例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;

    }
 
开发者ID:NyBatis,项目名称:NyBatisCore,代码行数:23,代码来源:ColumnAnnotationInspector.java

示例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;
}
 
开发者ID:buremba,项目名称:netty-rest,代码行数:19,代码来源:SwaggerJacksonAnnotationIntrospector.java

示例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();
}
 
开发者ID:buremba,项目名称:netty-rest,代码行数:18,代码来源:SwaggerJacksonAnnotationIntrospector.java

示例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);
    }
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:18,代码来源:JsonIdAnnotationIntrospector.java

示例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;
}
 
开发者ID:addthis,项目名称:codec,代码行数:19,代码来源:CodecIntrospector.java

示例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;
}
 
开发者ID:visionarts,项目名称:power-jambda,代码行数:9,代码来源:MaskableSensitiveDataAnnotationIntrospector.java

示例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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:9,代码来源:ApiAnnotationIntrospector.java

示例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;
}
 
开发者ID:cloudendpoints,项目名称:endpoints-java,代码行数:9,代码来源:ApiAnnotationIntrospector.java

示例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()));
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:9,代码来源:JtModule.java


注:本文中的com.fasterxml.jackson.databind.introspect.Annotated.getAnnotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。