yuin #1467(2007/07/26 10:58 GMT) [ Scala ] Rating0/0=0.00
setAccessibleしないといけないのがなんとも。
1 2 3 4 5 6 7 8 9 10
class Foo { private def test_foo = println("test_foo_private") def test_foo2 = println("test_foo_public") protected def test_fuga = println("test_fuga") def public_foo = println("public_foo") } val foo = new Foo foo.getClass.getDeclaredMethods.filter(_.getName.startsWith("test_")) .map(x=>{x.setAccessible(true);x}).foreach(_.invoke(foo,Array()))
Rating0/0=0.00-0+
[ reply ]
yuin
#1467()
[
Scala
]
Rating0/0=0.00
class Foo { private def test_foo = println("test_foo_private") def test_foo2 = println("test_foo_public") protected def test_fuga = println("test_fuga") def public_foo = println("public_foo") } val foo = new Foo foo.getClass.getDeclaredMethods.filter(_.getName.startsWith("test_")) .map(x=>{x.setAccessible(true);x}).foreach(_.invoke(foo,Array()))Rating0/0=0.00-0+
[ reply ]