@SuppressWarnings("unchecked") private static <T extends Structure> T unmodifiableStructure(T structure) { if (isUnmodifiable(structure)) return structure; if (structure instanceof Message) return (T) new UnmodifiableMessage((Message) structure); if (structure instanceof Group) return (T) new UnmodifiableGroup((Group) structure); return (T) new UnmodifiableSegment((Segment) structure); }
@SuppressWarnings("unchecked") private static <T extends Structure> T unmodifiableStructure(T structure) { if (isUnmodifiable(structure)) return structure; if (structure instanceof Message) return (T) new UnmodifiableMessage((Message) structure); if (structure instanceof Group) return (T) new UnmodifiableGroup((Group) structure); return (T) new UnmodifiableSegment((Segment) structure); }