/** * Helper method used to encapsulate details of annotation-based type * coercion * * @since 1.8 */ @SuppressWarnings("unchecked") protected <T extends JavaType> T modifyTypeByAnnotation(SerializationConfig config, Annotated a, T type) { // first: let's check class for the instance itself: Class<?> superclass = config.getAnnotationIntrospector().findSerializationType(a); if (superclass != null) { try { type = (T) type.widenBy(superclass); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Failed to widen type "+type+" with concrete-type annotation (value "+superclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage()); } } return modifySecondaryTypesByAnnotation(config, a, type); }
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);
/** * Helper method used to encapsulate details of annotation-based type * coercion * * @since 1.8 */ @SuppressWarnings("unchecked") protected <T extends JavaType> T modifyTypeByAnnotation(SerializationConfig config, Annotated a, T type) { // first: let's check class for the instance itself: Class<?> superclass = config.getAnnotationIntrospector().findSerializationType(a); if (superclass != null) { try { type = (T) type.widenBy(superclass); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Failed to widen type "+type+" with concrete-type annotation (value "+superclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage()); } } return modifySecondaryTypesByAnnotation(config, a, type); }
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);
/** * Helper method used to encapsulate details of annotation-based type * coercion * * @since 1.8 */ @SuppressWarnings("unchecked") protected <T extends JavaType> T modifyTypeByAnnotation(SerializationConfig config, Annotated a, T type) { // first: let's check class for the instance itself: Class<?> superclass = config.getAnnotationIntrospector().findSerializationType(a); if (superclass != null) { try { type = (T) type.widenBy(superclass); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Failed to widen type "+type+" with concrete-type annotation (value "+superclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage()); } } return modifySecondaryTypesByAnnotation(config, a, type); }
/** * Helper method used to encapsulate details of annotation-based type * coercion * * @since 1.8 */ @SuppressWarnings("unchecked") protected <T extends JavaType> T modifyTypeByAnnotation(SerializationConfig config, Annotated a, T type) { // first: let's check class for the instance itself: Class<?> superclass = config.getAnnotationIntrospector().findSerializationType(a); if (superclass != null) { try { type = (T) type.widenBy(superclass); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Failed to widen type "+type+" with concrete-type annotation (value "+superclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage()); } } return modifySecondaryTypesByAnnotation(config, a, type); }
/** * Helper method used to encapsulate details of annotation-based type * coercion * * @since 1.8 */ @SuppressWarnings("unchecked") protected <T extends JavaType> T modifyTypeByAnnotation(SerializationConfig config, Annotated a, T type) { // first: let's check class for the instance itself: Class<?> superclass = config.getAnnotationIntrospector().findSerializationType(a); if (superclass != null) { try { type = (T) type.widenBy(superclass); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("Failed to widen type "+type+" with concrete-type annotation (value "+superclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage()); } } return modifySecondaryTypesByAnnotation(config, a, type); }
protected Class<?> findSerializationType(Annotated a, boolean useStaticTyping) { // [JACKSON-120]: Check to see if serialization type is fixed Class<?> serializationType = _annotationIntrospector.findSerializationType(a); if (serializationType != null) { // Must be a super type... Class<?> type = a.getType(); if (!serializationType.isAssignableFrom(type)) { throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serializationType.getName()+" not a super-type of (declared) class "+type.getName()); } return serializationType; } /* [JACKSON-114]: if using static typing, declared type is known * to be the type... */ JsonSerialize.Typing typing = _annotationIntrospector.findSerializationTyping(a); if (typing != null) { useStaticTyping = (typing == JsonSerialize.Typing.STATIC); } if (useStaticTyping) { return a.getType(); } return null; }
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);
type = (T) type.narrowBy(subclass); } catch (IllegalArgumentException iae) { throw new JsonMappingException("Failed to narrow type "+type+" with concrete-type annotation (value "+subclass.getName()+"), method '"+a.getName()+"': "+iae.getMessage(), null, iae);