This section describes key classes which are essential while using Slice. They constitute a base for a day-to-day development.
...
Code Block |
---|
import com.cognifide.app.util.Currency; import com.cognifide.slice.api.provider.ModelProvider; import com.cognifide.slice.mapper.annotation.JcrProperty; import com.cognifide.slice.mapper.annotation.SliceResource; import com.google.inject.Inject; @SliceResource public class OrderModel { private final static String CONFIGURATION_PATH = "/content/app/configuration/jcr:content/currency"; private final ModelProvider modelProvider; @JcrProperty private int value; @Inject public OrderModel(ModelProvider modelProvider) { this.modelProvider = modelProvider; } public int getValue() { Currency currency = modelProvider.get(Currency.class, CONFIGURATION_PATH); return formatToCurrency(value, currency); } ... } |
...
@Deprecated
Few API members have been deprecated:
Deprecated | Suggestion |
---|---|
| Use one of
|
| Use Resource.listChildren() |
com.cognifide.slice.api.link.* | Whole package has been removed in Slice 4.0.0 Feel free to extract code from Slice 3.2.0 source code: https://github.com/Cognifide/Slice/tree/3.2.0 |
...