@Test @SuppressWarnings("null") public void testOf() { assertThatThrownBy(() -> LinearId.of(null)).isInstanceOf(NullPointerException.class); assertThat(LinearId.of(empty)).isSameAs(empty); assertThat(LinearId.of(new LinearId())).isEqualTo(empty); assertThat(LinearId.of(new LinearId("hello", "world"))).isEqualTo(dual); }
@NonNull public static LinearId of(@NonNull Id id) { if (id instanceof LinearId) { return (LinearId) id; } if (id.getCount() == 0) { return new LinearId(null, DEFAULT_AGGREGATOR, null); } return new LinearId(id.toArray(), DEFAULT_AGGREGATOR, null); }
LinearId implements Id { @NonNull public static LinearId of(@NonNull Id id) { if (id instanceof LinearId) { return (LinearId) id; } if (id.getCount() == 0) { return new LinearId(null, DEFAULT_AGGREGATOR, null); } return new LinearId(id.toArray(), DEFAULT_AGGREGATOR, null); } }
LinearId implements Id { @NonNull public static LinearId of(@NonNull Id id) { if (id instanceof LinearId) { return (LinearId) id; } if (id.getCount() == 0) { return new LinearId(null, DEFAULT_AGGREGATOR, null); } return new LinearId(id.toArray(), DEFAULT_AGGREGATOR, null); } LinearId();  LinearId(String id);  LinearId(String parent, String tail);  LinearId(String... id);  LinearId(String[] ids, IdAggregator aggregator); private  LinearId(String[] ids, IdAggregator aggregator, Void private_constructor); }
LinearId implements Id { @NonNull public static LinearId of(@NonNull Id id) { if (id instanceof LinearId) { return (LinearId) id; } if (id.getCount() == 0) { return new LinearId(null, DEFAULT_AGGREGATOR, null); } return new LinearId(id.toArray(), DEFAULT_AGGREGATOR, null); } LinearId();  LinearId(String id);  LinearId(String parent, String tail);  LinearId(String... id);  LinearId(String[] ids, IdAggregator aggregator); private  LinearId(String[] ids, IdAggregator aggregator, Void private_constructor); @NonNull static LinearId of(@NonNull Id id); @Override String get(int index); @Override LinearId extend(String tail); @Override LinearId parent(); @Override int getCount(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override String[] toArray(); }
LinearId implements Id { @NonNull public static LinearId of(@NonNull Id id) { if (id instanceof LinearId) { return (LinearId) id; } if (id.getCount() == 0) { return new LinearId(null, DEFAULT_AGGREGATOR, null); } return new LinearId(id.toArray(), DEFAULT_AGGREGATOR, null); } LinearId();  LinearId(String id);  LinearId(String parent, String tail);  LinearId(String... id);  LinearId(String[] ids, IdAggregator aggregator); private  LinearId(String[] ids, IdAggregator aggregator, Void private_constructor); @NonNull static LinearId of(@NonNull Id id); @Override String get(int index); @Override LinearId extend(String tail); @Override LinearId parent(); @Override int getCount(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override String[] toArray();  }