implName = ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForRegularGetter(m, m.getName(), _stdBeanNaming); implName = BeanUtil.okNameForIsGetter(m, m.getName(), _stdBeanNaming); if (implName == null) { return; implName = BeanUtil.okNameForGetter(m, _stdBeanNaming);
/** * @since 2.5 */ @Deprecated // since 2.9, not used any more public static String okNameForSetter(AnnotatedMethod am, boolean stdNaming) { String name = okNameForMutator(am, "set", stdNaming); if ((name != null) // 26-Nov-2009, tatu: need to suppress this internal groovy method && (!"metaClass".equals(name) || !isGroovyMetaClassSetter(am))) { return name; } return null; }
/** * @since 2.5 */ public static String okNameForRegularGetter(AnnotatedMethod am, String name, boolean stdNaming) { if (name.startsWith("get")) { /* 16-Feb-2009, tatu: To handle [JACKSON-53], need to block * CGLib-provided method "getCallbacks". Not sure of exact * safe criteria to get decent coverage without false matches; * but for now let's assume there's no reason to use any * such getter from CGLib. * But let's try this approach... */ if ("getCallbacks".equals(name)) { if (isCglibGetCallbacks(am)) { return null; } } else if ("getMetaClass".equals(name)) { // 30-Apr-2009, tatu: Need to suppress serialization of a cyclic reference if (isGroovyMetaClassGetter(am)) { return null; } } return stdNaming ? stdManglePropertyName(name, 3) : legacyManglePropertyName(name, 3); } return null; }
/** * @since 2.5 */ public static String okNameForGetter(AnnotatedMethod am, boolean stdNaming) { String name = am.getName(); String str = okNameForIsGetter(am, name, stdNaming); if (str == null) { str = okNameForRegularGetter(am, name, stdNaming); } return str; }
/** * @since 2.5 */ public static String okNameForMutator(AnnotatedMethod am, String prefix, boolean stdNaming) { String name = am.getName(); if (name.startsWith(prefix)) { return stdNaming ? stdManglePropertyName(name, prefix.length()) : legacyManglePropertyName(name, prefix.length()); } return null; }
@Override public PropertyName findWrapperName(Annotated ann) { XmlElementWrapper w = findAnnotation(XmlElementWrapper.class, ann, false, false, false); if (w != null) { /* 18-Sep-2013, tatu: As per #24, need to take special care with empty * String, as that should indicate here "use underlying unmodified * property name" (that is, one NOT overridden by @JsonProperty) */ PropertyName name = _combineNames(w.name(), w.namespace(), ""); // clumsy, yes, but has to do: if (!name.hasSimpleName()) { if (ann instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) ann; String str; if (am.getParameterCount() == 0) { str = BeanUtil.okNameForGetter(am); } else { str = BeanUtil.okNameForSetter(am); } if (str != null) { return name.withSimpleName(str); } } return name.withSimpleName(ann.getName()); } return name; } return null; }
@Override public PropertyName findNameForSerialization(Annotated a) { // 16-Sep-2016, tatu: Prior to 2.9 logic her more complicated, on assumption // that visibility rules may require return of "" if method/fied visible; // however, that is not required and causes issues so... now simpler: if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; return isVisible(am) ? findJaxbPropertyName(am, am.getRawType(), BeanUtil.okNameForGetter(am, true)) : null; } if (a instanceof AnnotatedField) { AnnotatedField af = (AnnotatedField) a; return isVisible(af) ? findJaxbPropertyName(af, af.getRawType(), null) : null; } return null; }
implName = (ai == null) ? null : ai.findImplicitPropertyName(m); if (implName == null) { implName = BeanUtil.okNameForMutator(m, _mutatorPrefix, _stdBeanNaming); implName = BeanUtil.okNameForMutator(m, _mutatorPrefix, _stdBeanNaming);
@Override public PropertyName findWrapperName(Annotated ann) { XmlElementWrapper w = findAnnotation(XmlElementWrapper.class, ann, false, false, false); if (w != null) { /* 18-Sep-2013, tatu: As per [jaxb-annotations#24], need to take special care with empty * String, as that should indicate here "use underlying unmodified * property name" (that is, one NOT overridden by @JsonProperty) */ PropertyName name = _combineNames(w.name(), w.namespace(), ""); // clumsy, yes, but has to do: if (!name.hasSimpleName()) { if (ann instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) ann; String str; if (am.getParameterCount() == 0) { str = BeanUtil.okNameForGetter(am, true); } else { str = BeanUtil.okNameForMutator(am, "set", true); } if (str != null) { return name.withSimpleName(str); } } return name.withSimpleName(ann.getName()); } return name; } return null; }
public static String okNameForRegularGetter(AnnotatedMethod am, String name) { if (name.startsWith("get")) { /* 16-Feb-2009, tatu: To handle [JACKSON-53], need to block * CGLib-provided method "getCallbacks". Not sure of exact * safe criteria to get decent coverage without false matches; * but for now let's assume there's no reason to use any * such getter from CGLib. * But let's try this approach... */ if ("getCallbacks".equals(name)) { if (isCglibGetCallbacks(am)) { return null; } } else if ("getMetaClass".equals(name)) { /* 30-Apr-2009, tatu: [JACKSON-103], need to suppress * serialization of a cyclic (and useless) reference */ if (isGroovyMetaClassGetter(am)) { return null; } } return manglePropertyName(name.substring(3)); } return null; }
@Deprecated // since 2.5 public static String okNameForRegularGetter(AnnotatedMethod am, String name) { return okNameForRegularGetter(am, name, false); }
@Deprecated // since 2.5 public static String okNameForIsGetter(AnnotatedMethod am, String name) { return okNameForIsGetter(am, name, false); }
@Override public PropertyName findWrapperName(Annotated ann) { XmlElementWrapper w = findAnnotation(XmlElementWrapper.class, ann, false, false, false); if (w != null) { /* 18-Sep-2013, tatu: As per #24, need to take special care with empty * String, as that should indicate here "use underlying unmodified * property name" (that is, one NOT overridden by @JsonProperty) */ PropertyName name = _combineNames(w.name(), w.namespace(), ""); // clumsy, yes, but has to do: if (!name.hasSimpleName()) { if (ann instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) ann; String str; if (am.getParameterCount() == 0) { str = BeanUtil.okNameForGetter(am); } else { str = BeanUtil.okNameForSetter(am); } if (str != null) { return name.withSimpleName(str); } } return name.withSimpleName(ann.getName()); } return name; } return null; }
/** * @since 2.5 */ public static String okNameForGetter(AnnotatedMethod am, boolean stdNaming) { String name = am.getName(); String str = okNameForIsGetter(am, name, stdNaming); if (str == null) { str = okNameForRegularGetter(am, name, stdNaming); } return str; }
@Deprecated // since 2.5 public static String okNameForGetter(AnnotatedMethod am) { return okNameForGetter(am, false); }
/** * @since 2.5 */ public static String okNameForIsGetter(AnnotatedMethod am, String name, boolean stdNaming) { if (name.startsWith("is")) { // plus, must return a boolean Class<?> rt = am.getRawType(); if (rt == Boolean.class || rt == Boolean.TYPE) { return stdNaming ? stdManglePropertyName(name, 2) : legacyManglePropertyName(name, 2); } } return null; }
@Override public PropertyName findNameForDeserialization(Annotated a) { // 16-Sep-2016, tatu: Prior to 2.9 logic her more complicated, on assumption // that visibility rules may require return of "" if method/fied visible; // however, that is not required and causes issues so... now simpler: if (a instanceof AnnotatedMethod) { AnnotatedMethod am = (AnnotatedMethod) a; if (!isVisible(am)) { return null; } Class<?> rawType = am.getRawParameterType(0); return findJaxbPropertyName(am, rawType, BeanUtil.okNameForMutator(am, "set", true)); } if (a instanceof AnnotatedField) { AnnotatedField af = (AnnotatedField) a; return isVisible(af) ? findJaxbPropertyName(af, af.getRawType(), null) : null; } return null; }
case 0: // getter idPropName = findJaxbPropertyName(m, m.getRawType(), BeanUtil.okNameForGetter(m, true)); break method_loop; case 1: // setter idPropName = findJaxbPropertyName(m, m.getRawType(), BeanUtil.okNameForMutator(m, "set", true)); break method_loop;
public static String okNameForRegularGetter(AnnotatedMethod am, String name) { if (name.startsWith("get")) { /* 16-Feb-2009, tatu: To handle [JACKSON-53], need to block * CGLib-provided method "getCallbacks". Not sure of exact * safe criteria to get decent coverage without false matches; * but for now let's assume there's no reason to use any * such getter from CGLib. * But let's try this approach... */ if ("getCallbacks".equals(name)) { if (isCglibGetCallbacks(am)) { return null; } } else if ("getMetaClass".equals(name)) { /* 30-Apr-2009, tatu: [JACKSON-103], need to suppress * serialization of a cyclic (and useless) reference */ if (isGroovyMetaClassGetter(am)) { return null; } } return manglePropertyName(name.substring(3)); } return null; }
@Deprecated // since 2.5 public static String okNameForRegularGetter(AnnotatedMethod am, String name) { return okNameForRegularGetter(am, name, false); }