@Test public void findEntityById() { final EntitySchema entity = new EntitySchema( 1, "MyObject", Object.class, ( i, d ) -> 1, ( o, d ) -> d.notify() ); final ChannelSchema channelSchema = new ChannelSchema( ValueUtil.randomInt(), ValueUtil.randomString(), null, ChannelSchema.FilterType.NONE, null, false, false, Collections.singletonList( entity ) ); assertEquals( channelSchema.getEntities().size(), 1 ); assertEquals( channelSchema.getEntities().size(), 1 ); assertEquals( channelSchema.findEntityById( 1 ), entity ); assertNull( channelSchema.findEntityById( 0 ) ); }
@Nullable public EntitySchema findEntityById( final int entityId ) { return _entities.stream().filter( e -> e.getId() == entityId ).findAny().orElse( null ); }
ChannelSchema { @Nullable public EntitySchema findEntityById( final int entityId ) { return _entities.stream().filter( e -> e.getId() == entityId ).findAny().orElse( null ); } }
ChannelSchema { @Nullable public EntitySchema findEntityById( final int entityId ) { return _entities.stream().filter( e -> e.getId() == entityId ).findAny().orElse( null ); } ChannelSchema( final int id,
                        @Nullable final String name,
                        @Nullable final Class<?> instanceType,
                        @Nonnull final FilterType filterType,
                        @Nullable final SubscriptionUpdateEntityFilter<?> filter,
                        final boolean cacheable,
                        final boolean external,
                        @Nonnull final List<EntitySchema> entities ); }
ChannelSchema { @Nullable public EntitySchema findEntityById( final int entityId ) { return _entities.stream().filter( e -> e.getId() == entityId ).findAny().orElse( null ); } ChannelSchema( final int id,
                        @Nullable final String name,
                        @Nullable final Class<?> instanceType,
                        @Nonnull final FilterType filterType,
                        @Nullable final SubscriptionUpdateEntityFilter<?> filter,
                        final boolean cacheable,
                        final boolean external,
                        @Nonnull final List<EntitySchema> entities ); int getId(); @Nonnull String getName(); boolean isTypeChannel(); boolean isInstanceChannel(); @Nullable Class<?> getInstanceType(); @Nonnull FilterType getFilterType(); @Nullable SubscriptionUpdateEntityFilter<?> getFilter(); boolean isCacheable(); boolean isExternal(); @Nonnull List<EntitySchema> getEntities(); @Nullable EntitySchema findEntityById( final int entityId ); @Override String toString(); }
ChannelSchema { @Nullable public EntitySchema findEntityById( final int entityId ) { return _entities.stream().filter( e -> e.getId() == entityId ).findAny().orElse( null ); } ChannelSchema( final int id,
                        @Nullable final String name,
                        @Nullable final Class<?> instanceType,
                        @Nonnull final FilterType filterType,
                        @Nullable final SubscriptionUpdateEntityFilter<?> filter,
                        final boolean cacheable,
                        final boolean external,
                        @Nonnull final List<EntitySchema> entities ); int getId(); @Nonnull String getName(); boolean isTypeChannel(); boolean isInstanceChannel(); @Nullable Class<?> getInstanceType(); @Nonnull FilterType getFilterType(); @Nullable SubscriptionUpdateEntityFilter<?> getFilter(); boolean isCacheable(); boolean isExternal(); @Nonnull List<EntitySchema> getEntities(); @Nullable EntitySchema findEntityById( final int entityId ); @Override String toString();  }