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 11 package org.eclipse.jgit.notes; 12 13 import org.eclipse.jgit.lib.AnyObjectId; 14 import org.eclipse.jgit.lib.ObjectId; 15 16 /** 17 * In-memory representation of a single note attached to one object. 18 */ 19 public class Note extends ObjectId { 20 private ObjectId data; 21 22 /** 23 * A Git note about the object referenced by {@code noteOn}. 24 * 25 * @param noteOn 26 * the object that has a note attached to it. 27 * @param noteData 28 * the actual note data contained in this note 29 */ 30 public Note(AnyObjectId noteOn, ObjectId noteData) { 31 super(noteOn); 32 data = noteData; 33 } 34 35 /** 36 * Get the note content. 37 * 38 * @return the note content. 39 */ 40 public ObjectId getData() { 41 return data; 42 } 43 44 void setData(ObjectId newData) { 45 data = newData; 46 } 47 48 /** {@inheritDoc} */ 49 @SuppressWarnings("nls") 50 @Override 51 public String toString() { 52 return "Note[" + name() + " -> " + data.name() + "]"; 53 } 54 }