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 TestPropertyImpl extends TestCommonImpl implements TestProperty { 16 17 public static final Implementation factory = new Implementation() { 18 public EnhNode wrap(Node n,EnhGraph eg) { 19 return new TestPropertyImpl(n,eg); 20 } 21 public boolean canWrap( Node n, EnhGraph eg ) 22 { return true; } 23 }; 24 25 26 private TestPropertyImpl(Node n,EnhGraph eg) { 27 super( n, eg ); 28 } 29 30 public boolean supports( Class t ) 31 { return t.isInstance( this ) && isProperty(); } 32 33 public boolean isProperty() { 34 return findPredicate() != null; 35 } 36 37 public TestObject anObject() { 38 if (!isProperty()) 39 throw new IllegalStateException ("Node is not the property of a triple."); 40 return (TestObject)enhGraph.getNodeAs(findPredicate().getObject(),TestObject.class); 41 } 42 43 } 44 45 74 75 | Popular Tags |