public class Solar {
public static Solar fromYmd(int year, int month, int day) { return new Solar(year, month, day); }
}
如上面所示,当前类中的方法返回值是当前类本身,这种方法应该如何封装。
因为静态方法暂时还没支持生成类文档、但是编译输出后的类库、当添加的项目中时;可以正常使用;只是没有智能提示。
例如以你这个类为例:
当编译输出的类库、在APP中使用时;可以直接通过类名调用其中的方法;例如:
变量 solarInstance = (Solar)Solar.fromYmd(2024,4,1)
solarInstance.方法()
这个我也找不到好的方法。