/** * Maps the {@code baseClass} to a specific non-interface/non-abstract {@code typeClass} and registers it (this must * be done on application startup). * <p> * With this approach, there is no overhead of writing the type metadata if a {@code baseClass} field is serialized. * <p> * Returns true if the baseClass does not exist. * <p> * NOTE: This is only supported when {@link RuntimeEnv#ID_STRATEGY} is {@link DefaultIdStrategy}. * * @throws IllegalArgumentException * if the {@code typeClass} is an interface or an abstract class. */ public static <T> boolean map(Class<? super T> baseClass, Class<T> typeClass) { if (ID_STRATEGY instanceof DefaultIdStrategy) return ((DefaultIdStrategy) ID_STRATEGY).map(baseClass, typeClass); throw new RuntimeException( "RuntimeSchema.map is only supported on DefaultIdStrategy"); }
/** * Maps the {@code baseClass} to a specific non-interface/non-abstract {@code typeClass} and registers it (this must * be done on application startup). * <p> * With this approach, there is no overhead of writing the type metadata if a {@code baseClass} field is serialized. * <p> * Returns true if the baseClass does not exist. * <p> * NOTE: This is only supported when {@link RuntimeEnv#ID_STRATEGY} is {@link DefaultIdStrategy}. * * @throws IllegalArgumentException * if the {@code typeClass} is an interface or an abstract class. */ public static <T> boolean map(Class<? super T> baseClass, Class<T> typeClass) { if (ID_STRATEGY instanceof DefaultIdStrategy) return ((DefaultIdStrategy) ID_STRATEGY).map(baseClass, typeClass); throw new RuntimeException( "RuntimeSchema.map is only supported on DefaultIdStrategy"); }