DeviceResource.java
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.resource.ModifiableValueMap
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.SyntheticResource
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.screens.impl.rest;
import com.adobe.cq.screens.device.Device;
import com.adobe.cq.screens.impl.rest.DeviceValueMapDecorator;
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.SyntheticResource;
import org.apache.sling.api.resource.ValueMap;
public class DeviceResource
extends SyntheticResource {
public static final String RESOURCE_TYPE = "screens/core/components/device";
private final Device device;
public DeviceResource(ResourceResolver resolver, String path, Device device) {
super(resolver, path, "screens/core/components/device");
this.device = device;
}
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
if (type == ValueMap.class || type == ModifiableValueMap.class) {
Resource profile = this.getResourceResolver().getResource(this.device.getPath() + "/" + "profile_screens");
return (AdapterType)((Object)(profile == null ? null : new DeviceValueMapDecorator(this, (ValueMap)profile.adaptTo(type))));
}
if (type == Device.class) {
return (AdapterType)this.device;
}
return (AdapterType)super.adaptTo(type);
}
}