Literals { public static boolean canCreateLiteral(Object object) { if (object == null) { return false; } if (object instanceof Boolean || object instanceof Byte || object instanceof Double || object instanceof Float || object instanceof Integer || object instanceof Long || object instanceof Short || object instanceof XMLGregorianCalendar || object instanceof Date || object instanceof String) { return true; } return false; } protected  Literals(); static String getLabel(Literal l, String fallback); static String getLabel(Value v, String fallback); static String getLabel(Optional v, String fallback); static byte getByteValue(Literal l, byte fallback); static byte getByteValue(Value v, byte fallback); static short getShortValue(Literal l, short fallback); static short getShortValue(Value v, short fallback); static int getIntValue(Literal l, int fallback); static int getIntValue(Value v, int fallback); static long getLongValue(Literal l, long fallback); static long getLongValue(Value v, long fallback); static BigInteger getIntegerValue(Literal l, BigInteger fallback); static BigInteger getIntegerValue(Value v, BigInteger fallback); static BigDecimal getDecimalValue(Literal l, BigDecimal fallback); static BigDecimal getDecimalValue(Value v, BigDecimal fallback); static float getFloatValue(Literal l, float fallback); static float getFloatValue(Value v, float fallback); static double getDoubleValue(Literal l, double fallback); static double getDoubleValue(Value v, double fallback); static boolean getBooleanValue(Literal l, boolean fallback); static boolean getBooleanValue(Value v, boolean fallback); static XMLGregorianCalendar getCalendarValue(Literal l, XMLGregorianCalendar fallback); static Duration getDurationValue(Literal l, Duration fallback); static XMLGregorianCalendar getCalendarValue(Value v, XMLGregorianCalendar fallback); static Literal createLiteral(ValueFactory valueFactory, Object object); static Literal createLiteralOrFail(ValueFactory valueFactory, Object object); static boolean canCreateLiteral(Object object); static boolean isLanguageLiteral(Literal literal); static String normalizeLanguageTag(String languageTag); static boolean isValidLanguageTag(String languageTag); static boolean langMatches(String langTag, String langRange);  }
@Test public void testCanCreateLiteralObjectNull() throws Exception { Object obj = null; assertFalse(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectBoolean() throws Exception { Object obj = Boolean.TRUE; assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectByte() throws Exception { Object obj = new Integer(42).byteValue(); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectDouble() throws Exception { Object obj = new Double(42); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectFloat() throws Exception { Object obj = new Float(42); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectInteger() throws Exception { Object obj = new Integer(4); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectLong() throws Exception { Object obj = new Long(42); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectShort() throws Exception { Object obj = Short.parseShort("42"); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectXMLGregorianCalendar() throws Exception { GregorianCalendar c = new GregorianCalendar(); c.setTime(new Date()); Object obj = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectDate() throws Exception { Object obj = new Date(); assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectString() throws Exception { Object obj = "random unique string"; assertTrue(Literals.canCreateLiteral(obj)); }
@Test public void testCanCreateLiteralObjectObject() throws Exception { Object obj = new Object(); assertFalse(Literals.canCreateLiteral(obj)); }