public SetterlessProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedMethod method) { super(propDef, type, typeDeser, contextAnnotations); _annotated = method; _getter = method.getAnnotated(); }
public MethodProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedMethod method) { super(propDef, type, typeDeser, contextAnnotations); _annotated = method; _setter = method.getAnnotated(); _skipNulls = NullsConstantProvider.isSkipper(_nullProvider); }
@Override public boolean isIsGetterVisible(AnnotatedMethod m) { return isIsGetterVisible(m.getAnnotated()); }
@Override public boolean isSetterVisible(AnnotatedMethod m) { return isSetterVisible(m.getAnnotated()); }
Object readResolve() { return new MethodProperty(this, _annotated.getAnnotated()); } }
@Override public boolean isGetterVisible(AnnotatedMethod m) { return isGetterVisible(m.getAnnotated()); }
@Override public Method findFactoryMethod(Class<?>... expArgTypes) { // So, of all single-arg static methods: for (AnnotatedMethod am : _classInfo.getFactoryMethods()) { // 24-Oct-2016, tatu: Better ensure it only takes 1 arg, no matter what if (isFactoryMethod(am) && am.getParameterCount() == 1) { // And must take one of expected arg types (or supertype) Class<?> actualArgType = am.getRawParameterType(0); for (Class<?> expArgType : expArgTypes) { // And one that matches what we would pass in if (actualArgType.isAssignableFrom(expArgType)) { return am.getAnnotated(); } } } } return null; }
@Override public Object findFilterId(final Annotated a) { final Object filterId = super.findFilterId(a); if (filterId != null) { return filterId; } if (a instanceof AnnotatedMethod) { final Method method = ((AnnotatedMethod) a).getAnnotated(); // Interested only in getters - trying to obtain "field" name from them. if (ReflectionHelper.isGetter(method)) { return ReflectionHelper.getPropertyName(method); } } if (a instanceof AnnotatedField || a instanceof AnnotatedClass) { return a.getName(); } return null; } }));
private boolean isVisible(AnnotatedMethod m) { // TODO: use AnnotatedField's annotations directly for (Annotation annotation : m.getAnnotated().getDeclaredAnnotations()) { if (isJAXBAnnotation(annotation)) { return true; } } XmlAccessType accessType = XmlAccessType.PUBLIC_MEMBER; XmlAccessorType at = findAnnotation(XmlAccessorType.class, m, true, true, true); if (at != null) { accessType = at.value(); } if (accessType == XmlAccessType.PROPERTY || accessType == XmlAccessType.PUBLIC_MEMBER) { return Modifier.isPublic(m.getModifiers()); } return false; }
@Override public Object findFilterId(final Annotated a) { final Object filterId = super.findFilterId(a); if (filterId != null) { return filterId; } if (a instanceof AnnotatedMethod) { final Method method = ((AnnotatedMethod) a).getAnnotated(); // Interested only in getters - trying to obtain "field" name from them. if (ReflectionHelper.isGetter(method)) { return ReflectionHelper.getPropertyName(method); } } if (a instanceof AnnotatedField || a instanceof AnnotatedClass) { return a.getName(); } return null; } }));
protected Object initSetter(BeanPropertyDefinition propertyDefinition) throws Throwable { if (propertyDefinition.hasSetter()) { return LambdaMetafactoryUtils.createSetter(propertyDefinition.getSetter().getAnnotated()); } if (propertyDefinition.hasField() && propertyDefinition.getField().isPublic()) { return LambdaMetafactoryUtils.createSetter(propertyDefinition.getField().getAnnotated()); } return null; } }
@SuppressWarnings("unchecked") public static <T> T initGetter(BeanPropertyDefinition propertyDefinition) { if (propertyDefinition.hasGetter()) { return LambdaMetafactoryUtils.createGetter(propertyDefinition.getGetter().getAnnotated()); } if (propertyDefinition.hasField() && propertyDefinition.getField().isPublic()) { return (T) LambdaMetafactoryUtils.createGetter(propertyDefinition.getField().getAnnotated()); } return null; }
public MethodProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedMethod method) { super(propDef, type, typeDeser, contextAnnotations); _annotated = method; _setter = method.getAnnotated(); }
/** * Need to define this to verify that we retain actual Method reference */ Object readResolve() { // sanity check... if (_setter == null || _setter.getAnnotated() == null) { throw new IllegalArgumentException("Missing method (broken JDK (de)serialization?)"); } return this; }
/** * Method called to remove specified method, assuming * it exists in the Map */ public AnnotatedMethod remove(AnnotatedMethod am) { return remove(am.getAnnotated()); }
/** * Method called to remove specified method, assuming * it exists in the Map */ public AnnotatedMethod remove(AnnotatedMethod am) { return remove(am.getAnnotated()); }
PropertyDescriptor fromGetter(AnnotatedMethod getterMethod) { Method getter = getterMethod.getAnnotated(); AnnotatedType fieldType = transform(ClassUtils.getReturnType(getter, type), getter, type); return new PropertyDescriptor(type, getter.getDeclaringClass(), getter, fieldType, getterMethod); }
PropertyDescriptor fromSetter(AnnotatedMethod setterMethod) { Method setter = setterMethod.getAnnotated(); AnnotatedType fieldType = transform(ClassUtils.getParameterTypes(setter, type)[0], setter, type); return new PropertyDescriptor(type, setter.getDeclaringClass(), setter, fieldType, setterMethod); }
private Parameter[] getParameters(AnnotatedWithParams owner) { if (owner instanceof AnnotatedConstructor) { return parameterExtractor.getParameters(((AnnotatedConstructor) owner).getAnnotated()); } if (owner instanceof AnnotatedMethod) { return parameterExtractor.getParameters(((AnnotatedMethod) owner).getAnnotated()); } return null; }
private JavaType extractType(Annotated annotated) { if (annotated instanceof AnnotatedMethod) { AnnotatedMethod method = (AnnotatedMethod) annotated; if (ClassUtils.isSetter(method.getAnnotated())) { return method.getParameterType(0); } return method.getType(); } return annotated.getType(); }