@@ -86,34 +86,36 @@ class Copybook(val ast: CopybookAST) extends Logging with Serializable {
8686 val ast = getFieldByName(fieldName)
8787 ast match {
8888 case s : Primitive => extractPrimitiveField(s, recordBytes, startOffset)
89- case _ => throw new IllegalStateException (s " $fieldName is not a primitive field, cannot extract it's value. " )
89+ case _ => throw new IllegalStateException (s " $fieldName is not a primitive field, cannot extract its value. " )
9090 }
9191 }
9292
9393 /**
94- * Set value of a field of the copybook record by name
94+ * Sets the value of a copybook record field specified by name.
9595 *
9696 * Nested field names can contain '.' to identify the exact field.
97- * If the field name is unique '.' is not required.
97+ * If the field name is unique, '.' is not required.
98+ *
99+ * This method modifies the record in place and does not return a value.
98100 *
99101 * @param fieldName A field name
100102 * @param recordBytes Binary encoded data of the record
101- * @param startOffset An offset where the record starts in the data (in bytes).
102- * @return The value of the field
103+ * @param value The value to set
104+ * @param startOffset An offset where the record starts in the data (in bytes)
103105 */
104- def setFieldValueByName (fieldName : String , recordBytes : Array [Byte ], value : Any , startOffset : Int = 0 ): Any = {
106+ def setFieldValueByName (fieldName : String , recordBytes : Array [Byte ], value : Any , startOffset : Int = 0 ): Unit = {
105107 val ast = getFieldByName(fieldName)
106108 ast match {
107109 case s : Primitive => setPrimitiveField(s, recordBytes, value, startOffset)
108- case _ => throw new IllegalStateException (s " $fieldName is not a primitive field, cannot set it's value. " )
110+ case _ => throw new IllegalStateException (s " $fieldName is not a primitive field, cannot set its value. " )
109111 }
110112 }
111113
112114 /**
113115 * Get the AST object of a field by name.
114116 *
115117 * Nested field names can contain '.' to identify the exact field.
116- * If the field name is unique '.' is not required.
118+ * If the field name is unique, '.' is not required.
117119 *
118120 * @param fieldName A field name
119121 * @return An AST object of the field. Throws an IllegalStateException if not found of found multiple.
0 commit comments