/** * Assert that the provided object is an instance of the provided class. * <pre class="code">Assert.instanceOf(Foo.class, foo);</pre> * @param clazz the required class * @param obj the object to check * @throws IllegalArgumentException if the object is not an instance of clazz * @see Class#isInstance */ public static void isInstanceOf(Class clazz, Object obj) { isInstanceOf(clazz, obj, ""); }
@SuppressWarnings("unchecked") @Deprecated //remove before 1.0 - call the serializer directly protected byte[] toJson(Object object) throws SerializationException { Assert.isInstanceOf(Map.class, object, "object argument must be a map."); Map m = (Map)object; return serializer.serialize(m); } }
@Deprecated // remove before 1.0 - call the serializer and base64UrlEncoder directly protected String base64UrlEncode(Object o, String errMsg) { Assert.isInstanceOf(Map.class, o, "object argument must be a map."); Map m = (Map)o; byte[] bytes; try { bytes = toJson(m); } catch (SerializationException e) { throw new IllegalStateException(errMsg, e); } return base64UrlEncoder.encode(bytes); }
/** * Assert that the provided object is an instance of the provided class. * <pre class="code">Assert.instanceOf(Foo.class, foo);</pre> * @param clazz the required class * @param obj the object to check * @throws IllegalArgumentException if the object is not an instance of clazz * @see Class#isInstance */ public static void isInstanceOf(Class clazz, Object obj) { isInstanceOf(clazz, obj, ""); }
/** * Assert that the provided object is an instance of the provided class. * <pre class="code">Assert.instanceOf(Foo.class, foo);</pre> * @param clazz the required class * @param obj the object to check * @throws IllegalArgumentException if the object is not an instance of clazz * @see Class#isInstance */ public static void isInstanceOf(Class clazz, Object obj) { isInstanceOf(clazz, obj, ""); }
@SuppressWarnings("unchecked") @Deprecated //remove before 1.0 - call the serializer directly protected byte[] toJson(Object object) throws SerializationException { Assert.isInstanceOf(Map.class, object, "object argument must be a map."); Map m = (Map)object; return serializer.serialize(m); } }
@Deprecated // remove before 1.0 - call the serializer and base64UrlEncoder directly protected String base64UrlEncode(Object o, String errMsg) { Assert.isInstanceOf(Map.class, o, "object argument must be a map."); Map m = (Map)o; byte[] bytes; try { bytes = toJson(m); } catch (SerializationException e) { throw new IllegalStateException(errMsg, e); } return base64UrlEncoder.encode(bytes); }