/// <summary> /// Copy constructor.<br> /// Initializes the components list with a deep copy of the source components list. </summary> /// <param name="source"> a field instance to copy /// @since 7.7 </param> public static Field11R newInstance(Field11R source) { Field11R cp = new Field11R(); cp.Components = new List <>(source.Components); return(cp); }
/// <summary> /// This method deserializes the JSON data into a Field11R object. </summary> /// <param name="json"> JSON structure including tuples with label and value for all field components </param> /// <returns> a new field instance with the JSON data parsed into field components or an empty field id the JSON is invalid /// @since 7.10.3 </returns> /// <seealso cref= Field#fromJson(String) </seealso> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: //ORIGINAL LINE: public static Field11R fromJson(final String json) public static Field11R fromJson(string json) { Field11R field = new Field11R(); JsonParser parser = new JsonParser(); JsonObject jsonObject = (JsonObject)parser.parse(json); if (jsonObject.get("mT") != null) { field.Component1 = jsonObject.get("mT").AsString; } if (jsonObject.get("date") != null) { field.setComponent2(jsonObject.get("date").AsString); } if (jsonObject.get("sessionNumber") != null) { field.setComponent3(jsonObject.get("sessionNumber").AsString); } if (jsonObject.get("iSN") != null) { field.setComponent4(jsonObject.get("iSN").AsString); } return(field); }
/// <summary> /// Returns a specific subset of lines from the field's value, starting at the offset component.<br> /// </summary> /// <seealso cref= MultiLineField#getLinesBetween(int start, int end, int offset) </seealso> /// <param name="start"> a reference to a specific line in the field, first line being 1 </param> /// <param name="end"> a reference to a specific line in the field, must be greater than start </param> /// <param name="offset"> an optional component number used as offset when counting lines </param> /// <returns> found lines or empty list if lines are not present or the offset is invalid /// @since 7.7 </returns> public virtual IList <string> getLinesBetween(int start, int end, int offset) { Field11R cp = newInstance(this); return(SwiftParseUtils.getLines(getLine(cp, start, end, offset))); }
/// <summary> /// Returns the field value starting at the offset component, split into lines.<br> /// </summary> /// <seealso cref= MultiLineField#getLines(int) </seealso> /// <param name="offset"> an optional component number used as offset when counting lines </param> /// <returns> found lines or empty list if lines are not present or the offset is invalid /// @since 7.7 </returns> public virtual IList <string> getLines(int offset) { Field11R cp = newInstance(this); return(SwiftParseUtils.getLines(getLine(cp, null, null, offset))); }
/// <summary> /// Returns a specific line from the field's value.<br> /// </summary> /// <seealso cref= MultiLineField#getLine(int, int) </seealso> /// <param name="line"> a reference to a specific line in the field, first line being 1 </param> /// <param name="offset"> an optional component number used as offset when counting lines </param> /// <returns> line content or null if not present or if line number is above the expected /// @since 7.7 </returns> public virtual string getLine(int line, int offset) { Field11R cp = newInstance(this); return(getLine(cp, line, null, offset)); }