Java Code Examples for com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition#hasSetter()
The following examples show how to use
com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition#hasSetter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProducerArgumentsMapperCreator.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Override protected void processBeanParameter(int producerParamIdx, Parameter producerParameter) { ProducerBeanParamMapper mapper = new ProducerBeanParamMapper( providerMethod.getParameters()[producerParamIdx].getName(), producerParameter.getType()); JavaType producerType = TypeFactory.defaultInstance().constructType(producerParameter.getParameterizedType()); for (BeanPropertyDefinition propertyDefinition : serializationConfig.introspect(producerType) .findProperties()) { String parameterName = collectParameterName(providerMethod, propertyDefinition); Integer swaggerIdx = findSwaggerParameterIndex(parameterName); if (swaggerIdx == null) { throw new IllegalStateException(String .format("failed to find producer parameter in contract, method=%s:%s, bean parameter name=%s.", providerMethod.getDeclaringClass().getName(), providerMethod.getName(), parameterName)); } Setter<Object, Object> setter; if (propertyDefinition.hasSetter()) { setter = LambdaMetafactoryUtils.createLambda(propertyDefinition.getSetter().getAnnotated(), Setter.class); } else { setter = LambdaMetafactoryUtils.createSetter(propertyDefinition.getField().getAnnotated()); } swaggerParameterTypes.put(parameterName, propertyDefinition.getPrimaryType()); mapper.addField(parameterName, setter); processedSwaggerParamters.add(parameterName); } mappers.add(mapper); }
Example 2
Source File: BeanDescriptor.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
protected Object initSetter(BeanPropertyDefinition propertyDefinition) { if (propertyDefinition.hasSetter()) { return LambdaMetafactoryUtils.createSetter(propertyDefinition.getSetter().getAnnotated()); } if (propertyDefinition.hasField() && propertyDefinition.getField().isPublic()) { return LambdaMetafactoryUtils.createSetter(propertyDefinition.getField().getAnnotated()); } return null; }
Example 3
Source File: KeeperBeanDeserializerModifier.java From haven-platform with Apache License 2.0 | 5 votes |
@Override public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc, BeanDeserializerBuilder builder) { for (BeanPropertyDefinition propDef : beanDesc.findProperties()) { if (!propDef.hasGetter() || propDef.hasSetter()) { continue; } AnnotatedMember getter = propDef.getAccessor(); if (!Keeper.class.equals(getter.getRawType())) { continue; } builder.addOrReplaceProperty(new CustomGetterBeanProperty(propDef, getter), true); } return builder; }