Ejemplo n.º 1
0
  /* @see org.mindswap.owl.OWLObject#castTo(java.lang.Class) */
  public final <T extends OWLObject> T castTo(final Class<T> javaClass) {
    T view = findView(javaClass);

    if (view == null) {
      final OWLObjectConverter<T> converter =
          OWLObjectConverterRegistry.instance().getConverter(javaClass);
      if (converter == null) throw new CastingException("No converter found for " + javaClass);

      view = converter.cast(this, isStrictConversion());

      addView(view);
    }

    return view;
  }
Ejemplo n.º 2
0
 /* @see org.mindswap.owl.OWLObject#canCastTo(java.lang.Class) */
 public final boolean canCastTo(final Class<? extends OWLObject> javaClass) {
   final OWLObjectConverter<?> converter =
       OWLObjectConverterRegistry.instance().getConverter(javaClass);
   return (converter != null && converter.canCast(this, isStrictConversion()));
 }