title: Why does kotlin have componentN functions in data class, if they already have getters and setters?
body: <p>There is a data class in kotlin, e.g.</p>
  
  <pre><code>@Entity
  data class Record(
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      val id: Long? = null,
      @Column(nullable = false, name = "name")
      var name: String? = null
  )
  </code></pre>
  
  <p>And I can call component1 and component2 functions to access the properties. However, as I declare the property var, I have getter and setter, and if I declare property val I have the getter. Are componentN functions are redundant in this case, and why do we need them, because getters seem to be much more self-explanatory?</p>