@Override public ServiceBindingOptions eagerLoad() { lock.check(); eagerLoad = true; return this; }
@Override public ServiceBindingOptions preventDecoration() { lock.check(); preventDecoration = true; return this; }
@Override public ServiceBindingOptions preventReloading() { lock.check(); preventReloading = true; return this; }
@Override public void addRegistryWillShutdownListener(Runnable listener) { assert listener != null; lock.check(); preListeners.add(listener); }
@Override public void addRegistryShutdownListener(Runnable listener) { assert listener != null; lock.check(); listeners.add(listener); }
public void addPageDetachedCallback(Runnable callback) { lifecycleListenersLock.check(); assert callback != null; detachCallbacks.add(callback); }
@Override public void addRegistryShutdownListener(RegistryShutdownListener listener) { lock.check(); registryShutdownHub.addRegistryShutdownListener(listener); }
@Override public void addRegistryShutdownListener(Runnable listener) { lock.check(); registryShutdownHub.addRegistryShutdownListener(listener); }
public void override(Orderable<T> orderable) { lock.check(); String id = orderable.getId(); Orderable<T> existing = idToOrderable.get(id); if (existing == null) throw new IllegalArgumentException( String.format("Override for object '%s' is invalid as it does not match an existing object.", id)); orderables.remove(existing); orderables.add(orderable); idToOrderable.put(id, orderable); }
@Override public <T> T getService(Class<T> serviceInterface, Class<? extends Annotation>... markerTypes) { lock.check(); return getServiceByTypeAndMarkers(serviceInterface, markerTypes); }
@Override public ServiceBindingOptions scope(String scope) { assert InternalUtils.isNonBlank(scope); lock.check(); this.scope = scope; return this; }
@Override public ServiceBindingOptions withMarker(Class<? extends Annotation>... marker) { lock.check(); InternalUtils.validateMarkerAnnotations(marker); markers.addAll(Arrays.asList(marker)); return this; } }
/** * Adds a {@link ModuleDef} to the registry, returning the builder for further configuration. */ public RegistryBuilder add(ModuleDef moduleDef) { lock.check(); // TODO: Some way to ensure that duplicate modules are not being added. // Part of TAPESTRY-2117 is in add(Class...) and that may be as much as we can // do as there is no concept of ModuleDef identity. modules.add(InternalUtils.toModuleDef2(moduleDef)); return this; }
@Override public void cleanupThread() { lock.check(); perthreadManager.cleanup(); }
@Override public <T> T getService(Class<T> serviceInterface) { lock.check(); return getServiceByTypeAndMarkers(serviceInterface); }
@Override public void addRegistryWillShutdownListener(Runnable listener) { lock.check(); registryShutdownHub.addRegistryWillShutdownListener(listener); }
@Override public ServiceBindingOptions withId(String id) { assert InternalUtils.isNonBlank(id); lock.check(); serviceId = id; return this; }
public void override(String id, T target, String... constraints) { lock.check(); override(new Orderable<T>(id, target, constraints)); }
@Override public <T> T getService(String serviceId, Class<T> serviceInterface) { lock.check(); T result = checkForBuiltinService(serviceId, serviceInterface); if (result != null) return result; // Checking serviceId and serviceInterface is overkill; they have been checked and rechecked // all the way to here. Module containingModule = locateModuleForService(serviceId); return containingModule.getService(serviceId, serviceInterface); }
@Override public String expandSymbols(String input) { lock.check(); // Again, a bit of work to avoid instantiating the SymbolSource until absolutely necessary. if (!InternalUtils.containsSymbols(input)) return input; return getSymbolSource().expandSymbols(input); }