@Override public String toString() { return "[method "+getName()+", annotations: "+_annotations+"]"; } }
/** * Method used to locate the method of introspected class that * implements {@link org.codehaus.jackson.annotate.JsonAnyGetter}. * If no such method exists null is returned. * If more than one are found, an exception is thrown. * * @since 1.6 */ @Override public AnnotatedMethod findAnyGetter() throws IllegalArgumentException { if (_anyGetterMethod != null) { /* For now let's require a Map; in future can add support for other * types like perhaps Iterable<Map.Entry>? */ Class<?> type = _anyGetterMethod.getRawType(); if (!Map.class.isAssignableFrom(type)) { throw new IllegalArgumentException("Invalid 'any-getter' annotation on method "+_anyGetterMethod.getName()+"(): return type is not instance of java.util.Map"); } } return _anyGetterMethod; }
public String getFullName() { return getDeclaringClass().getName() + "#" + getName() + "(" +getParameterCount()+" params)"; }
/** * Method used to locate the method of introspected class that * implements {@link org.codehaus.jackson.annotate.JsonAnySetter}. If no such method exists * null is returned. If more than one are found, an exception * is thrown. * Additional checks are also made to see that method signature * is acceptable: needs to take 2 arguments, first one String or * Object; second any can be any type. */ @Override public AnnotatedMethod findAnySetter() throws IllegalArgumentException { if (_anySetterMethod != null) { /* Also, let's be somewhat strict on how field name is to be * passed; String, Object make sense, others not * so much. */ /* !!! 18-May-2009, tatu: how about enums? Can add support if * requested; easy enough for devs to add support within * method. */ Class<?> type = _anySetterMethod.getParameterClass(0); if (type != String.class && type != Object.class) { throw new IllegalArgumentException("Invalid 'any-setter' annotation on method "+_anySetterMethod.getName()+"(): first argument not of type String or Object, but "+type.getName()); } } return _anySetterMethod; }
public static String okNameForSetter(AnnotatedMethod am) { String name = am.getName(); if (name.startsWith("set")) { name = manglePropertyName(name.substring(3)); if (name == null) { // plain old "set" is no good... return null; } if ("metaClass".equals(name)) { // 26-Nov-2009 [JACSON-103], need to suppress this internal groovy method if (isGroovyMetaClassSetter(am)) { return null; } } return name; } return null; }
public static String okNameForGetter(AnnotatedMethod am) { String name = am.getName(); String str = okNameForIsGetter(am, name); if (str == null) { str = okNameForRegularGetter(am, name); } return str; }
protected boolean isFactoryMethod(AnnotatedMethod am) { /* First: return type must be compatible with the introspected class * (i.e. allowed to be sub-class, although usually is the same * class) */ Class<?> rt = am.getRawType(); if (!getBeanClass().isAssignableFrom(rt)) { return false; } /* Also: must be a recognized factory method, meaning: * (a) marked with @JsonCreator annotation, or * (a) "valueOf" (at this point, need not be public) */ if (_annotationIntrospector.hasCreatorAnnotation(am)) { return true; } if ("valueOf".equals(am.getName())) { return true; } return false; }
@Override public String toString() { return "[method "+getName()+", annotations: "+_annotations+"]"; } }
AnnotatedMethod mixIn = it.next(); try { Method m = Object.class.getDeclaredMethod(mixIn.getName(), mixIn.getParameterClasses()); if (m != null) { AnnotatedMethod am = _constructMethod(m);
BeanProperty.Std property = new BeanProperty.Std(setter.getName(), type, beanDesc.getClassAnnotations(), setter); type = resolveType(config, beanDesc, type, setter, property);
/** * Method used to locate the method of introspected class that * implements {@link org.codehaus.jackson.annotate.JsonAnyGetter}. * If no such method exists null is returned. * If more than one are found, an exception is thrown. * * @since 1.6 */ @Override public AnnotatedMethod findAnyGetter() throws IllegalArgumentException { if (_anyGetterMethod != null) { /* For now let's require a Map; in future can add support for other * types like perhaps Iterable<Map.Entry>? */ Class<?> type = _anyGetterMethod.getRawType(); if (!Map.class.isAssignableFrom(type)) { throw new IllegalArgumentException("Invalid 'any-getter' annotation on method "+_anyGetterMethod.getName()+"(): return type is not instance of java.util.Map"); } } return _anyGetterMethod; }
public String getFullName() { return getDeclaringClass().getName() + "#" + getName() + "(" +getParameterCount()+" params)"; }
/** * Method used to locate the method of introspected class that * implements {@link org.codehaus.jackson.annotate.JsonAnySetter}. If no such method exists * null is returned. If more than one are found, an exception * is thrown. * Additional checks are also made to see that method signature * is acceptable: needs to take 2 arguments, first one String or * Object; second any can be any type. */ @Override public AnnotatedMethod findAnySetter() throws IllegalArgumentException { if (_anySetterMethod != null) { /* Also, let's be somewhat strict on how field name is to be * passed; String, Object make sense, others not * so much. */ /* !!! 18-May-2009, tatu: how about enums? Can add support if * requested; easy enough for devs to add support within * method. */ Class<?> type = _anySetterMethod.getParameterClass(0); if (type != String.class && type != Object.class) { throw new IllegalArgumentException("Invalid 'any-setter' annotation on method "+_anySetterMethod.getName()+"(): first argument not of type String or Object, but "+type.getName()); } } return _anySetterMethod; }
public static String okNameForSetter(AnnotatedMethod am) { String name = am.getName(); if (name.startsWith("set")) { name = manglePropertyName(name.substring(3)); if (name == null) { // plain old "set" is no good... return null; } if ("metaClass".equals(name)) { // 26-Nov-2009 [JACSON-103], need to suppress this internal groovy method if (isGroovyMetaClassSetter(am)) { return null; } } return name; } return null; }
public static String okNameForGetter(AnnotatedMethod am) { String name = am.getName(); String str = okNameForIsGetter(am, name); if (str == null) { str = okNameForRegularGetter(am, name); } return str; }
protected boolean isFactoryMethod(AnnotatedMethod am) { /* First: return type must be compatible with the introspected class * (i.e. allowed to be sub-class, although usually is the same * class) */ Class<?> rt = am.getRawType(); if (!getBeanClass().isAssignableFrom(rt)) { return false; } /* Also: must be a recognized factory method, meaning: * (a) marked with @JsonCreator annotation, or * (a) "valueOf" (at this point, need not be public) */ if (_annotationIntrospector.hasCreatorAnnotation(am)) { return true; } if ("valueOf".equals(am.getName())) { return true; } return false; }
AnnotatedMethod mixIn = it.next(); try { Method m = Object.class.getDeclaredMethod(mixIn.getName(), mixIn.getParameterClasses()); if (m != null) { AnnotatedMethod am = _constructMethod(m);
BeanProperty.Std property = new BeanProperty.Std(setter.getName(), type, beanDesc.getClassAnnotations(), setter); type = resolveType(config, beanDesc, type, setter, property);