<commit_before>package arez.doc.examples.at_dependency;

import arez.annotations.ArezComponent;
import arez.annotations.Dependency;
import arez.annotations.Observable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

@ArezComponent
public abstract class PersonViewModel
{
  @Nonnull
  private final Person _person;
  //DOC ELIDE START

  public PersonViewModel( @Nonnull final Person person )
  {
    _person = person;
  }

  //DOC ELIDE END

  // Let imagine there is a lot more logic and state on the view model
  // to justify it's existence rather than just having view layer directly
  // accessing underlying entities

  @Dependency
  @Nonnull
  public Person getPerson()
  {
    // This reference is immutable and the network replication
    // layer is responsible for managing the lifecycle of person
    // component and may dispose it when the Person entity is deleted
    // on the server which should trigger this view model being disposed.
    return _person;
  }

  /**
   * The Job entity is likewise controlled by the server
   * and can be updated, removed on the server and replicated to the web
   * browser. In this scenario the current job is just removed from the
   * person view model.
   */
  @Dependency( action = Dependency.Action.SET_NULL )
  @Observable
  @Nullable
  public abstract Job getCurrentJob();
  //DOC ELIDE START

  public abstract void setCurrentJob( @Nullable final Job currentJob );
  //DOC ELIDE END
}<commit_msg>Make sure @Dependency is marked as final<commit_after>package arez.doc.examples.at_dependency;

import arez.annotations.ArezComponent;
import arez.annotations.Dependency;
import arez.annotations.Observable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

@ArezComponent
public abstract class PersonViewModel
{
  @Nonnull
  private final Person _person;
  //DOC ELIDE START

  public PersonViewModel( @Nonnull final Person person )
  {
    _person = person;
  }

  //DOC ELIDE END

  // Let imagine there is a lot more logic and state on the view model
  // to justify it's existence rather than just having view layer directly
  // accessing underlying entities

  @Dependency
  @Nonnull
  public final Person getPerson()
  {
    // This reference is immutable and the network replication
    // layer is responsible for managing the lifecycle of person
    // component and may dispose it when the Person entity is deleted
    // on the server which should trigger this view model being disposed.
    return _person;
  }

  /**
   * The Job entity is likewise controlled by the server
   * and can be updated, removed on the server and replicated to the web
   * browser. In this scenario the current job is just removed from the
   * person view model.
   */
  @Dependency( action = Dependency.Action.SET_NULL )
  @Observable
  @Nullable
  public abstract Job getCurrentJob();
  //DOC ELIDE START

  public abstract void setCurrentJob( @Nullable final Job currentJob );
  //DOC ELIDE END
}
{'fraction_non_alphanumeric': 0.061893609902977584, 'fraction_numerical': 0.0, 'mean_word_length': 3.503012048192771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4826776', 'n_tokens_mistral': 813, 'n_tokens_neox': 765, 'n_words': 347}