You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Note.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2010, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.notes;
  11. import org.eclipse.jgit.lib.AnyObjectId;
  12. import org.eclipse.jgit.lib.ObjectId;
  13. /**
  14. * In-memory representation of a single note attached to one object.
  15. */
  16. public class Note extends ObjectId {
  17. private ObjectId data;
  18. /**
  19. * A Git note about the object referenced by {@code noteOn}.
  20. *
  21. * @param noteOn
  22. * the object that has a note attached to it.
  23. * @param noteData
  24. * the actual note data contained in this note
  25. */
  26. public Note(AnyObjectId noteOn, ObjectId noteData) {
  27. super(noteOn);
  28. data = noteData;
  29. }
  30. /**
  31. * Get the note content.
  32. *
  33. * @return the note content.
  34. */
  35. public ObjectId getData() {
  36. return data;
  37. }
  38. void setData(ObjectId newData) {
  39. data = newData;
  40. }
  41. /** {@inheritDoc} */
  42. @SuppressWarnings("nls")
  43. @Override
  44. public String toString() {
  45. return "Note[" + name() + " -> " + data.name() + "]";
  46. }
  47. }