@Override public void output(Date val, Appendable buf, String prefix, Set<Date> inProcess) throws AtlasException { TypeUtils.outputVal(val == null ? "<null>" : utcDateFormat.print(new DateTime(val).withZone(DateTimeZone.UTC)), buf, prefix); }
public void output(IStruct s, Appendable buf, String prefix, Set<IStruct> inProcess) throws AtlasException { if (s == null) { TypeUtils.outputVal("<null>\n", buf, ""); return; } if (inProcess == null) { inProcess = new HashSet<>(); } else if (inProcess.contains(s)) { // Avoid infinite recursion when structs reference each other. return; } inProcess.add(s); try { TypeUtils.outputVal("{", buf, prefix); TypeUtils.outputVal("\n", buf, ""); String fieldPrefix = prefix + "\t"; outputFields(s, buf, fieldPrefix, inProcess); TypeUtils.outputVal("}", buf, prefix); } finally { inProcess.remove(s); } }
public void output(IStruct s, Appendable buf, String prefix, Set<IStruct> inProcess) throws AtlasException { if (s == null) { TypeUtils.outputVal("<null>\n", buf, ""); return; } if (inProcess == null) { inProcess = new HashSet<>(); } else if (inProcess.contains(s)) { // Avoid infinite recursion when structs reference each other. return; } inProcess.add(s); try { TypeUtils.outputVal("{", buf, prefix); TypeUtils.outputVal("\n", buf, ""); String fieldPrefix = prefix + "\t"; outputFields(s, buf, fieldPrefix, inProcess); TypeUtils.outputVal("}", buf, prefix); } finally { inProcess.remove(s); } }
@Override public void output(Date val, Appendable buf, String prefix, Set<Date> inProcess) throws AtlasException { TypeUtils.outputVal(val == null ? "<null>" : utcDateFormat.print(new DateTime(val).withZone(DateTimeZone.UTC)), buf, prefix); }
protected void outputFields(IStruct s, Appendable buf, String fieldPrefix, Set<? extends IStruct> inProcess) throws AtlasException { for (Map.Entry<String, AttributeInfo> e : fields.entrySet()) { String attrName = e.getKey(); AttributeInfo i = e.getValue(); Object aVal = s.get(attrName); TypeUtils.outputVal(attrName + " : ", buf, fieldPrefix); if (aVal != null && aVal instanceof Id) { TypeUtils.outputVal(aVal.toString(), buf, ""); } else { i.dataType().output(aVal, buf, fieldPrefix, inProcess); } TypeUtils.outputVal("\n", buf, ""); } }
protected void outputFields(IStruct s, Appendable buf, String fieldPrefix, Set<? extends IStruct> inProcess) throws AtlasException { for (Map.Entry<String, AttributeInfo> e : fields.entrySet()) { String attrName = e.getKey(); AttributeInfo i = e.getValue(); Object aVal = s.get(attrName); TypeUtils.outputVal(attrName + " : ", buf, fieldPrefix); if (aVal != null && aVal instanceof Id) { TypeUtils.outputVal(aVal.toString(), buf, ""); } else { i.dataType().output(aVal, buf, fieldPrefix, inProcess); } TypeUtils.outputVal("\n", buf, ""); } }
public void output(IReferenceableInstance s, Appendable buf, String prefix, Set<IReferenceableInstance> inProcess) throws AtlasException { if (s == null) { TypeUtils.outputVal("<null>\n", buf, ""); return; TypeUtils.outputVal("{", buf, prefix); TypeUtils.outputVal("\n", buf, ""); String fieldPrefix = prefix + "\t"; TypeUtils.outputVal("id : ", buf, fieldPrefix); TypeUtils.outputVal(s.getId().toString(), buf, ""); TypeUtils.outputVal("\n", buf, ""); TypeUtils.outputVal(sT + " : ", buf, fieldPrefix); tt.output(s.getTrait(sT), buf, fieldPrefix, null); TypeUtils.outputVal("}", buf, prefix);
@Override public void output(T val, Appendable buf, String prefix, Set<T> inProcess) throws AtlasException { final String strValue; if (val == null) { strValue = "<null>"; } else if (val instanceof Map) { ImmutableSortedMap immutableSortedMap = ImmutableSortedMap.copyOf((Map) val); strValue = immutableSortedMap.toString(); } else { strValue = val.toString(); } TypeUtils.outputVal(strValue, buf, prefix); }
@Override public void output(T val, Appendable buf, String prefix, Set<T> inProcess) throws AtlasException { final String strValue; if (val == null) { strValue = "<null>"; } else if (val instanceof Map) { ImmutableSortedMap immutableSortedMap = ImmutableSortedMap.copyOf((Map) val); strValue = immutableSortedMap.toString(); } else { strValue = val.toString(); } TypeUtils.outputVal(strValue, buf, prefix); }
public void output(IReferenceableInstance s, Appendable buf, String prefix, Set<IReferenceableInstance> inProcess) throws AtlasException { if (s == null) { TypeUtils.outputVal("<null>\n", buf, ""); return; TypeUtils.outputVal("{", buf, prefix); TypeUtils.outputVal("\n", buf, ""); String fieldPrefix = prefix + "\t"; TypeUtils.outputVal("id : ", buf, fieldPrefix); TypeUtils.outputVal(s.getId().toString(), buf, ""); TypeUtils.outputVal("\n", buf, ""); TypeUtils.outputVal(sT + " : ", buf, fieldPrefix); tt.output(s.getTrait(sT), buf, fieldPrefix, null); TypeUtils.outputVal("}", buf, prefix);