PTiffRenditionAdapterFactory.java
1.7 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
43
44
45
46
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.cq.dam.dm.process.api.PTiffRendition
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.adapter.AdapterFactory
* org.apache.sling.api.resource.Resource
*/
package com.adobe.cq.dam.dm.process.image;
import com.adobe.cq.dam.dm.process.api.PTiffRendition;
import com.adobe.cq.dam.dm.process.image.PTiffRenditionImpl;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.adapter.AdapterFactory;
import org.apache.sling.api.resource.Resource;
@Component
@Service(value={AdapterFactory.class})
public class PTiffRenditionAdapterFactory
implements AdapterFactory {
private static final Class<PTiffRendition> PTIFF_RENDITION_CLASS = PTiffRendition.class;
@Property(name="adapters")
public static final String[] ADAPTER_CLASSES = new String[]{PTIFF_RENDITION_CLASS.getName()};
@Property(name="adaptables")
public static final String[] ADAPTABLE_CLASSES = new String[]{Resource.class.getName()};
public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
if (adaptable instanceof Resource) {
return this.getAdapter((Resource)adaptable, type);
}
return null;
}
private <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
if (type == PTIFF_RENDITION_CLASS) {
return (AdapterType)PTiffRenditionImpl.getPTiffRendition(resource);
}
return null;
}
}