How to add static section in to java class in javapoet

后端 未结 1 1785
终归单人心
终归单人心 2021-01-19 19:36

Is there a anyway to add static code block into java class using javapoet library

static {
        // whatever code is needed for initialization goes here
          


        
相关标签:
1条回答
  • 2021-01-19 20:18

    Use TypeSpec.Builder::addStaticBlock. See this test case for an example.

    0 讨论(0)
提交回复
热议问题