/** * Handling of narrowing conversions for arrays is trickier: for now, * it is not even allowed. */ @Override protected JavaType _narrow(Class<?> subclass) { /* Ok: need a bit of indirection here. First, must replace component * type (and check that it is compatible), then re-construct. */ if (!subclass.isArray()) { // sanity check, should never occur throw new IllegalArgumentException("Incompatible narrowing operation: trying to narrow "+toString()+" to class "+subclass.getName()); } /* Hmmh. This is an awkward back reference... but seems like the * only simple way to do it. */ Class<?> newCompClass = subclass.getComponentType(); /* 14-Mar-2011, tatu: it gets even worse, as we do not have access to * currently configured TypeFactory. This could theoretically cause * problems (when narrowing from array of Objects, to array of non-standard * Maps, for example); but for now need to defer solving this until * it actually becomes a real problem, not just potential one. * (famous last words?) */ JavaType newCompType = TypeFactory.defaultInstance().constructType(newCompClass); return construct(newCompType, _valueHandler, _typeHandler); }
/** * Handling of narrowing conversions for arrays is trickier: for now, * it is not even allowed. */ @Override protected JavaType _narrow(Class<?> subclass) { /* Ok: need a bit of indirection here. First, must replace component * type (and check that it is compatible), then re-construct. */ if (!subclass.isArray()) { // sanity check, should never occur throw new IllegalArgumentException("Incompatible narrowing operation: trying to narrow "+toString()+" to class "+subclass.getName()); } /* Hmmh. This is an awkward back reference... but seems like the * only simple way to do it. */ Class<?> newCompClass = subclass.getComponentType(); /* 14-Mar-2011, tatu: it gets even worse, as we do not have access to * currently configured TypeFactory. This could theoretically cause * problems (when narrowing from array of Objects, to array of non-standard * Maps, for example); but for now need to defer solving this until * it actually becomes a real problem, not just potential one. * (famous last words?) */ JavaType newCompType = TypeFactory.defaultInstance().constructType(newCompClass); return construct(newCompType, _valueHandler, _typeHandler); }
/** * Handling of narrowing conversions for arrays is trickier: for now, * it is not even allowed. */ @Override protected JavaType _narrow(Class<?> subclass) { /* Ok: need a bit of indirection here. First, must replace component * type (and check that it is compatible), then re-construct. */ if (!subclass.isArray()) { // sanity check, should never occur throw new IllegalArgumentException("Incompatible narrowing operation: trying to narrow "+toString()+" to class "+subclass.getName()); } /* Hmmh. This is an awkward back reference... but seems like the * only simple way to do it. */ Class<?> newCompClass = subclass.getComponentType(); /* 14-Mar-2011, tatu: it gets even worse, as we do not have access to * currently configured TypeFactory. This could theoretically cause * problems (when narrowing from array of Objects, to array of non-standard * Maps, for example); but for now need to defer solving this until * it actually becomes a real problem, not just potential one. * (famous last words?) */ JavaType newCompType = TypeFactory.defaultInstance().constructType(newCompClass); return construct(newCompType, _valueHandler, _typeHandler); }
/** * Handling of narrowing conversions for arrays is trickier: for now, * it is not even allowed. */ @Override protected JavaType _narrow(Class<?> subclass) { /* Ok: need a bit of indirection here. First, must replace component * type (and check that it is compatible), then re-construct. */ if (!subclass.isArray()) { // sanity check, should never occur throw new IllegalArgumentException("Incompatible narrowing operation: trying to narrow "+toString()+" to class "+subclass.getName()); } /* Hmmh. This is an awkward back reference... but seems like the * only simple way to do it. */ Class<?> newCompClass = subclass.getComponentType(); /* 14-Mar-2011, tatu: it gets even worse, as we do not have access to * currently configured TypeFactory. This could theoretically cause * problems (when narrowing from array of Objects, to array of non-standard * Maps, for example); but for now need to defer solving this until * it actually becomes a real problem, not just potential one. * (famous last words?) */ JavaType newCompType = TypeFactory.defaultInstance().constructType(newCompClass); return construct(newCompType, _valueHandler, _typeHandler); }