public Node representData(Object data) { Tag tag = new Tag(data.getClass()); return representScalar(getTag(data.getClass(), tag), ((Enum<?>) data).name()); } }
calendar = (Calendar) data; } else { calendar = Calendar.getInstance(getTimeZone() == null ? TimeZone.getTimeZone("UTC") : timeZone); calendar.setTime((Date) data); return representScalar(getTag(data.getClass(), Tag.TIMESTAMP), buffer.toString(), DumperOptions.ScalarStyle.PLAIN);
@SuppressWarnings("unchecked") public Node representData(Object data) { return representMapping(getTag(data.getClass(), Tag.MAP), (Map<Object, Object>) data, DumperOptions.FlowStyle.AUTO); } }
@SuppressWarnings("unchecked") public Node representData(Object data) { return representSequence(getTag(data.getClass(), Tag.SEQ), (List<Object>) data, DumperOptions.FlowStyle.AUTO); } }
public Node representData(Object data) { return representScalar(Tag.NULL, "null"); } }
public Node representData(Object data) { Object[] array = (Object[]) data; List<Object> list = Arrays.asList(array); return representSequence(Tag.SEQ, list, DumperOptions.FlowStyle.AUTO); } }
@Override public void setPropertyUtils(PropertyUtils propertyUtils) { super.setPropertyUtils(propertyUtils); Collection<TypeDescription> tds = typeDefinitions.values(); for (TypeDescription typeDescription : tds) { typeDescription.setPropertyUtils(propertyUtils); } }
@SuppressWarnings("unchecked") public Node representData(Object data) { Iterator<Object> iter = (Iterator<Object>) data; return representSequence(getTag(data.getClass(), Tag.SEQ), new IteratorWrapper(iter), DumperOptions.FlowStyle.AUTO); } }
public Node representData(Object data) { String value; if (Boolean.TRUE.equals(data)) { value = "true"; } else { value = "false"; } return representScalar(Tag.BOOL, value); } }
public Node representData(Object data) { Class<?> type = data.getClass().getComponentType(); if (byte.class == type) { return representSequence(Tag.SEQ, asByteList(data), DumperOptions.FlowStyle.AUTO); } else if (short.class == type) { return representSequence(Tag.SEQ, asShortList(data), DumperOptions.FlowStyle.AUTO); } else if (int.class == type) { return representSequence(Tag.SEQ, asIntList(data), DumperOptions.FlowStyle.AUTO); } else if (long.class == type) { return representSequence(Tag.SEQ, asLongList(data), DumperOptions.FlowStyle.AUTO); } else if (float.class == type) { return representSequence(Tag.SEQ, asFloatList(data), DumperOptions.FlowStyle.AUTO); } else if (double.class == type) { return representSequence(Tag.SEQ, asDoubleList(data), DumperOptions.FlowStyle.AUTO); } else if (char.class == type) { return representSequence(Tag.SEQ, asCharList(data), DumperOptions.FlowStyle.AUTO); } else if (boolean.class == type) { return representSequence(Tag.SEQ, asBooleanList(data), DumperOptions.FlowStyle.AUTO); } throw new YAMLException("Unexpected primitive '" + type.getCanonicalName() + "'"); }
@Override public void setPropertyUtils(PropertyUtils propertyUtils) { super.setPropertyUtils(propertyUtils); Collection<TypeDescription> tds = typeDefinitions.values(); for (TypeDescription typeDescription : tds) { typeDescription.setPropertyUtils(propertyUtils); } }
public Node representData(Object data) { return representScalar(getTag(data.getClass(), new Tag(UUID.class)), data.toString()); } }
calendar = (Calendar) data; } else { calendar = Calendar.getInstance(getTimeZone() == null ? TimeZone.getTimeZone("UTC") : timeZone); calendar.setTime((Date) data); + (partOfHour < 10 ? "0" + partOfHour : partOfHour)); return representScalar(getTag(data.getClass(), Tag.TIMESTAMP), buffer.toString(), null);
@SuppressWarnings("unchecked") public Node representData(Object data) { Map<Object, Object> value = new LinkedHashMap<Object, Object>(); Set<Object> set = (Set<Object>) data; for (Object key : set) { value.put(key, null); } return representMapping(getTag(data.getClass(), Tag.SET), value, DumperOptions.FlowStyle.AUTO); } }
@SuppressWarnings("unchecked") public Node representData(Object data) { return representSequence(getTag(data.getClass(), Tag.SEQ), (List<Object>) data, null); } }
public Node representData(Object data) { char[] binary = Base64Coder.encode((byte[]) data); return representScalar(Tag.BINARY, String.valueOf(binary), DumperOptions.ScalarStyle.LITERAL); } }
public Node representData(Object data) { Object[] array = (Object[]) data; List<Object> list = Arrays.asList(array); return representSequence(Tag.SEQ, list, null); } }
public Node representData(Object data) { Tag tag; String value; if (data instanceof Byte || data instanceof Short || data instanceof Integer || data instanceof Long || data instanceof BigInteger) { tag = Tag.INT; value = data.toString(); } else { Number number = (Number) data; tag = Tag.FLOAT; if (number.equals(Double.NaN)) { value = ".NaN"; } else if (number.equals(Double.POSITIVE_INFINITY)) { value = ".inf"; } else if (number.equals(Double.NEGATIVE_INFINITY)) { value = "-.inf"; } else { value = number.toString(); } } return representScalar(getTag(data.getClass(), tag), value); } }
calendar = (Calendar) data; } else { calendar = Calendar.getInstance(getTimeZone() == null ? TimeZone.getTimeZone("UTC") : timeZone); calendar.setTime((Date) data); + (partOfHour < 10 ? "0" + partOfHour : partOfHour)); return representScalar(getTag(data.getClass(), Tag.TIMESTAMP), buffer.toString(), null);
@SuppressWarnings("unchecked") public Node representData(Object data) { return representMapping(getTag(data.getClass(), Tag.MAP), (Map<Object, Object>) data, null); } }