1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mapでプロパティを設定した場合、引数なしコンストラクタも呼ばれるっぽい。

Last updated at Posted at 2012-10-29
import groovy.transform.*
@ToString
class Item {
  int id
  String name
  int price
  
  Item(){
    println "test"
  }
}

def item = new Item([id:1,name:"drink",price:100])
println item

// test
// Item(1, drink, 100)
1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?