Package org.apache.sling.api.adapter

Examples of org.apache.sling.api.adapter.AdapterManager


    public String getMimeType(String name) {
        return slingHttpContext.getMimeType(name);
    }

    public <Type> Type adaptTo(Object object, Class<Type> type) {
        AdapterManager adapterManager = this.adapterManager;
        if (adapterManager != null) {
            return adapterManager.getAdapter(object, type);
        }

        // no adapter manager, nothing to adapt to
        return null;
    }
View Full Code Here


    /**
     * Make sure adaptions are inherited from source resource, but can be overridden by superimposing resource instance.
     */
    @Test
    public void testAdaptTo() {
        SlingAdaptable.setAdapterManager(new AdapterManager() {
            @SuppressWarnings("unchecked")
            public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
                if (adaptable instanceof SuperimposingResource && type==String.class) {
                    return (AdapterType)"mystring";
                }
View Full Code Here

TOP

Related Classes of org.apache.sling.api.adapter.AdapterManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.