Class SafeCast

java.lang.Object
com.illumon.iris.db.v2.routing.SafeCast

public class SafeCast
extends Object
  • Constructor Details

  • Method Details

    • toMap

      public static Map<Object,​Object> toMap​(@Nullable Object o, @NotNull String context)
      Cast the object to a Map if possible, or throw a DataRoutingConfigurationException
      Parameters:
      o - the object to cast
      context - context for any exceptions (context is not a Map...)
      Returns:
      o cast to a Map
    • toList

      public static List<?> toList​(@Nullable Object o, @NotNull String context)
      Cast the object to a List if possible, or throw a DataRoutingConfigurationException
      Parameters:
      o - the object to cast
      context - context for any exceptions (context is not a List...)
      Returns:
      o cast to a List