public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }
private boolean needsQuotes(Class clazz) { clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); return clazz == null || clazz == Character.TYPE; }
/** * * @param clazz class * @return true if need quotes */ private boolean needsQuotes(Class<?> clazz) { clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); return clazz == null || clazz == Character.TYPE; }
/** * * @param clazz class * @return true if need quotes */ private boolean needsQuotes(Class<?> clazz) { clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); return clazz == null || clazz == Character.TYPE; }
private boolean needsQuotes(Class clazz) { clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); return clazz == null || clazz == Character.TYPE; }
private boolean needsQuotes(Class clazz) { if(JsonStringWriter.MODE_KEEP_VALUETYPES_BOOLEANS.equals(keepValueTypesMode)){ clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); if(Boolean.class.equals(clazz)) return false; else return true; }else if(JsonStringWriter.MODE_KEEP_VALUETYPES_ALL.equals(keepValueTypesMode)){ clazz = clazz != null && clazz.isPrimitive() ? clazz : Primitives.unbox(clazz); return clazz == null || clazz == Character.TYPE; }else{ return true; } }
@Override public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class<?> itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); writer.startNode(itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final int length = Array.getLength(source); for (int i = 0; i < length; ++i) { final Object item = Array.get(source, i); final Class itemType = item == null ? Mapper.Null.class : arrayType.getComponentType().isPrimitive() ? Primitives.unbox(item.getClass()) : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, itemName, itemType); if (!itemType.equals(arrayType.getComponentType())) { final String attributeName = mapper.aliasForSystemAttribute("class"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(itemType)); } } if (item != null) { context.convertAnother(item); } writer.endNode(); } }