當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。