@Test public void testFindBestWrapper() { assertNull("just null", AccessControlManagerFacade.findBestWrapper(null)); AccessControlManager jcrDelegate = mock(AccessControlManager.class); AccessControlManager jcrFacade = AccessControlManagerFacade.findBestWrapper(jcrDelegate); assertTrue("is facade", jcrFacade instanceof AccessControlManagerFacade); assertFalse("is not jackrabbit facade", jcrFacade instanceof JackrabbitAccessControlManagerFacade); AccessControlManager jackDelegate = mock(JackrabbitAccessControlManager.class); AccessControlManager jackFacade = AccessControlManagerFacade.findBestWrapper(jackDelegate); assertTrue("is jackrabbit facade", jackFacade instanceof JackrabbitAccessControlManagerFacade); }
public static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager) { if (manager instanceof JackrabbitAccessControlManager) { return new JackrabbitAccessControlManagerFacade((JackrabbitAccessControlManager) manager); } else if (manager != null) { return new AccessControlManagerFacade<>(manager); } else { return null; } }
AccessControlManagerFacade implements AccessControlManager { public static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager) { if (manager instanceof JackrabbitAccessControlManager) { return new JackrabbitAccessControlManagerFacade((JackrabbitAccessControlManager) manager); } else if (manager != null) { return new AccessControlManagerFacade<>(manager); } else { return null; } } }
AccessControlManagerFacade implements AccessControlManager { public static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager) { if (manager instanceof JackrabbitAccessControlManager) { return new JackrabbitAccessControlManagerFacade((JackrabbitAccessControlManager) manager); } else if (manager != null) { return new AccessControlManagerFacade<>(manager); } else { return null; } } @SuppressWarnings("WeakerAccess")  AccessControlManagerFacade(final @NotNull M delegate); }
AccessControlManagerFacade implements AccessControlManager { public static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager) { if (manager instanceof JackrabbitAccessControlManager) { return new JackrabbitAccessControlManagerFacade((JackrabbitAccessControlManager) manager); } else if (manager != null) { return new AccessControlManagerFacade<>(manager); } else { return null; } } @SuppressWarnings("WeakerAccess")  AccessControlManagerFacade(final @NotNull M delegate); static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager); @Override final Privilege[] getSupportedPrivileges(String absPath); @Override final Privilege privilegeFromName(String privilegeName); @Override final boolean hasPrivileges(String absPath, Privilege[] privileges); @Override final Privilege[] getPrivileges(String absPath); @Override final AccessControlPolicy[] getPolicies(String absPath); @Override final AccessControlPolicy[] getEffectivePolicies(String absPath); @Override final AccessControlPolicyIterator getApplicablePolicies(String absPath); @Override final void setPolicy(String absPath, AccessControlPolicy policy); @Override final void removePolicy(String absPath, AccessControlPolicy policy); }
AccessControlManagerFacade implements AccessControlManager { public static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager) { if (manager instanceof JackrabbitAccessControlManager) { return new JackrabbitAccessControlManagerFacade((JackrabbitAccessControlManager) manager); } else if (manager != null) { return new AccessControlManagerFacade<>(manager); } else { return null; } } @SuppressWarnings("WeakerAccess")  AccessControlManagerFacade(final @NotNull M delegate); static @Nullable AccessControlManager findBestWrapper(final @Nullable AccessControlManager manager); @Override final Privilege[] getSupportedPrivileges(String absPath); @Override final Privilege privilegeFromName(String privilegeName); @Override final boolean hasPrivileges(String absPath, Privilege[] privileges); @Override final Privilege[] getPrivileges(String absPath); @Override final AccessControlPolicy[] getPolicies(String absPath); @Override final AccessControlPolicy[] getEffectivePolicies(String absPath); @Override final AccessControlPolicyIterator getApplicablePolicies(String absPath); @Override final void setPolicy(String absPath, AccessControlPolicy policy); @Override final void removePolicy(String absPath, AccessControlPolicy policy);  }