1 6 7 package com.hp.hpl.jena.enhanced.test; 8 import com.hp.hpl.jena.enhanced.*; 9 import com.hp.hpl.jena.graph.*; 10 11 15 public class TestObjectImpl extends TestCommonImpl implements TestObject { 16 17 23 public static final Implementation factory = new Implementation() { 24 27 public EnhNode wrap(Node n,EnhGraph eg) { 28 return new TestObjectImpl(n,eg); 29 } 30 public boolean canWrap( Node n, EnhGraph eg ) 31 { return true; } 32 }; 33 34 35 private TestObjectImpl(Node n,EnhGraph eg) { 36 super( n, eg ); 37 } 38 39 public boolean supports( Class t ) 40 { return t.isInstance( this) && isObject(); } 41 42 public boolean isObject() { 43 return findObject() != null; 44 } 45 53 public TestSubject aSubject() { 54 if (!isObject()) 55 throw new IllegalStateException ("Node is not the object of a triple."); 56 return (TestSubject)enhGraph.getNodeAs(findObject().getSubject(),TestSubject.class); 57 } 58 } 59 60 89 90 | Popular Tags |