@Override public Boolean isIgnorableType(AnnotatedClass annotatedClass) { return PropertyState.class.isAssignableFrom(annotatedClass.getAnnotated()) || EntityProxy.class.isAssignableFrom(annotatedClass.getAnnotated()); } }
@Override public Object instantiateBean(boolean fixAccess) { AnnotatedConstructor ac = _classInfo.getDefaultConstructor(); if (ac == null) { return null; } if (fixAccess) { ac.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } try { return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e; while (t.getCause() != null) { t = t.getCause(); } ClassUtil.throwIfError(t); ClassUtil.throwIfRTE(t); throw new IllegalArgumentException("Failed to instantiate bean of type " +_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") " +ClassUtil.exceptionMessage(t), t); } }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { /* As per [JACKSON-411], XmlJavaTypeAdapter should not be inherited from super-class. * It would still be nice to be able to use mix-ins; but unfortunately we seem to lose * knowledge of class that actually declared the annotation. Thus, we'll only accept * declaration from specific class itself. */ XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { // should we try caching this? @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); // true -> yes, force access if need be return ClassUtil.createInstance(cls, true); } return null; }
final Class<?> beanClass = bean.getClassInfo().getAnnotated(); for (NamedType subtype : types) { final Class<?> subtypeType = subtype.getType();
@Override public Boolean isIgnorableType(AnnotatedClass ac) { /* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling * of `FieldHandled`. Not sure if it works without test (alas, none provided), * but will try our best -- problem is, if it' */ // ... could we avoid direct class reference? if (FieldHandler.class.isAssignableFrom(ac.getAnnotated())) { return Boolean.TRUE; } return null; } }
@Override public Boolean isIgnorableType(AnnotatedClass ac) { /* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling * of `FieldHandled`. Not sure if it works without test (alas, none provided), * but will try our best -- problem is, if it' */ // ... could we avoid direct class reference? if (FieldHandler.class.isAssignableFrom(ac.getAnnotated())) { return Boolean.TRUE; } return null; } }
@Override public Boolean isIgnorableType(AnnotatedClass ac) { /* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling * of `FieldHandled`. Not sure if it works without test (alas, none provided), * but will try our best -- problem is, if it' */ // 11-Feb-2016, tatu: As per [datatype-hibernate#86] must use indirection. Sigh. Class<?> handlerClass = FieldHandlerChecker.instance.getHandlerClass(); if (handlerClass != null) { if (handlerClass.isAssignableFrom(ac.getAnnotated())) { return Boolean.TRUE; } } return null; }
@Override public Boolean isIgnorableType(AnnotatedClass ac) { /* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling * of `FieldHandled`. Not sure if it works without test (alas, none provided), * but will try our best -- problem is, if it' */ // 11-Feb-2016, tatu: As per [datatype-hibernate#86] must use indirection. Sigh. Class<?> handlerClass = FieldHandlerChecker.instance.getHandlerClass(); if (handlerClass != null) { if (handlerClass.isAssignableFrom(ac.getAnnotated())) { return Boolean.TRUE; } } return null; }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); return ClassUtil.createInstance(cls, true); } return null; } }
@Override public Object findDeserializer(Annotated a) { // System.err.println("Annotated:" + a.getClass().getName() + " " + a); if (a instanceof AnnotatedClass) { Class<?> clazz = ((AnnotatedClass) a).getAnnotated(); // System.err.println("clazz:" + clazz.getName() + " " + a.getName()); if (clazz.isEnum()) { if (Onum.class.isAssignableFrom(clazz)) { // System.err.println("OnumJsonSerializerIntrospector findDeserializer:" + clazz.getName() + " a:" + a); return new OnumJsonDeserializer(clazz); } } } Object deserializer = super.findDeserializer(a); return deserializer; }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { /* As per [JACKSON-411], XmlJavaTypeAdapter should not be inherited from super-class. * It would still be nice to be able to use mix-ins; but unfortunately we seem to lose * knowledge of class that actually declared the annotation. Thus, we'll only accept * declaration from specific class itself. */ XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { // should we try caching this? @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); // true -> yes, force access if need be return ClassUtil.createInstance(cls, true); } return null; }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { /* As per [JACKSON-411], XmlJavaTypeAdapter should not be inherited from super-class. * It would still be nice to be able to use mix-ins; but unfortunately we seem to lose * knowledge of class that actually declared the annotation. Thus, we'll only accept * declaration from specific class itself. */ XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { // should we try caching this? @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); // true -> yes, force access if need be return ClassUtil.createInstance(cls, true); } return null; }
@Override public Object instantiateBean(boolean fixAccess) { AnnotatedConstructor ac = _classInfo.getDefaultConstructor(); if (ac == null) { return null; } if (fixAccess) { ac.fixAccess(); } try { return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e; while (t.getCause() != null) { t = t.getCause(); } if (t instanceof Error) throw (Error) t; if (t instanceof RuntimeException) throw (RuntimeException) t; throw new IllegalArgumentException("Failed to instantiate bean of type "+_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") "+t.getMessage(), t); } }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { /* As per [JACKSON-411], XmlJavaTypeAdapter should not be inherited from super-class. * It would still be nice to be able to use mix-ins; but unfortunately we seem to lose * knowledge of class that actually declared the annotation. Thus, we'll only accept * declaration from specific class itself. */ XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { // should we try caching this? @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); // true -> yes, force access if need be return ClassUtil.createInstance(cls, true); } return null; }
protected Object getDefaultBean() { if (_defaultBean == null) { /* If we can fix access rights, we should; otherwise non-public * classes or default constructor will prevent instantiation */ _defaultBean = _beanDesc.instantiateBean(_config.canOverrideAccessModifiers()); if (_defaultBean == null) { Class<?> cls = _beanDesc.getClassInfo().getAnnotated(); throw new IllegalArgumentException("Class "+cls.getName()+" has no default constructor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annotation"); } } return _defaultBean; }
@SuppressWarnings("unchecked") private XmlAdapter<Object,Object> findAdapterForClass(AnnotatedClass ac, boolean forSerialization) { /* As per [JACKSON-411], XmlJavaTypeAdapter should not be inherited from super-class. * It would still be nice to be able to use mix-ins; but unfortunately we seem to lose * knowledge of class that actually declared the annotation. Thus, we'll only accept * declaration from specific class itself. */ XmlJavaTypeAdapter adapterInfo = ac.getAnnotated().getAnnotation(XmlJavaTypeAdapter.class); if (adapterInfo != null) { // should we try caching this? @SuppressWarnings("rawtypes") Class<? extends XmlAdapter> cls = adapterInfo.value(); // true -> yes, force access if need be return ClassUtil.createInstance(cls, true); } return null; }
protected Object getDefaultBean() { if (_defaultBean == null) { /* If we can fix access rights, we should; otherwise non-public * classes or default constructor will prevent instantiation */ _defaultBean = _beanDesc.instantiateBean(_config.canOverrideAccessModifiers()); if (_defaultBean == null) { Class<?> cls = _beanDesc.getClassInfo().getAnnotated(); throw new IllegalArgumentException("Class "+cls.getName()+" has no default constructor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annotation"); } } return _defaultBean; }
@Override public Object instantiateBean(boolean fixAccess) { AnnotatedConstructor ac = _classInfo.getDefaultConstructor(); if (ac == null) { return null; } if (fixAccess) { ac.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } try { return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e; while (t.getCause() != null) { t = t.getCause(); } if (t instanceof Error) throw (Error) t; if (t instanceof RuntimeException) throw (RuntimeException) t; throw new IllegalArgumentException("Failed to instantiate bean of type "+_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") "+t.getMessage(), t); } }
protected Object getDefaultBean() { if (_defaultBean == null) { /* If we can fix access rights, we should; otherwise non-public * classes or default constructor will prevent instantiation */ _defaultBean = _beanDesc.instantiateBean(_config.canOverrideAccessModifiers()); if (_defaultBean == null) { Class<?> cls = _beanDesc.getClassInfo().getAnnotated(); throw new IllegalArgumentException("Class "+cls.getName()+" has no default constructor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annotation"); } } return _defaultBean; }
protected Object getDefaultBean() { if (_defaultBean == null) { /* If we can fix access rights, we should; otherwise non-public * classes or default constructor will prevent instantiation */ _defaultBean = _beanDesc.instantiateBean(_config.canOverrideAccessModifiers()); if (_defaultBean == null) { Class<?> cls = _beanDesc.getClassInfo().getAnnotated(); throw new IllegalArgumentException("Class "+cls.getName()+" has no default constructor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annotation"); } } return _defaultBean; }