Examples of Adaptable


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

  @Test
  public void testAdaptTo() throws ClassNotFoundException {
    log.info("testAdaptTo");

    Adaptable adaptable = SlingFunctions.getResource(resolver, TEST_PATH);
    Object adapted = SlingFunctions.adaptTo(adaptable,
        ValueMap.class.getCanonicalName());
    assertNotNull(adapted);
    assertTrue(adapted instanceof ValueMap);
View Full Code Here

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

                    final Adaptable... objects) {
        final int expectedCount = objects == null ? 0 : objects.length;
        final Iterator<Adaptable> i = spl.getProviders(ctx, null);
        int count = 0;
        while ( i.hasNext() ) {
            final Adaptable a = i.next();
            assertEquals(objects[count], a);
            count++;
        }
        assertEquals(expectedCount, count);
    }
View Full Code Here

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

     */
    public <AdapterType> AdapterType adaptTo(final ResourceResolverContext ctx, final Class<AdapterType> type) {
        final Iterator<Adaptable> i = this.adaptableProviders.getProviders(ctx, null);
        AdapterType result = null;
        while ( result == null && i.hasNext() ) {
            final Adaptable adap = i.next();
            result = adap.adaptTo(type);
        }
        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.