/** Answer true iff this polymorphic object already has a valid view of type <code>t</code> in its ring (so .as()ing it doesn't need to construct a new object). */ protected <X extends T> boolean alreadyHasView( Class<X> t ) { return findExistingView( t ) != null; }
/** Answer true iff this polymorphic object already has a valid view of type <code>t</code> in its ring (so .as()ing it doesn't need to construct a new object). */ protected <X extends T> boolean alreadyHasView( Class<X> t ) { return findExistingView( t ) != null; }
/** return _true_ iff this polymorphic object supports the specified interface. Synonymous with "does the argument class have this as an instance". Actually it shouldn't be. Review. */ public <X extends T> boolean supports( Class<X> t ) { X supporter = findExistingView( t ); return supporter != null || this.canSupport( t ); }
/** * Answer a polymorphic object that presents <i>this</i> in a way which satisfies type * t. * @param t A type * @return A polymorphic instance, possibly but not necessarily this, that conforms to t. */ protected final <X extends T> X asInternal( Class<X> t ) { X other = findExistingView( t ); return other == null ? this.convertTo( t ) : other; }
/** return _true_ iff this polymorphic object supports the specified interface. Synonymous with "does the argument class have this as an instance". Actually it shouldn't be. Review. */ public <X extends T> boolean supports( Class<X> t ) { X supporter = findExistingView( t ); return supporter != null || this.canSupport( t ); }
/** * Answer a polymorphic object that presents <i>this</i> in a way which satisfies type * t. * @param t A type * @return A polymorphic instance, possibly but not necessarily this, that conforms to t. */ protected final <X extends T> X asInternal( Class<X> t ) { X other = findExistingView( t ); return other == null ? this.convertTo( t ) : other; }