public ConstantFactoryBean(T value) { checkArgument(value != null, "value cannot be null"); this.value = value; }
public HttpListenerBuilder setListenerConfig(HttpListenerConfig httpListenerConfig) { Preconditions.checkState(tlsContextFactory == null, "You cannot configure a listener config if you provided a tls context factory"); this.httpListenerConfig = httpListenerConfig; return this; }
/** * @param port port to use for the listener * @return the builder */ public HttpListenerBuilder setPort(final int port) { Preconditions.checkArgument(port > 0 && port < MAXIMUM_PORT_NUMBER, "Port number out of range"); Preconditions.checkState(httpListenerConfig == null, "Listener config already specified. A port cannot be specified since the one in the listener config will be used"); Preconditions.checkState(this.port == null, "Port already specified"); this.port = port; return this; }
private void validate(Extension extension, XmlCapability xmlCapability) { checkArgument(extension != null, "extension cannot be null"); checkArgument(xmlCapability != null, "capability cannot be null"); checkState(!StringUtils.isBlank(xmlCapability.getNamespace()), "capability cannot provide a blank namespace"); }
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { checkArgument(beanFactory instanceof BeanDefinitionRegistry, "this bootstrap class only accepts BeanFactory instances which implement " + BeanDefinitionRegistry.class); beanDefinitionRegistry = (BeanDefinitionRegistry) beanFactory; }
/** * @param host host to use for the listener * @return the builder */ public HttpListenerBuilder setHost(final String host) { Preconditions.checkState(httpListenerConfig == null, "You already set a listener config. You cannot specify the host"); Preconditions.checkState(this.host == null, "You already specify a host"); this.host = host; return this; }
public ResourceKey(Object resourceFactory) { Preconditions.checkArgument(resourceFactory != null, "resourceFactory cannot be null"); this.resourceFactory = resourceFactory; this.resource = null; }
private void checkNotInitialised() { Preconditions.checkState(initialised == false, "<scatter-gather> router is not dynamic. Cannot modify routes after initialisation"); }
public HttpRequestCacheKey(final String url, final OptionsType operationOptions, final MessageExchangePattern exchangePattern) { Preconditions.checkArgument(url != null, "URL cannot be null"); Preconditions.checkArgument(operationOptions != null, "Operation options cannot be null"); Preconditions.checkArgument(exchangePattern != null, "Exchange pattern cannot be null"); this.url = url; this.operationOptions = operationOptions; this.exchangePattern = exchangePattern; }
/** * @param path sets the path in which the listener will be listening. Follows http:listener path attribute pattern matching. * @return the builder */ public HttpListenerBuilder setPath(String path) { Preconditions.checkState(this.path == null, "You already specify a path"); this.path = path; return this; }
public void setStartDelay(long startDelay) { checkArgument(startDelay >= 0, "Start delay must be greater then zero"); this.startDelay = startDelay; }
protected void validate() { if (dataSource != null) { Preconditions.checkState(connectionProperties.isEmpty(), "connection-properties cannot be specified when a DataSource was provided"); } }
/** * Creates a new instance * * @param muleContext the MuleContext for the current Mule artifact. Non null */ public AsynchronousUntilSuccessfulProcessingStrategy(MuleContext muleContext) { checkArgument(muleContext != null, "muleContext cannot be null"); this.muleContext = muleContext; }
public StartElement currentScope() { Preconditions.checkState(scope.size() > 0, "No scope available"); return scope.get(scope.size() - 1); }
public RegistryDelegatingInjector(RegistryProvider registryProvider) { checkArgument(registryProvider != null, "registryProvider cannot be null"); this.registryProvider = registryProvider; }
static Extension getExtension(Class<?> extensionType) { Extension extension = extensionType.getAnnotation(Extension.class); checkState(extension != null, String.format("%s is not a Mule extension since it's not annotated with %s", extensionType.getName(), Extension.class.getName())); return extension; }
public ClientConnection(InetSocketAddress remoteHostAddress) { Preconditions.checkArgument(remoteHostAddress != null, "remoteHostAddress cannot be null."); this.remoteHostAddress = remoteHostAddress; this.sslSession = null; }
/** * @param tlsContextFactory TLS configuration to use to set up the listener. * @return the builder. */ public HttpListenerBuilder setTlsContextFactory(final TlsContextFactory tlsContextFactory) { Preconditions.checkState(httpListenerConfig == null, "You already set a listener config. You cannot specify a tls context factory"); Preconditions.checkState(protocol == null || protocol.equalsIgnoreCase(HTTPS.getScheme()), "You cannot set a tls context factory with protocol http"); this.tlsContextFactory = tlsContextFactory; this.protocol = HTTPS.getScheme(); return this; }
/** * @param sslSession the SSL session * @param remoteHostAddress */ public ClientConnection(SSLSession sslSession, InetSocketAddress remoteHostAddress) { Preconditions.checkArgument(sslSession != null, "sslSession cannot be null."); Preconditions.checkArgument(remoteHostAddress != null, "remoteHostAddress cannot be null."); this.sslSession = sslSession; this.remoteHostAddress = remoteHostAddress; }
/** * Attempts to get a hold on a {@link ExtensionManager} * instance * * @throws java.lang.IllegalStateException if no extension manager could be found */ @Override public void init() { extensionManager = MuleArtifactContext.getCurrentMuleContext().get().getExtensionManager(); checkState(extensionManager != null, "Could not obtain the ExtensionManager"); }