@Test public void testAbstractTypes() throws IOException, LyoModelException { final Model expectedModel = RDFHelper.loadResourceModel("abstract-types.ttl"); final Person person = JenaModelHelper.unmarshalSingle(expectedModel, Person.class); assertNotNull(person); assertNotNull(person.getPet()); assertEquals(Dog.class, person.getPet().getClass()); }
public static <T> T unmarshalSingle(final Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException { final T[] ts = unmarshal(model, clazz); if (ts.length != 1) { throw new IllegalArgumentException("Model shall contain exactly 1 instance of the " + "class"); } return ts[0]; }
JenaModelHelper { public static <T> T unmarshalSingle(final Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException { final T[] ts = unmarshal(model, clazz); if (ts.length != 1) { throw new IllegalArgumentException("Model shall contain exactly 1 instance of the " + "class"); } return ts[0]; } }
JenaModelHelper { public static <T> T unmarshalSingle(final Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException { final T[] ts = unmarshal(model, clazz); if (ts.length != 1) { throw new IllegalArgumentException("Model shall contain exactly 1 instance of the " + "class"); } return ts[0]; } private  JenaModelHelper(); }
JenaModelHelper { public static <T> T unmarshalSingle(final Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException { final T[] ts = unmarshal(model, clazz); if (ts.length != 1) { throw new IllegalArgumentException("Model shall contain exactly 1 instance of the " + "class"); } return ts[0]; } private  JenaModelHelper(); static Model createJenaModel(final Object[] objects); static T unmarshalSingle(final Model model, Class<T> clazz); @SuppressWarnings({"unchecked", "deprecation"}) static T unmarshal(final Resource resource, Class<T> clazz); @Deprecated static Object fromJenaResource(final Resource resource, Class<?> beanClass); @SuppressWarnings({"unchecked", "deprecation"}) static T[] unmarshal(final Model model, Class<T> clazz); @Deprecated static Object[] fromJenaModel(final Model model, final Class<?> beanClass); static R followLink(final Model m, final Link l,
                                                     final Class<R> rClass); static void skolemize(final Model m); static void skolemize(final Model m, Function<BlankNodeId, String> skolemUriFunction); }
JenaModelHelper { public static <T> T unmarshalSingle(final Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException { final T[] ts = unmarshal(model, clazz); if (ts.length != 1) { throw new IllegalArgumentException("Model shall contain exactly 1 instance of the " + "class"); } return ts[0]; } private  JenaModelHelper(); static Model createJenaModel(final Object[] objects); static T unmarshalSingle(final Model model, Class<T> clazz); @SuppressWarnings({"unchecked", "deprecation"}) static T unmarshal(final Resource resource, Class<T> clazz); @Deprecated static Object fromJenaResource(final Resource resource, Class<?> beanClass); @SuppressWarnings({"unchecked", "deprecation"}) static T[] unmarshal(final Model model, Class<T> clazz); @Deprecated static Object[] fromJenaModel(final Model model, final Class<?> beanClass); static R followLink(final Model m, final Link l,
                                                     final Class<R> rClass); static void skolemize(final Model m); static void skolemize(final Model m, Function<BlankNodeId, String> skolemUriFunction);  }