public static Sequence promoteSequence(Sequence x) { if (BaseSequence.class.isAssignableFrom(x.getClass())) { try { return new Sequence(x.getFullName(), x.getSequence()); } catch (SequenceException e) { return x; } } else // if it's not a BaseSequence, there isn't anything // to 'promote' to! (yet) return x; }