/** * A Tapestry module that is started for every specification which uses Spock's * Tapestry extension. * * @author Peter Niederwieser */ @Marker(SpockTapestry.class) public class ExtensionModule { public static ObjectLocator build(ObjectLocator locator) { return locator; } }
private Collection<Class> extractServiceDefMarkers(Method method) { Marker annotation = method.getAnnotation(Marker.class); if (annotation == null) return Collections.emptyList(); return CollectionFactory.newList(annotation.value()); }
private Collection<Class> extractServiceDefMarkers(Method method) { Marker annotation = method.getAnnotation(Marker.class); if (annotation == null) return Collections.emptyList(); return CollectionFactory.newList(annotation.value()); }
/** * Exposes the public portion of the internal {@link InternalComponentInvalidationEventHub} service. * * @since 5.1.0.0 */ @Marker(ComponentClasses.class) public static InvalidationEventHub buildComponentClassesInvalidationEventHub( InternalComponentInvalidationEventHub trueHub) { return trueHub; }
@Override public <T> ServiceBindingOptions bind(Class<T> serviceInterface, Class<? extends T> serviceImplementation) { assert serviceInterface != null; assert serviceImplementation != null; lock.check(); flush(); this.serviceInterface = serviceInterface; this.serviceImplementation = serviceImplementation; // Set defaults for the other properties. eagerLoad = serviceImplementation.getAnnotation(EagerLoad.class) != null; serviceId = InternalUtils.getServiceId(serviceImplementation); if (serviceId == null) { serviceId = serviceInterface.getSimpleName(); } Scope scope = serviceImplementation.getAnnotation(Scope.class); this.scope = scope != null ? scope.value() : ScopeConstants.DEFAULT; Marker marker = serviceImplementation.getAnnotation(Marker.class); if (marker != null) { InternalUtils.validateMarkerAnnotations(marker.value()); markers.addAll(Arrays.asList(marker.value())); } preventDecoration |= serviceImplementation.getAnnotation(PreventServiceDecoration.class) != null; return this; }
/** * A Tapestry module that is started for every specification which uses Spock's * Tapestry extension. * * @author Peter Niederwieser */ @Marker(SpockTapestry.class) public class ExtensionModule { public static ObjectLocator build(ObjectLocator locator) { return locator; } }
@Override public <T> ServiceBindingOptions bind(Class<T> serviceInterface, Class<? extends T> serviceImplementation) { assert serviceInterface != null; assert serviceImplementation != null; lock.check(); flush(); this.serviceInterface = serviceInterface; this.serviceImplementation = serviceImplementation; // Set defaults for the other properties. eagerLoad = serviceImplementation.getAnnotation(EagerLoad.class) != null; serviceId = InternalUtils.getServiceId(serviceImplementation); if (serviceId == null) { serviceId = serviceInterface.getSimpleName(); } Scope scope = serviceImplementation.getAnnotation(Scope.class); this.scope = scope != null ? scope.value() : ScopeConstants.DEFAULT; Marker marker = serviceImplementation.getAnnotation(Marker.class); if (marker != null) { InternalUtils.validateMarkerAnnotations(marker.value()); markers.addAll(Arrays.asList(marker.value())); } preventDecoration |= serviceImplementation.getAnnotation(PreventServiceDecoration.class) != null; return this; }
/** * Implementation that delegates, via its configuration, to a real implementation based on the content type of the * resource. */ @Marker(Primary.class) public class MasterResourceMinimizer implements ResourceMinimizer { private final Map<String, ResourceMinimizer> configuration; public MasterResourceMinimizer(Map<String, ResourceMinimizer> configuration) { this.configuration = configuration; } /** Does nothing; an override of this service can be installed to provide minimization. */ public StreamableResource minimize(StreamableResource resource) throws IOException { ResourceMinimizer minimizer = configuration.get(resource.getContentType().getMimeType()); return minimizer == null ? resource : minimizer.minimize(resource); } }
@Marker({Traditional.class, ComponentInstanceProcessor.class}) public class ComponentInstanceResultProcessor implements ComponentEventResultProcessor<Component> { private final Logger logger; private final ComponentEventResultProcessor resultProcessor; public ComponentInstanceResultProcessor(Logger logger, @Traditional @Primary ComponentEventResultProcessor resultProcessor) { this.logger = logger; this.resultProcessor = resultProcessor; } public void processResultValue(Component value) throws IOException { ComponentResources resources = value.getComponentResources(); if (resources.getContainer() != null) { logger.warn("Component {} was returned from an event handler method, but is not a page component. The page containing the component will render the client response.", value.getComponentResources().getCompleteId()); } resultProcessor.processResultValue(resources.getPageName()); } }
/** * @since 5.3 */ @Marker(Core.class) public class PageLoadModule { public static void bind(ServiceBinder binder) { binder.bind(ComponentRequestSelectorAnalyzer.class, DefaultComponentRequestSelectorAnalyzer.class); binder.bind(ComponentResourceLocator.class, DefaultComponentResourceLocator.class); binder.bind(ComponentTemplateSource.class, ComponentTemplateSourceImpl.class); binder.bind(PagePreloader.class, PagePreloaderImpl.class); } @Startup public static void preloadPages(PagePreloader preloader, @Symbol(SymbolConstants.PRELOADER_MODE) PreloaderMode mode, @Symbol(SymbolConstants.PRODUCTION_MODE) boolean productionMode) { if (mode.isEnabledFor(productionMode)) { preloader.preloadPages(); } } }
/** * Generates Assets for files on the classpath. * * @see AssetDispatcher */ @Marker(ClasspathProvider.class) public class ClasspathAssetFactory extends AbstractAssetFactory { private final ClasspathAssetAliasManager aliasManager; public ClasspathAssetFactory(ResponseCompressionAnalyzer compressionAnalyzer, ResourceChangeTracker resourceChangeTracker, StreamableResourceSource streamableResourceSource, AssetPathConstructor assetPathConstructor, ClasspathAssetAliasManager aliasManager) { super(compressionAnalyzer, resourceChangeTracker, streamableResourceSource, assetPathConstructor, new ClasspathResource("")); this.aliasManager = aliasManager; } public Asset createAsset(Resource resource) { AssetAlias alias = aliasManager.extractAssetAlias(resource); return createAsset(resource, alias.virtualFolder, alias.path); } }
@Marker(HibernateCore.class) public class HibernateCoreModule
@Marker(Core.class) public class InternalModule
/** * Returns a {@link PlasticProxyFactory} that can be used to create extra classes around component classes. This * factory will be cleared whenever an underlying component class is discovered to have changed. Use of this * factory implies that your code will become aware of this (if necessary) to discard any cached object (alas, * this currently involves dipping into the internals side to register for the correct notifications). Failure to * properly clean up can result in really nasty PermGen space memory leaks. */ @Marker(ComponentLayer.class) public PlasticProxyFactory buildComponentProxyFactory(ComponentInstantiatorSource source) { return shadowBuilder.build(source, "proxyFactory", PlasticProxyFactory.class); }
/** * Builds {@link PageRenderLinkTransformer} service as a chain of command. * * @since 5.2.0 */ @Marker(Primary.class) public PageRenderLinkTransformer buildPageRenderLinkTransformer(List<PageRenderLinkTransformer> configuration) { return chainBuilder.build(PageRenderLinkTransformer.class, configuration); }
@Marker(BlueMarker.class) public NameListHolder buildGreek(final List<String> configuration) { return new NameListHolder() { @Override public List<String> getNames() { return configuration; } }; }
@Marker(BlueMarker.class) public Runnable build(final List<String> configuration) { return new Runnable() { @Override public void run() { } }; }
@Marker(GreenMarker.class) public Greeter buildGreenGreeter() { return new Greeter() { @Override public String getGreeting() { return "Green"; } }; }