public static object toImmutable(object obj) { if (obj == null) { return(null); } // TODO - this isn't quite right, need to clean up with FanObj.isImmutable if (obj is Double) { return(((Double)obj).doubleValue()); } if (obj is Long) { return(((Long)obj).longValue()); } if (FanObj.isImmutable(obj)) { return(obj); } if (obj is List) { return(((List)obj).toImmutable()); } if (obj is Map) { return(((Map)obj).toImmutable()); } throw NotImmutableErr.make(FanObj.@typeof(obj).toStr()).val; }
public override object toImmutable() { if (isImmutable()) { return(this); } throw NotImmutableErr.make().val; }