/** * Another helper method to deal with rest of [JACKSON-103] */ protected static boolean isGroovyMetaClassGetter(AnnotatedMethod am) { Class<?> rt = am.getRawType(); if (rt == null || rt.isArray()) { return false; } Package pkg = rt.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
public static String okNameForIsGetter(AnnotatedMethod am, String name) { if (name.startsWith("is")) { // plus, must return boolean... Class<?> rt = am.getRawType(); if (rt != Boolean.class && rt != Boolean.TYPE) { return null; } return manglePropertyName(name.substring(2)); } // no, not a match by name return null; }
/** * 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; }
Class<?> rt = am.getRawType();
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; }
int argCount = factory.getParameterCount(); if (argCount == 1) { Class<?> returnType = factory.getRawType();
int argCount = factory.getParameterCount(); if (argCount == 1) { Class<?> returnType = factory.getRawType();
Class<?> rt = getter.getRawType(); if (Collection.class.isAssignableFrom(rt) || Map.class.isAssignableFrom(rt)) { if (!ignored.contains(name) && !builder.hasProperty(name)) {
/** * Another helper method to deal with rest of [JACKSON-103] */ protected static boolean isGroovyMetaClassGetter(AnnotatedMethod am) { Class<?> rt = am.getRawType(); if (rt == null || rt.isArray()) { return false; } Package pkg = rt.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
public static String okNameForIsGetter(AnnotatedMethod am, String name) { if (name.startsWith("is")) { // plus, must return boolean... Class<?> rt = am.getRawType(); if (rt != Boolean.class && rt != Boolean.TYPE) { return null; } return manglePropertyName(name.substring(2)); } // no, not a match by name return null; }
/** * 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; }
Class<?> rt = am.getRawType();
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; }
int argCount = factory.getParameterCount(); if (argCount == 1) { Class<?> returnType = factory.getRawType();
int argCount = factory.getParameterCount(); if (argCount == 1) { Class<?> returnType = factory.getRawType();
/** * Another helper method to deal with rest of [JACKSON-103] */ protected static boolean isGroovyMetaClassGetter(AnnotatedMethod am) { Class<?> rt = am.getRawType(); if (rt == null || rt.isArray()) { return false; } Package pkg = rt.getPackage(); if (pkg != null && pkg.getName().startsWith("groovy.lang")) { return true; } return false; }
Class<?> rt = getter.getRawType(); if (Collection.class.isAssignableFrom(rt) || Map.class.isAssignableFrom(rt)) { if (!ignored.contains(name) && !builder.hasProperty(name)) {
public String okNameForIsGetter(AnnotatedMethod am, String name) { if (name.startsWith("is")) { // plus, must return boolean... Class<?> rt = am.getRawType(); if (rt != Boolean.class && rt != Boolean.TYPE) { return null; } return mangleGetterName(am, name.substring(2)); } // no, not a match by name return null; }
public static String okNameForIsGetter(AnnotatedMethod am, String name) { if (name.startsWith("is")) { // plus, must return boolean... Class<?> rt = am.getRawType(); if (rt != Boolean.class && rt != Boolean.TYPE) { return null; } return manglePropertyName(name.substring(2)); } // no, not a match by name return null; }
public static String okNameForIsGetter(AnnotatedMethod am, String name) { if (name.startsWith("is")) { // plus, must return boolean... Class<?> rt = am.getRawType(); if (rt != Boolean.class && rt != Boolean.TYPE) { return null; } return manglePropertyName(name.substring(2)); } // no, not a match by name return null; }