Resource { @NonNull protected Resource[] getAsArray() { try { return (Resource[]) value; } catch (ClassCastException e) { return new Resource[] {}; } } Resource(Boolean value);  Resource(Number value);  Resource(String value);  Resource(Resource[] value); boolean isBoolean(); boolean isNumber(); boolean isString(); boolean isArray(); boolean getAsBoolean(); @Nullable String getAsString(); @Nullable Float getAsFloat(); @Nullable Integer getAsInt(); int[] getAsIntegerArray(); @NonNull String[] getAsStringArray();  }
@Test public void testGetAsArray() throws Exception { assertEquals(RESOURCE_BOOLEAN.getAsArray().length, 0); assertEquals( new Resource(new Resource[] { RESOURCE_INTEGER, RESOURCE_FLOAT }).getAsArray().length, 2); }