Tabnine Logo
RuntimeExceptionFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
RuntimeExceptionFactory
in
org.springframework.data.gemfire.util

Best Java code snippets using org.springframework.data.gemfire.util.RuntimeExceptionFactory (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Optional
origin: org.springframework.data/spring-data-geode

/**
 * Returns a reference to the configured {@link EvictionPolicyConfigurer} used to configure the Eviction policy
 * of a {@link Region}.
 *
 * @return a reference to the configured {@link EvictionPolicyConfigurer}.
 * @see org.springframework.data.gemfire.config.annotation.EvictionConfiguration.EvictionPolicyConfigurer
 */
protected EvictionPolicyConfigurer getEvictionPolicyConfigurer() {
  return Optional.ofNullable(this.evictionPolicyConfigurer).orElseThrow(() ->
    newIllegalStateException("EvictionPolicyConfigurer was not properly configured and initialized"));
}
origin: org.springframework.data/spring-data-gemfire

/**
 * @inheritDoc
 */
@Override
public <T> Page<T> query(String query, String defaultField, int resultLimit, int pageSize,
    Class<T> projectionType) {
  throw newUnsupportedOperationException(RuntimeExceptionFactory.NOT_IMPLEMENTED);
}
origin: org.springframework.data/spring-data-geode

/**
 * Constructs and initializes an {@link RuntimeException} with the given {@link Throwable cause},
 * {@link String message} and {@link Object arguments} used to format the message.
 *
 * @param cause {@link Throwable} identifying the reason the {@link RuntimeException} was thrown.
 * @param message {@link String} describing the {@link RuntimeException exception}.
 * @param args {@link Object arguments} used to replace format placeholders in the {@link String message}.
 * @return a new {@link RuntimeException} with the given {@link Throwable cause} and {@link String message}.
 * @see java.lang.RuntimeException
 */
public static RuntimeException newRuntimeException(Throwable cause, String message, Object... args) {
  return new RuntimeException(format(message, args), cause);
}
origin: org.springframework.data/spring-data-geode

/**
 * Constructs a new instance of {@link SchemaObjectDefinition} initialized with the specified {@link String name}.
 *
 * @param name {@link String name} given to the GemFire/Geode schema object; must not be {@literal null}.
 * @throws IllegalArgumentException if name is not specified.
 */
public SchemaObjectDefinition(String name) {
  this.name = Optional.ofNullable(name).filter(StringUtils::hasText)
    .orElseThrow(() -> newIllegalArgumentException("Name [%s] is required", name));
}
origin: org.springframework.data/spring-data-gemfire

QueryService resolveQueryService() {
  return Optional.ofNullable(this.queryService)
    .orElseGet(() -> Optional.ofNullable(lookupQueryService())
      .orElseThrow(() -> newIllegalStateException("QueryService is required to create an Index")));
}
origin: org.springframework.data/spring-data-gemfire

Optional.<GemFireCache>ofNullable(getCache()).ifPresent(cache -> {
  Optional.ofNullable(cache.getDistributedSystem())
    .map(DistributedSystem::getDistributedMember)
    .ifPresent(member ->
throw newRuntimeException(cause, "Error occurred when initializing peer cache");
origin: org.springframework.data/spring-data-gemfire

/**
 * Loads the configured data {@link Resource snapshot} into the given {@link Region}.
 *
 * @param region {@link Region} to load.
 * @return the given {@link Region}.
 * @throws RuntimeException if the snapshot load fails.
 * @see org.apache.geode.cache.Region#loadSnapshot(InputStream)
 */
protected Region<K, V> loadSnapshot(Region<K, V> region) {
  Optional.ofNullable(this.snapshot).ifPresent(snapshot -> {
    try {
      region.loadSnapshot(snapshot.getInputStream());
    }
    catch (Exception cause) {
      throw newRuntimeException(cause, "Failed to load snapshot [%s]", snapshot);
    }
  });
  return region;
}
origin: org.springframework.data/spring-data-gemfire

protected String getIndexName() {
  return Optional.ofNullable(this.indexName).filter(StringUtils::hasText).orElseThrow(() ->
    newIllegalStateException("Index name is required"));
}
origin: org.springframework.data/spring-data-gemfire

/**
 * Sets a reference to the Pivotal GemFire Cache for which the snapshot will be taken.
 *
 * @param cache the Pivotal GemFire Cache used to create an instance of CacheSnapshotService.
 * @throws IllegalArgumentException if the Cache reference is null.
 * @see org.apache.geode.cache.Cache
 * @see #getCache()
 */
public void setCache(Cache cache) {
  this.cache = Optional.ofNullable(cache)
    .orElseThrow(() -> newIllegalArgumentException("Cache must not be null"));
}
origin: org.springframework.data/spring-data-geode

private static Object constructInstance(Class<?> type, Object... constructorArguments) {
  return org.springframework.data.util.ReflectionUtils.findConstructor(type, constructorArguments)
    .map(constructor -> BeanUtils.instantiateClass(constructor, constructorArguments))
    .orElseThrow(() -> newIllegalArgumentException(
      "No suitable constructor was found for type [%s] having parameters [%s]", type.getName(),
      stream(nullSafeArray(constructorArguments, Object.class))
        .map(ObjectUtils::nullSafeClassName)
        .collect(Collectors.toList())));
}
origin: org.springframework.data/spring-data-geode

  public static void close(boolean throwOnError, Consumer<String> logger) {
    get().ifPresent(connection -> {
      try {
        connection.close();
      }
      catch (ResourceException cause) {
        String message = String.format("Failed to close GemFire Connection: %s", cause.getMessage());
        if (throwOnError) {
          throw newRuntimeException(cause, message);
        }
        else {
          logger.accept(message);
        }
      }
    });
  }
}
origin: org.springframework.data/spring-data-gemfire

public static Component valueOfName(String name) {
  return Arrays.stream(values())
    .filter(component -> component.name().equalsIgnoreCase(String.valueOf(name).trim()))
    .findFirst()
    .orElseThrow(() -> newIllegalArgumentException("Name [%s] is not a valid component", name));
}
origin: org.springframework.data/spring-data-gemfire

  @Override
  public TypeFilter getFilter(String expression, ClassLoader classLoader) throws ClassNotFoundException {
    Class<?> filterClass = classLoader.loadClass(expression);
    if (!TypeFilter.class.isAssignableFrom(filterClass)) {
      throw newIllegalArgumentException("Class is not assignable to [%s]: %s",
        TypeFilter.class.getName(), expression);
    }
    return (TypeFilter) BeanUtils.instantiateClass(filterClass);
  }
};
origin: org.springframework.data/spring-data-geode

/**
 * Constructs and initializes an {@link RuntimeException} with the given {@link String message}
 * and {@link Object arguments} used to format the message.
 *
 * @param message {@link String} describing the {@link RuntimeException exception}.
 * @param args {@link Object arguments} used to replace format placeholders in the {@link String message}.
 * @return a new {@link RuntimeException} with the given {@link String message}.
 * @see #newRuntimeException(Throwable, String, Object...)
 * @see java.lang.RuntimeException
 */
public static RuntimeException newRuntimeException(String message, Object... args) {
  return newRuntimeException(null, message, args);
}
origin: org.springframework.data/spring-data-gemfire

public IndexDefinition having(String expression) {
  this.expression = Optional.ofNullable(expression).filter(StringUtils::hasText)
    .orElseThrow(() -> newIllegalArgumentException("Expression is required"));
  return this;
}
origin: org.springframework.data/spring-data-geode

RegionService resolveCache() {
  return Optional.ofNullable(this.cache)
    .orElseGet(() -> Optional.ofNullable(GemfireUtils.resolveGemFireCache())
      .orElseThrow(() -> newIllegalStateException("Cache is required")));
}
origin: org.springframework.data/spring-data-geode

Optional.<GemFireCache>ofNullable(getCache()).ifPresent(cache -> {
  Optional.ofNullable(cache.getDistributedSystem())
    .map(DistributedSystem::getDistributedMember)
    .ifPresent(member ->
throw newRuntimeException(cause, "Error occurred when initializing peer cache");
origin: org.springframework.data/spring-data-geode

/**
 * Loads the configured data {@link Resource snapshot} into the given {@link Region}.
 *
 * @param region {@link Region} to load.
 * @return the given {@link Region}.
 * @throws RuntimeException if the snapshot load fails.
 * @see org.apache.geode.cache.Region#loadSnapshot(InputStream)
 */
protected Region<K, V> loadSnapshot(Region<K, V> region) {
  Optional.ofNullable(this.snapshot).ifPresent(snapshot -> {
    try {
      region.loadSnapshot(snapshot.getInputStream());
    }
    catch (Exception cause) {
      throw newRuntimeException(cause, "Failed to load snapshot [%s]", snapshot);
    }
  });
  return region;
}
origin: org.springframework.data/spring-data-gemfire

private static Object constructInstance(Class<?> type, Object... constructorArguments) {
  return org.springframework.data.util.ReflectionUtils.findConstructor(type, constructorArguments)
    .map(constructor -> BeanUtils.instantiateClass(constructor, constructorArguments))
    .orElseThrow(() -> newIllegalArgumentException(
      "No suitable constructor was found for type [%s] having parameters [%s]", type.getName(),
      stream(nullSafeArray(constructorArguments, Object.class))
        .map(ObjectUtils::nullSafeClassName)
        .collect(Collectors.toList())));
}
origin: org.springframework.data/spring-data-gemfire

  public static void close(boolean throwOnError, Consumer<String> logger) {
    get().ifPresent(connection -> {
      try {
        connection.close();
      }
      catch (ResourceException cause) {
        String message = String.format("Failed to close Pivotal GemFire Connection: %s", cause.getMessage());
        if (throwOnError) {
          throw newRuntimeException(cause, message);
        }
        else {
          logger.accept(message);
        }
      }
    });
  }
}
org.springframework.data.gemfire.utilRuntimeExceptionFactory

Javadoc

The RuntimeExceptionFactory class is a factory for creating common RuntimeExceptionwith the added convenience of message formatting and optional Throwable.

Most used methods

  • newIllegalStateException
    Constructs and initializes an IllegalStateException with the given Throwable, String and Object used
  • newIllegalArgumentException
    Constructs and initializes an IllegalArgumentException with the given Throwable, String and Object u
  • newUnsupportedOperationException
    Constructs and initializes an UnsupportedOperationException with the given Throwable, String and Obj
  • format
    Formats the given String using the given Object.
  • newRuntimeException
    Constructs and initializes an RuntimeException with the given Throwable, String and Object used to f

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now