Skip to content

Instantly share code, notes, and snippets.

@theopendle
Created June 21, 2020 15:15
Show Gist options
  • Select an option

  • Save theopendle/d9b0c4bd3bfdde9f59c2834cbdc76143 to your computer and use it in GitHub Desktop.

Select an option

Save theopendle/d9b0c4bd3bfdde9f59c2834cbdc76143 to your computer and use it in GitHub Desktop.
@Model(
adaptables = Resource.class,
adapters = DemoModel.class,
resourceType = DemoModelImpl.RESOURCE_TYPE,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL
)
public class DemoModelImpl implements DemoModel {
public static final String RESOURCE_TYPE = "demo/components/content/demo";
@Inject
private String textInjected;
@Inject
@Named("text")
private String textInjectedNamed;
@ValueMapValue
private String textMapValue;
@ValueMapValue(name = "text")
private String textMapValueName;
@ValueMapValue
@Named("text")
private String textMapValueNamed;
@Getter
private String output;
@PostConstruct
protected void init() {
output = "textInjected: " + textInjected
+ "\ntextInjectedNamed: " + textInjectedNamed
+ "\ntextMapValue: " + textMapValue
+ "\ntextMapValueName: " + textMapValueName
+ "\ntextMapValueNamed: " + textMapValueNamed;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment