でぺんでんしー[2]
なんかうまいこと Initializer が動いたので、この雰囲気で作っていこう。
public class GetTest { public static void main(String[] args) { SampleComponent obj = Freja.get(SampleComponent.class); obj.helloworld(); } } public interface SampleComponent { public void helloworld(); } @Component public class SampleComponentImpl implements SampleComponent { private String text = "[[HELLO WORLD]]"; @Override public void helloworld() { System.out.println(text); } public void setText(String text) { this.text = text; } } @Init({ "class:example.component.SampleComponentImpl" }) public class SampleInitializer implements Initializer { @Override public void init(Object obj, String name) { SampleComponentImpl component = (SampleComponentImpl) obj; component.setText("hello initializer"); } }