/** make a new instance of a type _interf_ based on the node _n_ and the polymorphic _that_; use the implementation wrapper for _interf_ in _types_. */ public <X extends T> X newInstance( Class<X> interf, Node n, EnhGraph that ) { Implementation impl = types.get( interf ); if (impl == null) throw new PersonalityConfigException( interf + " not in Personality." ); EnhNode result = impl.wrap( n, that ); if (!interf.isInstance(result)) throw new PersonalityConfigException( interf + " misconfigured." ); return interf.cast( result ); }
/** make a new instance of a type _interf_ based on the node _n_ and the polymorphic _that_; use the implementation wrapper for _interf_ in _types_. */ public <X extends T> X newInstance( Class<X> interf, Node n, EnhGraph that ) { Implementation impl = types.get( interf ); if (impl == null) throw new PersonalityConfigException( interf + " not in Personality." ); EnhNode result = impl.wrap( n, that ); if (!interf.isInstance(result)) throw new PersonalityConfigException( interf + " misconfigured." ); return interf.cast( result ); }