Java: static abstract (again) - best practice how to work around

后端 未结 9 1107
误落风尘
误落风尘 2021-02-01 16:30

I theoretically understand the point why there is no abstract static in Java, as explained for instance in Why can't static methods be abstract in

9条回答
  •  野的像风
    2021-02-01 17:13

    You could create a FileMetadata class that has all the info you need. When your app starts up, you could create instances of FileMetadata, and keep static pointers to them so you can access them from anywhere in the JVM.

    This way you put the abstract stuff in the actual instances; anything the stuff that does not call for abstract semantics can be static...

提交回复
热议问题