Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Python では、実行時に、現在スコープ内にある変数名のリストをdir()で取得できます。Groovyで同じことを行う方法はありますか?
dir(someobject)を使用してオブジェクトを検査することもできますが、それはこの質問の目的ではありません。その機能はすでにここで説明されています。
Groovyスクリプト内で、バインディングを検査できます。
binding.variables.each{ println it.key println it.value }
Python の に直接相当するものはありませんdir。ただし、スコープ内にある変数を見つけるために使用できる手法が少なくとも1 つあります。
dir