private void removeSuperSubTypes(List<NamedType> resultTypes, Class<?> superClass) { JavaType superType = _mapper.constructType(superClass); BeanDescription superBean = _mapper.getSerializationConfig().introspect(superType); final List<NamedType> superTypes = _intr.findSubtypes(superBean.getClassInfo()); if (superTypes != null) { resultTypes.removeAll(superTypes); } }
beanDesc = config.introspect(keyType); AnnotatedMember am = beanDesc.findJsonValueAccessor(); if (am != null) {
.introspect(mapper.constructType(clazz)) .findProperties(); for (BeanPropertyDefinition beanDef : beanDefs) {
final JavaType type = mapper.getTypeFactory().constructType(clazz); final BeanDescription introspection = mapper.getSerializationConfig() .introspect(type);
if (BeanParam.class.isAssignableFrom(annotation.getClass())) { final BeanDescription beanDesc = mapper.getSerializationConfig().introspect(constructType(type)); final List<BeanPropertyDefinition> properties = beanDesc.findProperties();
/** * Mostly for kotlin null safe operator and immutable properties. * * @param type Target type. * @param model Model. * @return Input model. */ private Model doModel(Type type, Model model) { Map<String, Property> properties = model.getProperties(); if (properties != null) { BeanDescription desc = Json.mapper().getSerializationConfig() .introspect(Json.mapper().constructType(type)); for (BeanPropertyDefinition beanProperty : desc.findProperties()) { Property property = properties.get(beanProperty.getName()); if (property != null) { property.setRequired(beanProperty.isRequired()); } } } return model; }
javaType = mapper.constructType(type.getType()); final BeanDescription beanDesc = mapper.getSerializationConfig().introspect(javaType); for (BeanPropertyDefinition def : beanDesc.findProperties()) { final String name = def.getName();
BeanDescription beanDesc = config.introspect(origType); JsonSerializer<?> ser = findSerializerFromAnnotation(prov, beanDesc.getClassInfo()); if (ser != null) { staticTyping = true; if (!type.hasRawClass(origType.getRawClass())) { beanDesc = config.introspect(type); beanDesc = config.introspect(delegateType);
protected void resolveSchemaMembers(Schema schema, AnnotatedType annotatedType) { final JavaType type; if (annotatedType.getType() instanceof JavaType) { type = (JavaType) annotatedType.getType(); } else { type = _mapper.constructType(annotatedType.getType()); } final Annotation resolvedSchemaOrArrayAnnotation = AnnotationsUtils.mergeSchemaAnnotations(annotatedType.getCtxAnnotations(), type); final io.swagger.v3.oas.annotations.media.Schema schemaAnnotation = resolvedSchemaOrArrayAnnotation == null ? null : resolvedSchemaOrArrayAnnotation instanceof io.swagger.v3.oas.annotations.media.ArraySchema ? ((io.swagger.v3.oas.annotations.media.ArraySchema) resolvedSchemaOrArrayAnnotation).schema() : (io.swagger.v3.oas.annotations.media.Schema) resolvedSchemaOrArrayAnnotation; final BeanDescription beanDesc = _mapper.getSerializationConfig().introspect(type); Annotated a = beanDesc.getClassInfo(); Annotation[] annotations = annotatedType.getCtxAnnotations(); resolveSchemaMembers(schema, a, annotations, schemaAnnotation); }
BeanDescription bd = Json.mapper().getSerializationConfig().introspect(classType);
String pName = null; if (left != null) { BeanDescription valueTypeBeanDesc = _mapper.getSerializationConfig().introspect(left); pName = _typeName(left, valueTypeBeanDesc);
null; final BeanDescription beanDesc = _mapper.getSerializationConfig().introspect(type); String pName = null; if (valueType != null) { BeanDescription valueTypeBeanDesc = _mapper.getSerializationConfig().introspect(valueType); pName = _typeName(valueType, valueTypeBeanDesc); final BeanDescription propBeanDesc = _mapper.getSerializationConfig().introspect(propType); if (property != null && !propType.isContainerType()) { if ("object".equals(property.getType())) {
/** * Creates a new {@link JacksonMetadata} instance for the given {@link ObjectMapper} and type. * * @param mapper must not be {@literal null}. * @param type must not be {@literal null}. */ public JacksonMetadata(ObjectMapper mapper, Class<?> type) { Assert.notNull(mapper, "ObjectMapper must not be null!"); Assert.notNull(type, "Type must not be null!"); this.mapper = mapper; SerializationConfig serializationConfig = mapper.getSerializationConfig(); JavaType javaType = serializationConfig.constructType(type); BeanDescription description = serializationConfig.introspect(javaType); this.definitions = description.findProperties(); this.isValue = description.findJsonValueMethod() != null; DeserializationConfig deserializationConfig = mapper.getDeserializationConfig(); JavaType deserializationType = deserializationConfig.constructType(type); this.deserializationDefinitions = deserializationConfig.introspect(deserializationType).findProperties(); }
public void init(SerializationConfig serializationConfig, JavaType javaType) { this.javaType = javaType; BeanDescription beanDescription = serializationConfig.introspect(javaType); for (BeanPropertyDefinition propertyDefinition : beanDescription.findProperties()) { PropertyDescriptor propertyDescriptor = new PropertyDescriptor(); propertyDescriptor.setName(propertyDefinition.getName()); propertyDescriptor.setJavaType(propertyDefinition.getPrimaryType()); try { propertyDescriptor.setGetter(initGetter(propertyDefinition)); } catch (Throwable e) { LOGGER.error("failed to init getter for field {}:{}", javaType.getRawClass().getName(), propertyDefinition.getName(), e); } try { propertyDescriptor.setSetter(initSetter(propertyDefinition)); } catch (Throwable e) { LOGGER.error("failed to init setter for field {}:{}", javaType.getRawClass().getName(), propertyDefinition.getName(), e); } propertyDescriptors.put(propertyDefinition.getName(), propertyDescriptor); } }
public Operation parseMethod(Method method) { JavaType classType = TypeFactory.defaultInstance().constructType(method.getDeclaringClass()); BeanDescription bd = new ObjectMapper().getSerializationConfig().introspect(classType); return parseMethod(classType.getClass(), method, bd.findMethod(method.getName(), method.getParameterTypes()), Collections.<Parameter> emptyList(), Collections.<ApiResponse> emptyList()); }
public Operation parseMethod(Method method) { JavaType classType = TypeFactory.defaultInstance().constructType(method.getDeclaringClass()); BeanDescription bd = new ObjectMapper().getSerializationConfig().introspect(classType); return parseMethod(classType.getClass(), method, bd.findMethod(method.getName(), method.getParameterTypes()), Collections.<Parameter> emptyList(), Collections.<ApiResponse> emptyList(),Collections.emptyList()); }
public Operation parseMethod(Method method) { JavaType classType = TypeFactory.defaultInstance().constructType(method.getDeclaringClass()); BeanDescription bd = new ObjectMapper().getSerializationConfig().introspect(classType); return parseMethod(classType.getClass(), method, bd.findMethod(method.getName(), method.getParameterTypes()), Collections.<Parameter>emptyList(), Collections.<ApiResponse>emptyList()); }
private BeanDescription beanDescription(ResolvedType type, ModelContext context) { if (context.isReturnType()) { SerializationConfig serializationConfig = objectMapper.getSerializationConfig(); return serializationConfig.introspect(TypeFactory.defaultInstance() .constructType(type.getErasedType())); } else { DeserializationConfig serializationConfig = objectMapper.getDeserializationConfig(); return serializationConfig.introspect(TypeFactory.defaultInstance() .constructType(type.getErasedType())); } }
private BeanDescription beanDescription(ResolvedType type, ModelContext context) { if (context.isReturnType()) { SerializationConfig serializationConfig = objectMapper.getSerializationConfig(); return serializationConfig.introspect(TypeFactory.defaultInstance() .constructType(type.getErasedType())); } else { DeserializationConfig serializationConfig = objectMapper.getDeserializationConfig(); return serializationConfig.introspect(TypeFactory.defaultInstance() .constructType(type.getErasedType())); } }
private void removeSuperSubTypes(List<NamedType> resultTypes, Class<?> superClass) { JavaType superType = _mapper.constructType(superClass); BeanDescription superBean = _mapper.getSerializationConfig().introspect(superType); final List<NamedType> superTypes = _intr.findSubtypes(superBean.getClassInfo()); if (superTypes != null) { resultTypes.removeAll(superTypes); } }