com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(472)

本文整理了Java中com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType()方法的一些代码示例,展示了AnnotatedMember.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotatedMember.getType()方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.introspect.AnnotatedMember
类名称:AnnotatedMember
方法名:getType

AnnotatedMember.getType介绍

[英]Accessor for TypeResolutionContext that is used for resolving full generic type of this member.
[中]用于解析此成员的完整泛型类型的TypeResolutionContext的访问器。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * @param ser Explicit serializer to use, if caller knows it (which
 *    occurs if and only if the "value method" was annotated with
 *    {@link com.fasterxml.jackson.databind.annotation.JsonSerialize#using}), otherwise
 *    null
 *    
 * @since 2.8 Earlier method took "raw" Method, but that does not work with access
 *    to information we need
 */
@SuppressWarnings("unchecked")
public JsonValueSerializer(AnnotatedMember accessor, JsonSerializer<?> ser)
{
  super(accessor.getType());
  _accessor = accessor;
  _valueSerializer = (JsonSerializer<Object>) ser;
  _property = null;
  _forceTypeInformation = true; // gets reconsidered when we are contextualized
}

代码示例来源:origin: redisson/redisson

@Override
public JavaType getPrimaryType() {
  if (_member == null) {
    return TypeFactory.unknownType();
  }
  return _member.getType();
}

代码示例来源:origin: redisson/redisson

/**
 * Method called locate all members used for value injection (if any),
 * constructor {@link com.fasterxml.jackson.databind.deser.impl.ValueInjector} instances, and add them to builder.
 */
protected void addInjectables(DeserializationContext ctxt,
    BeanDescription beanDesc, BeanDeserializerBuilder builder)
  throws JsonMappingException
{
  Map<Object, AnnotatedMember> raw = beanDesc.findInjectables();
  if (raw != null) {
    for (Map.Entry<Object, AnnotatedMember> entry : raw.entrySet()) {
      AnnotatedMember m = entry.getValue();
      builder.addInjectable(PropertyName.construct(m.getName()),
          m.getType(),
          beanDesc.getClassAnnotations(), m, entry.getKey());
    }
  }
}

代码示例来源:origin: redisson/redisson

return m.getType();
  return m.getType();
return m.getType();

代码示例来源:origin: redisson/redisson

@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
  throws JsonMappingException
{
  /* 27-Apr-2015, tatu: First things first; for JSON Schema introspection,
   *    Enum types that use `@JsonValue` are special (but NOT necessarily
   *    anything else that RETURNS an enum!)
   *    So we will need to add special
   *    handling here (see https://github.com/FasterXML/jackson-module-jsonSchema/issues/57
   *    for details).
   *    
   *    Note that meaning of JsonValue, then, is very different for Enums. Sigh.
   */
  final JavaType type = _accessor.getType();
  Class<?> declaring = _accessor.getDeclaringClass();
  if ((declaring != null) && declaring.isEnum()) {
    if (_acceptJsonFormatVisitorForEnum(visitor, typeHint, declaring)) {
      return;
    }
  }
  JsonSerializer<Object> ser = _valueSerializer;
  if (ser == null) {
    ser = visitor.getProvider().findTypedValueSerializer(type, false, _property);
    if (ser == null) { // can this ever occur?
      visitor.expectAnyFormat(typeHint);
      return;
    }
  }
  ser.acceptJsonFormatVisitor(visitor, type);
}

代码示例来源:origin: swagger-api/swagger-core

if (name != null && name.equals(propertyName)) {
  final AnnotatedMember propMember = def.getPrimaryMember();
  final JavaType propType = propMember.getType();
  if (PrimitiveType.fromType(propType) != null) {
    return PrimitiveType.createProperty(propType);

代码示例来源:origin: redisson/redisson

JavaType t = _accessor.getType();
if (provider.isEnabled(MapperFeature.USE_STATIC_TYPING) || t.isFinal()) {

代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jaxb-annotations

protected JavaType _fullSerializationType(AnnotatedMember am) {
  return am.getType();
}

代码示例来源:origin: redisson/redisson

JavaType type = accessor.getType();
BeanProperty.Std property = new BeanProperty.Std(name, type, propDef.getWrapperName(),
    accessor, propDef.getMetadata());

代码示例来源:origin: redisson/redisson

JavaType type = anyGetter.getType();

代码示例来源:origin: swagger-api/swagger-core

JavaType propType = member.getType();
if(propType != null && "void".equals(propType.getRawClass().getName())) {
  if (member instanceof AnnotatedMethod) {

代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jaxb-annotations

protected JavaType _fullDeserializationType(AnnotatedMember am)
{
  if (am instanceof AnnotatedMethod) {
    AnnotatedMethod method = (AnnotatedMethod) am;
    // 27-Nov-2012, tatu: Bit nasty, as we are assuming
    //    things about method signatures here... but has to do
    if (method.getParameterCount() == 1) {
      return ((AnnotatedMethod) am).getParameterType(0);
    }
  }
  return am.getType();
}

代码示例来源:origin: codeabovelab/haven-platform

public CustomGetterBeanProperty(BeanPropertyDefinition propDef, AnnotatedMember getter) {
  super(propDef, getter.getType(), null, null);
  this.getter = getter;
}

代码示例来源:origin: Nextdoor/bender

protected JavaType _fullSerializationType(AnnotatedMember am) {
  return am.getType();
}

代码示例来源:origin: FasterXML/jackson-module-jaxb-annotations

protected JavaType _fullSerializationType(AnnotatedMember am) {
  return am.getType();
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

/**
 * @param ser Explicit serializer to use, if caller knows it (which
 *    occurs if and only if the "value method" was annotated with
 *    {@link com.fasterxml.jackson.databind.annotation.JsonSerialize#using}), otherwise
 *    null
 *    
 * @since 2.8 Earlier method took "raw" Method, but that does not work with access
 *    to information we need
 */
@SuppressWarnings("unchecked")
public JsonValueSerializer(AnnotatedMember accessor, JsonSerializer<?> ser)
{
  super(accessor.getType());
  _accessor = accessor;
  _valueSerializer = (JsonSerializer<Object>) ser;
  _property = null;
  _forceTypeInformation = true; // gets reconsidered when we are contextualized
}

代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind

@Override
public JavaType getPrimaryType() {
  if (_member == null) {
    return TypeFactory.unknownType();
  }
  return _member.getType();
}

代码示例来源:origin: Nextdoor/bender

protected JavaType _fullDeserializationType(AnnotatedMember am)
{
  if (am instanceof AnnotatedMethod) {
    AnnotatedMethod method = (AnnotatedMethod) am;
    // 27-Nov-2012, tatu: Bit nasty, as we are assuming
    //    things about method signatures here... but has to do
    if (method.getParameterCount() == 1) {
      return ((AnnotatedMethod) am).getParameterType(0);
    }
  }
  return am.getType();
}

代码示例来源:origin: FasterXML/jackson-module-jaxb-annotations

protected JavaType _fullDeserializationType(AnnotatedMember am)
{
  if (am instanceof AnnotatedMethod) {
    AnnotatedMethod method = (AnnotatedMethod) am;
    // 27-Nov-2012, tatu: Bit nasty, as we are assuming
    //    things about method signatures here... but has to do
    if (method.getParameterCount() == 1) {
      return ((AnnotatedMethod) am).getParameterType(0);
    }
  }
  return am.getType();
}

代码示例来源:origin: raphaeljolivet/java2typescript

private AbstractType getTSTypeForClass(AnnotatedMember member) {
  TypeBindings bindings = new TypeBindings(TypeFactory.defaultInstance(), member.getDeclaringClass());
  BeanProperty prop = new BeanProperty.Std(member.getName(), member.getType(bindings), NO_NAME,
      new AnnotationMap(), member, false);
  try {
    return getTSTypeForProperty(prop);
  } catch (JsonMappingException e) {
    throw new RuntimeException(e);
  }
}

相关文章