@Override public ImmutableMap<?, ?> convert(Object val, Multiplicity m) throws AtlasException { if (val != null) { Iterator<Map.Entry> it = null; if (Map.class.isAssignableFrom(val.getClass())) { it = ((Map) val).entrySet().iterator(); ImmutableMap.Builder b = ImmutableMap.builder(); while (it.hasNext()) { Map.Entry e = it.next(); b.put(keyType.convert(e.getKey(), TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED), valueType.convert(e.getValue(), Multiplicity.OPTIONAL)); } return b.build(); } else { throw new ValueConversionException(this, val); } } if (!m.nullAllowed()) { throw new ValueConversionException.NullConversionException(m); } return null; }
@Override public ImmutableMap<?, ?> convert(Object val, Multiplicity m) throws AtlasException { if (val != null) { Iterator<Map.Entry> it = null; if (Map.class.isAssignableFrom(val.getClass())) { it = ((Map) val).entrySet().iterator(); ImmutableMap.Builder b = ImmutableMap.builder(); while (it.hasNext()) { Map.Entry e = it.next(); b.put(keyType.convert(e.getKey(), TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED), valueType.convert(e.getValue(), Multiplicity.OPTIONAL)); } return b.build(); } else { throw new ValueConversionException(this, val); } } if (!m.nullAllowed()) { throw new ValueConversionException.NullConversionException(m); } return null; }
ImmutableCollection.Builder b = m.isUnique ? ImmutableSet.builder() : ImmutableList.builder(); while (it.hasNext()) { b.add(elemType.convert(it.next(), TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED)); } else { try { return ImmutableList.of(elemType.convert(val, TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED));
ImmutableCollection.Builder b = m.isUnique ? ImmutableSet.builder() : ImmutableList.builder(); while (it.hasNext()) { b.add(elemType.convert(it.next(), TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED)); } else { try { return ImmutableList.of(elemType.convert(val, TypeSystem.getInstance().allowNullsInCollections() ? Multiplicity.OPTIONAL : Multiplicity.REQUIRED));
} else { try { cVal = i.dataType().convert(val, i.multiplicity); } catch(ValueConversionException.NullConversionException e) { throw new ValueConversionException.NullConversionException("For field '" + attrName + "'", e);
} else { try { cVal = i.dataType().convert(val, i.multiplicity); } catch(ValueConversionException.NullConversionException e) { throw new ValueConversionException.NullConversionException("For field '" + attrName + "'", e);