本文整理匯總了Java中com.day.cq.commons.Externalizer類的典型用法代碼示例。如果您正苦於以下問題:Java Externalizer類的具體用法?Java Externalizer怎麽用?Java Externalizer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Externalizer類屬於com.day.cq.commons包,在下文中一共展示了Externalizer類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import com.day.cq.commons.Externalizer; //導入依賴的package包/類
@BeforeClass
public static void setUp() {
CONTEXT.registerService(Externalizer.class, MockExternalizerFactory.getExternalizerService());
CONTEXT.registerService(AdapterFactory.class, new AdapterFactory() {
@Override
public <AdapterType> AdapterType getAdapter(@Nonnull Object o, @Nonnull Class<AdapterType> clazz) {
Object result = null;
switch (clazz.getName()) {
case CLASS_PRODUCT:
if (o instanceof Resource) {
result = MockCommerceFactory.getProduct((Resource) o);
}
break;
case CLASS_COMMERCE_SERVICE:
if (o instanceof Resource) {
result = MockCommerceFactory.getCommerceService((Resource) o);
}
break;
case CLASS_XF_SOCIAL_VARIATION:
if (o instanceof Page) {
result = MockXFFactory.getExperienceFragmentSocialVariation((Page) o);
}
}
return (AdapterType) result;
}
},
new HashMap<String, Object>(){{
put(AdapterFactory.ADAPTABLE_CLASSES, new String[] {
CLASS_RESOURCE,
CLASS_PAGE
});
put(AdapterFactory.ADAPTER_CLASSES, new String[] {
CLASS_PRODUCT,
CLASS_COMMERCE_SERVICE,
CLASS_XF_SOCIAL_VARIATION
});
}}
);
}
開發者ID:Adobe-Marketing-Cloud,項目名稱:aem-core-wcm-components,代碼行數:41,代碼來源:SocialMediaHelperImplTest.java
示例2: configure
import com.day.cq.commons.Externalizer; //導入依賴的package包/類
public static synchronized void configure(SlingSettingsService slingSettings) throws ConfigurationException {
runmodes = slingSettings.getRunModes();
isAuthor = runmodes.contains(Externalizer.AUTHOR);
isPublish = runmodes.contains(Externalizer.PUBLISH);
if (isAuthor && isPublish) {
throw new ConfigurationException(null,
"Either 'author' or 'publish' run modes may be specified, not both.");
}
}
示例3: getExternalizerService
import com.day.cq.commons.Externalizer; //導入依賴的package包/類
public static Externalizer getExternalizerService() {
Externalizer externalizer = mock(Externalizer.class);
when(externalizer.publishLink(any(ResourceResolver.class), anyString())).then(
invocationOnMock -> ROOT + invocationOnMock.getArgumentAt(1, String.class));
return externalizer;
}