@Test public void disposeWillDisposeUserObject() { final EntityService entityService = Replicant.context().getEntityService(); final Entity entity = safeAction( () -> entityService.findOrCreateEntity( ValueUtil.randomString(), A.class, ValueUtil.randomInt() ) ); final A userObject = new A(); safeAction( () -> entity.setUserObject( userObject ) ); assertFalse( Disposable.isDisposed( entity ) ); assertFalse( userObject.isDisposed() ); Disposable.dispose( entity ); assertTrue( Disposable.isDisposed( entity ) ); assertTrue( userObject.isDisposed() ); }
void setUserObject( @Nullable final Object userObject ) { _userObject = userObject; }
Entity extends ReplicantService { void setUserObject( @Nullable final Object userObject ) { _userObject = userObject; } }
Entity extends ReplicantService { void setUserObject( @Nullable final Object userObject ) { _userObject = userObject; } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); }
Entity extends ReplicantService { void setUserObject( @Nullable final Object userObject ) { _userObject = userObject; } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); @Nonnull String getName(); @Nonnull Class<?> getType(); int getId(); @Nonnull Object getUserObject(); @Observable( name = "userObject" ) @Nullable Object maybeUserObject(); @Nonnull @Observable( expectSetter = false ) Collection<Subscription> getSubscriptions(); @Override String toString(); }
Entity extends ReplicantService { void setUserObject( @Nullable final Object userObject ) { _userObject = userObject; } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); @Nonnull String getName(); @Nonnull Class<?> getType(); int getId(); @Nonnull Object getUserObject(); @Observable( name = "userObject" ) @Nullable Object maybeUserObject(); @Nonnull @Observable( expectSetter = false ) Collection<Subscription> getSubscriptions(); @Override String toString();  }