Skip to content

Instantly share code, notes, and snippets.

@odaBio
Created October 23, 2021 19:58
Show Gist options
  • Select an option

  • Save odaBio/5087321aec7016564383b0c44ee8ab1e to your computer and use it in GitHub Desktop.

Select an option

Save odaBio/5087321aec7016564383b0c44ee8ab1e to your computer and use it in GitHub Desktop.
package com.biomerieux.adobe.core.models.impl;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import com.biomerieux.adobe.core.models.OptionItem;
public class OptionItemImpl implements OptionItem {
private static final String PN_TEXT = "text";
private static final String PN_VALUE = "value";
private static final String PN_URL = "url";
private static final String PN_TITLE = "title";
private SlingHttpServletRequest request;
private Resource options;
private ValueMap properties;
public OptionItemImpl(SlingHttpServletRequest request, Resource options, Resource option) {
this.request = request;
this.options = options;
this.properties = option.getValueMap();
}
@Override
public String getText() {
return properties.get(PN_TEXT, String.class);
}
@Override
public String getValue() {
return properties.get(PN_VALUE, String.class);
}
@Override
public String getTitle() {
return properties.get(PN_TITLE, String.class);
}
@Override
public String getUrl() {
return properties.get(PN_URL, String.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment