Fix javadoc in org.eclipse.jgit.lfs

Change-Id: I97b53c083da6aa31719d9e10369030ee33dd23dc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2017-12-17 20:48:52 +01:00
parent a90b75b47a
commit e0332bfbc6
24 changed files with 190 additions and 84 deletions

View File

@ -74,7 +74,8 @@
*/ */
public class CleanFilter extends FilterCommand { public class CleanFilter extends FilterCommand {
/** /**
* The factory is responsible for creating instances of {@link CleanFilter} * The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.CleanFilter}
*/ */
public final static FilterCommandFactory FACTORY = new FilterCommandFactory() { public final static FilterCommandFactory FACTORY = new FilterCommandFactory() {
@ -109,17 +110,19 @@ public final static void register() {
private Path tmpFile; private Path tmpFile;
/** /**
* Constructor for CleanFilter.
*
* @param db * @param db
* the repository * the repository
* @param in * @param in
* an {@link InputStream} providing the original content * an {@link java.io.InputStream} providing the original content
* @param out * @param out
* the {@link OutputStream} into which the content of the pointer * the {@link java.io.OutputStream} into which the content of the
* file should be written. That's the content which will be added * pointer file should be written. That's the content which will
* to the git repository * be added to the git repository
* @throws IOException * @throws java.io.IOException
* when the creation of the temporary file fails or when no * when the creation of the temporary file fails or when no
* {@link OutputStream} for this file can be created * {@link java.io.OutputStream} for this file can be created
*/ */
public CleanFilter(Repository db, InputStream in, OutputStream out) public CleanFilter(Repository db, InputStream in, OutputStream out)
throws IOException { throws IOException {
@ -130,6 +133,7 @@ public CleanFilter(Repository db, InputStream in, OutputStream out)
this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath()); this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath());
} }
/** {@inheritDoc} */
@Override @Override
public int run() throws IOException { public int run() throws IOException {
try { try {

View File

@ -61,6 +61,8 @@ public class Lfs {
private Path tmpDir; private Path tmpDir;
/** /**
* Constructor for Lfs.
*
* @param root * @param root
* the path to the LFS media directory. Will be "<repo>/.git/lfs" * the path to the LFS media directory. Will be "<repo>/.git/lfs"
*/ */
@ -69,6 +71,8 @@ public Lfs(Path root) {
} }
/** /**
* Get the LFS root directory
*
* @return the path to the LFS directory * @return the path to the LFS directory
*/ */
public Path getLfsRoot() { public Path getLfsRoot() {
@ -76,8 +80,10 @@ public Path getLfsRoot() {
} }
/** /**
* @return the path to the temp directory used by LFS. Will be * Get the path to the temporary directory used by LFS.
* "<repo>/.git/lfs/tmp" *
* @return the path to the temporary directory used by LFS. Will be
* {@code <repo>/.git/lfs/tmp}
*/ */
public Path getLfsTmpDir() { public Path getLfsTmpDir() {
if (tmpDir == null) { if (tmpDir == null) {
@ -87,8 +93,10 @@ public Path getLfsTmpDir() {
} }
/** /**
* Get the object directory used by LFS
*
* @return the path to the object directory used by LFS. Will be * @return the path to the object directory used by LFS. Will be
* "<repo>/.git/lfs/objects" * {@code <repo>/.git/lfs/objects}
*/ */
public Path getLfsObjDir() { public Path getLfsObjDir() {
if (objDir == null) { if (objDir == null) {
@ -98,6 +106,8 @@ public Path getLfsObjDir() {
} }
/** /**
* Get the media file which stores the original content
*
* @param id * @param id
* the id of the mediafile * the id of the mediafile
* @return the file which stores the original content. This will be files * @return the file which stores the original content. This will be files
@ -114,7 +124,7 @@ public Path getMediaFile(AnyLongObjectId id) {
* Create a new temp file in the LFS directory * Create a new temp file in the LFS directory
* *
* @return a new temporary file in the LFS directory * @return a new temporary file in the LFS directory
* @throws IOException * @throws java.io.IOException
* when the temp file could not be created * when the temp file could not be created
*/ */
public Path createTmpFile() throws IOException { public Path createTmpFile() throws IOException {

View File

@ -88,6 +88,8 @@ public class LfsPointer {
private long size; private long size;
/** /**
* <p>Constructor for LfsPointer.</p>
*
* @param oid * @param oid
* the id of the content * the id of the content
* @param size * @param size
@ -99,6 +101,8 @@ public LfsPointer(AnyLongObjectId oid, long size) {
} }
/** /**
* <p>Getter for the field <code>oid</code>.</p>
*
* @return the id of the content * @return the id of the content
*/ */
public AnyLongObjectId getOid() { public AnyLongObjectId getOid() {
@ -106,6 +110,8 @@ public AnyLongObjectId getOid() {
} }
/** /**
* <p>Getter for the field <code>size</code>.</p>
*
* @return the size of the content * @return the size of the content
*/ */
public long getSize() { public long getSize() {
@ -116,7 +122,7 @@ public long getSize() {
* Encode this object into the LFS format defined by {@link #VERSION} * Encode this object into the LFS format defined by {@link #VERSION}
* *
* @param out * @param out
* the {@link OutputStream} into which the encoded data should be * the {@link java.io.OutputStream} into which the encoded data should be
* written * written
*/ */
public void encode(OutputStream out) { public void encode(OutputStream out) {
@ -139,10 +145,10 @@ public void encode(OutputStream out) {
* {@link #VERSION} * {@link #VERSION}
* *
* @param in * @param in
* the {@link InputStream} from where to read the data * the {@link java.io.InputStream} from where to read the data
* @return an {@link LfsPointer} or <code>null</code> if the stream was not * @return an {@link org.eclipse.jgit.lfs.LfsPointer} or <code>null</code>
* parseable as LfsPointer * if the stream was not parseable as LfsPointer
* @throws IOException * @throws java.io.IOException
*/ */
@Nullable @Nullable
public static LfsPointer parseLfsPointer(InputStream in) public static LfsPointer parseLfsPointer(InputStream in)
@ -173,6 +179,7 @@ public static LfsPointer parseLfsPointer(InputStream in)
return null; return null;
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return "LfsPointer: oid=" + oid.name() + ", size=" //$NON-NLS-1$ //$NON-NLS-2$ return "LfsPointer: oid=" + oid.name() + ", size=" //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -70,7 +70,8 @@
*/ */
public class SmudgeFilter extends FilterCommand { public class SmudgeFilter extends FilterCommand {
/** /**
* The factory is responsible for creating instances of {@link SmudgeFilter} * The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.SmudgeFilter}
*/ */
public final static FilterCommandFactory FACTORY = new FilterCommandFactory() { public final static FilterCommandFactory FACTORY = new FilterCommandFactory() {
@Override @Override
@ -93,10 +94,15 @@ public final static void register() {
private Lfs lfs; private Lfs lfs;
/** /**
* Constructor for SmudgeFilter.
*
* @param db * @param db
* a {@link org.eclipse.jgit.lib.Repository} object.
* @param in * @param in
* a {@link java.io.InputStream} object.
* @param out * @param out
* @throws IOException * a {@link java.io.OutputStream} object.
* @throws java.io.IOException
*/ */
public SmudgeFilter(Repository db, InputStream in, OutputStream out) public SmudgeFilter(Repository db, InputStream in, OutputStream out)
throws IOException { throws IOException {
@ -111,6 +117,7 @@ public SmudgeFilter(Repository db, InputStream in, OutputStream out)
} }
} }
/** {@inheritDoc} */
@Override @Override
public int run() throws IOException { public int run() throws IOException {
int b; int b;

View File

@ -66,8 +66,7 @@ public class CorruptLongObjectException extends IllegalArgumentException {
* id of the long object * id of the long object
* @param contentHash * @param contentHash
* hash of the long object's content * hash of the long object's content
* * @param message a {@link java.lang.String} object.
* @param message
*/ */
public CorruptLongObjectException(AnyLongObjectId id, public CorruptLongObjectException(AnyLongObjectId id,
AnyLongObjectId contentHash, AnyLongObjectId contentHash,
@ -78,6 +77,8 @@ public CorruptLongObjectException(AnyLongObjectId id,
} }
/** /**
* Get the <code>id</code> of the object.
*
* @return the id of the object, i.e. the expected hash of the object's * @return the id of the object, i.e. the expected hash of the object's
* content * content
*/ */
@ -86,6 +87,8 @@ public AnyLongObjectId getId() {
} }
/** /**
* Get the <code>contentHash</code>.
*
* @return the actual hash of the object's content which doesn't match the * @return the actual hash of the object's content which doesn't match the
* object's id when this exception is thrown which signals that the * object's id when this exception is thrown which signals that the
* object has been corrupted * object has been corrupted

View File

@ -63,9 +63,11 @@ public class CorruptMediaFile extends IOException {
private long size; private long size;
/** /**
* @param mediaFile * <p>Constructor for CorruptMediaFile.</p>
* @param expectedSize *
* @param size * @param mediaFile a {@link java.nio.file.Path} object.
* @param expectedSize a long.
* @param size a long.
*/ */
@SuppressWarnings("boxing") @SuppressWarnings("boxing")
public CorruptMediaFile(Path mediaFile, long expectedSize, public CorruptMediaFile(Path mediaFile, long expectedSize,
@ -78,6 +80,8 @@ public CorruptMediaFile(Path mediaFile, long expectedSize,
} }
/** /**
* Get the <code>mediaFile</code>.
*
* @return the media file which seems to be corrupt * @return the media file which seems to be corrupt
*/ */
public Path getMediaFile() { public Path getMediaFile() {
@ -85,6 +89,8 @@ public Path getMediaFile() {
} }
/** /**
* Get the <code>expectedSize</code>.
*
* @return the expected size of the media file * @return the expected size of the media file
*/ */
public long getExpectedSize() { public long getExpectedSize() {
@ -92,6 +98,8 @@ public long getExpectedSize() {
} }
/** /**
* Get the <code>size</code>.
*
* @return the actual size of the media file in the file system * @return the actual size of the media file in the file system
*/ */
public long getSize() { public long getSize() {

View File

@ -72,6 +72,8 @@ public InvalidLongObjectIdException(byte[] bytes, int offset, int length) {
} }
/** /**
* <p>Constructor for InvalidLongObjectIdException.</p>
*
* @param idString * @param idString
* String containing the invalid id * String containing the invalid id
*/ */

View File

@ -47,12 +47,13 @@
* Thrown when the bandwidth limit for the user or repository has been exceeded. * Thrown when the bandwidth limit for the user or repository has been exceeded.
* *
* @since 4.5 * @since 4.5
*
*/ */
public class LfsBandwidthLimitExceeded extends LfsException { public class LfsBandwidthLimitExceeded extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsBandwidthLimitExceeded.</p>
*
* @param message * @param message
* error message, which may be shown to an end-user. * error message, which may be shown to an end-user.
*/ */

View File

@ -52,6 +52,8 @@ public class LfsException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsException.</p>
*
* @param message * @param message
* error message, which may be shown to an end-user. * error message, which may be shown to an end-user.
*/ */

View File

@ -47,12 +47,13 @@
* Thrown when there is insufficient storage on the server. * Thrown when there is insufficient storage on the server.
* *
* @since 4.5 * @since 4.5
*
*/ */
public class LfsInsufficientStorage extends LfsException { public class LfsInsufficientStorage extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsInsufficientStorage.</p>
*
* @param message * @param message
* error message, which may be shown to an end-user. * error message, which may be shown to an end-user.
*/ */

View File

@ -47,12 +47,13 @@
* Thrown when the user has hit a rate limit with the server. * Thrown when the user has hit a rate limit with the server.
* *
* @since 4.5 * @since 4.5
*
*/ */
public class LfsRateLimitExceeded extends LfsException { public class LfsRateLimitExceeded extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsRateLimitExceeded.</p>
*
* @param message * @param message
* error message, which may be shown to an end-user. * error message, which may be shown to an end-user.
*/ */

View File

@ -56,9 +56,10 @@ public class LfsRepositoryNotFound extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsRepositoryNotFound.</p>
*
* @param name * @param name
* the repository name. * the repository name.
*
*/ */
public LfsRepositoryNotFound(String name) { public LfsRepositoryNotFound(String name) {
super(MessageFormat.format(LfsText.get().repositoryNotFound, name)); super(MessageFormat.format(LfsText.get().repositoryNotFound, name));

View File

@ -57,6 +57,8 @@ public class LfsRepositoryReadOnly extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsRepositoryReadOnly.</p>
*
* @param name * @param name
* the repository name. * the repository name.
*/ */

View File

@ -56,6 +56,8 @@ public class LfsUnauthorized extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* <p>Constructor for LfsUnauthorized.</p>
*
* @param operation * @param operation
* the operation that was attempted. * the operation that was attempted.
* @param name * @param name

View File

@ -56,6 +56,8 @@ public class LfsUnavailable extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* Constructor for LfsUnavailable.
*
* @param name * @param name
* the repository name. * the repository name.
*/ */

View File

@ -53,6 +53,8 @@ public class LfsValidationError extends LfsException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* Constructor for LfsValidationError.
*
* @param message * @param message
* error message, which may be shown to an end-user. * error message, which may be shown to an end-user.
*/ */

View File

@ -56,9 +56,9 @@
import org.eclipse.jgit.lfs.lib.LongObjectId; import org.eclipse.jgit.lfs.lib.LongObjectId;
/** /**
* Output stream writing content to a {@link LockFile} which is committed on * Output stream writing content to a
* close(). The stream checks if the hash of the stream content matches the * {@link org.eclipse.jgit.internal.storage.file.LockFile} which is committed on
* id. * close(). The stream checks if the hash of the stream content matches the id.
*/ */
public class AtomicObjectOutputStream extends OutputStream { public class AtomicObjectOutputStream extends OutputStream {
@ -71,9 +71,13 @@ public class AtomicObjectOutputStream extends OutputStream {
private AnyLongObjectId id; private AnyLongObjectId id;
/** /**
* Constructor for AtomicObjectOutputStream.
*
* @param path * @param path
* a {@link java.nio.file.Path} object.
* @param id * @param id
* @throws IOException * a {@link org.eclipse.jgit.lfs.lib.AnyLongObjectId} object.
* @throws java.io.IOException
*/ */
public AtomicObjectOutputStream(Path path, AnyLongObjectId id) public AtomicObjectOutputStream(Path path, AnyLongObjectId id)
throws IOException { throws IOException {
@ -85,36 +89,46 @@ public AtomicObjectOutputStream(Path path, AnyLongObjectId id)
} }
/** /**
* Constructor for AtomicObjectOutputStream.
*
* @param path * @param path
* @throws IOException * a {@link java.nio.file.Path} object.
* @throws java.io.IOException
*/ */
public AtomicObjectOutputStream(Path path) throws IOException { public AtomicObjectOutputStream(Path path) throws IOException {
this(path, null); this(path, null);
} }
/** /**
* Get the <code>id</code>.
*
* @return content hash of the object which was streamed through this * @return content hash of the object which was streamed through this
* stream. May return {@code null} if called before closing this stream. * stream. May return {@code null} if called before closing this
* stream.
*/ */
public @Nullable AnyLongObjectId getId() { public @Nullable AnyLongObjectId getId() {
return id; return id;
} }
/** {@inheritDoc} */
@Override @Override
public void write(int b) throws IOException { public void write(int b) throws IOException {
out.write(b); out.write(b);
} }
/** {@inheritDoc} */
@Override @Override
public void write(byte[] b) throws IOException { public void write(byte[] b) throws IOException {
out.write(b); out.write(b);
} }
/** {@inheritDoc} */
@Override @Override
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len); out.write(b, off, len);
} }
/** {@inheritDoc} */
@Override @Override
public void close() throws IOException { public void close() throws IOException {
out.close(); out.close();

View File

@ -51,6 +51,8 @@
public class LfsText extends TranslationBundle { public class LfsText extends TranslationBundle {
/** /**
* Get an instance of this translation bundle.
*
* @return an instance of this translation bundle * @return an instance of this translation bundle
*/ */
public static LfsText get() { public static LfsText get() {

View File

@ -48,14 +48,11 @@
import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException; import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException;
import org.eclipse.jgit.lfs.internal.LfsText; import org.eclipse.jgit.lfs.internal.LfsText;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
/** /**
* A prefix abbreviation of an {@link LongObjectId}. * A prefix abbreviation of an {@link org.eclipse.jgit.lfs.lib.LongObjectId}.
* <p> * <p>
* Enable abbreviating SHA-256 strings used by Git LFS, using sufficient leading * Enable abbreviating SHA-256 strings used by Git LFS, using sufficient leading
* digits from the LongObjectId name to still be unique within the repository * digits from the LongObjectId name to still be unique within the repository
@ -65,7 +62,7 @@
* This class converts the hex string into a binary form, to make it more * This class converts the hex string into a binary form, to make it more
* efficient for matching against an object. * efficient for matching against an object.
* *
* Ported to SHA-256 from {@link AbbreviatedObjectId} * Ported to SHA-256 from {@link org.eclipse.jgit.lib.AbbreviatedObjectId}
* *
* @since 4.3 * @since 4.3
*/ */
@ -117,13 +114,14 @@ public static final AbbreviatedLongObjectId fromString(final byte[] buf,
} }
/** /**
* Convert an AbbreviatedObjectId from an {@link AnyObjectId}. * Convert an AbbreviatedObjectId from an
* {@link org.eclipse.jgit.lib.AnyObjectId}.
* <p> * <p>
* This method copies over all bits of the Id, and is therefore complete * This method copies over all bits of the Id, and is therefore complete
* (see {@link #isComplete()}). * (see {@link #isComplete()}).
* *
* @param id * @param id
* the {@link ObjectId} to convert from. * the {@link org.eclipse.jgit.lib.ObjectId} to convert from.
* @return the converted object id. * @return the converted object id.
*/ */
public static final AbbreviatedLongObjectId fromLongObjectId( public static final AbbreviatedLongObjectId fromLongObjectId(
@ -213,17 +211,29 @@ static long mask(final int nibbles, final long word, final long v) {
w4 = new_4; w4 = new_4;
} }
/** @return number of hex digits appearing in this id */ /**
* Get length
*
* @return number of hex digits appearing in this id.
*/
public int length() { public int length() {
return nibbles; return nibbles;
} }
/** @return true if this ObjectId is actually a complete id. */ /**
* Check if this id is complete
*
* @return true if this ObjectId is actually a complete id.
*/
public boolean isComplete() { public boolean isComplete() {
return length() == Constants.LONG_OBJECT_ID_STRING_LENGTH; return length() == Constants.LONG_OBJECT_ID_STRING_LENGTH;
} }
/** @return a complete ObjectId; null if {@link #isComplete()} is false */ /**
* Convert to LongObjectId
*
* @return a complete ObjectId; null if {@link #isComplete()} is false.
*/
public LongObjectId toLongObjectId() { public LongObjectId toLongObjectId() {
return isComplete() ? new LongObjectId(w1, w2, w3, w4) : null; return isComplete() ? new LongObjectId(w1, w2, w3, w4) : null;
} }
@ -321,7 +331,11 @@ public final int prefixCompare(final long[] bs, final int p) {
return NB.compareUInt64(w4, mask(4, bs[p + 3])); return NB.compareUInt64(w4, mask(4, bs[p + 3]));
} }
/** @return value for a fan-out style map, only valid of length &gt;= 2. */ /**
* Get the first byte of this id
*
* @return value for a fan-out style map, only valid of length &gt;= 2.
*/
public final int getFirstByte() { public final int getFirstByte() {
return (int) (w1 >>> 56); return (int) (w1 >>> 56);
} }
@ -330,11 +344,13 @@ private long mask(final long word, final long v) {
return mask(nibbles, word, v); return mask(nibbles, word, v);
} }
/** {@inheritDoc} */
@Override @Override
public int hashCode() { public int hashCode() {
return (int) (w1 >> 32); return (int) (w1 >> 32);
} }
/** {@inheritDoc} */
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o instanceof AbbreviatedLongObjectId) { if (o instanceof AbbreviatedLongObjectId) {
@ -346,6 +362,8 @@ public boolean equals(final Object o) {
} }
/** /**
* <p>name.</p>
*
* @return string form of the abbreviation, in lower case hexadecimal. * @return string form of the abbreviation, in lower case hexadecimal.
*/ */
public final String name() { public final String name() {
@ -367,6 +385,7 @@ public final String name() {
return new String(b, 0, nibbles); return new String(b, 0, nibbles);
} }
/** {@inheritDoc} */
@SuppressWarnings("nls") @SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {

View File

@ -49,17 +49,17 @@
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
/** /**
* A (possibly mutable) SHA-256 abstraction. * A (possibly mutable) SHA-256 abstraction.
* <p> * <p>
* If this is an instance of {@link MutableLongObjectId} the concept of equality * If this is an instance of
* {@link org.eclipse.jgit.lfs.lib.MutableLongObjectId} the concept of equality
* with this instance can alter at any time, if this instance is modified to * with this instance can alter at any time, if this instance is modified to
* represent a different object name. * represent a different object name.
* *
* Ported to SHA-256 from {@link AnyObjectId} * Ported to SHA-256 from {@link org.eclipse.jgit.lib.AnyObjectId}
* *
* @since 4.3 * @since 4.3
*/ */
@ -132,14 +132,15 @@ public final int getSecondByte() {
* @param index * @param index
* index of the byte to obtain from the raw form of the * index of the byte to obtain from the raw form of the
* LongObjectId. Must be in range [0, * LongObjectId. Must be in range [0,
* {@link Constants#LONG_OBJECT_ID_LENGTH}). * {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH}).
* @return the value of the requested byte at {@code index}. Returned values * @return the value of the requested byte at {@code index}. Returned values
* are unsigned and thus are in the range [0,255] rather than the * are unsigned and thus are in the range [0,255] rather than the
* signed byte range of [-128, 127]. * signed byte range of [-128, 127].
* @throws ArrayIndexOutOfBoundsException * @throws java.lang.ArrayIndexOutOfBoundsException
* {@code index} is less than 0, equal to * {@code index} is less than 0, equal to
* {@link Constants#LONG_OBJECT_ID_LENGTH}, or greater than * {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH},
* {@link Constants#LONG_OBJECT_ID_LENGTH}. * or greater than
* {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH}.
*/ */
public final int getByte(int index) { public final int getByte(int index) {
long w; long w;
@ -164,12 +165,9 @@ public final int getByte(int index) {
} }
/** /**
* Compare this LongObjectId to another and obtain a sort ordering. * {@inheritDoc}
* *
* @param other * Compare this LongObjectId to another and obtain a sort ordering.
* the other id to compare to. Must not be null.
* @return &lt; 0 if this id comes before other; 0 if this id is equal to
* other; &gt; 0 if this id comes after other.
*/ */
@Override @Override
public final int compareTo(final AnyLongObjectId other) { public final int compareTo(final AnyLongObjectId other) {
@ -263,6 +261,7 @@ public boolean startsWith(final AbbreviatedLongObjectId abbr) {
return abbr.prefixCompare(this) == 0; return abbr.prefixCompare(this) == 0;
} }
/** {@inheritDoc} */
@Override @Override
public final int hashCode() { public final int hashCode() {
return (int) (w1 >> 32); return (int) (w1 >> 32);
@ -279,6 +278,7 @@ public final boolean equals(final AnyLongObjectId other) {
return other != null ? equals(this, other) : false; return other != null ? equals(this, other) : false;
} }
/** {@inheritDoc} */
@Override @Override
public final boolean equals(final Object o) { public final boolean equals(final Object o) {
if (o instanceof AnyLongObjectId) if (o instanceof AnyLongObjectId)
@ -335,7 +335,7 @@ public void copyRawTo(final long[] b, final int o) {
* *
* @param w * @param w
* the stream to write to. * the stream to write to.
* @throws IOException * @throws java.io.IOException
* the stream writing failed. * the stream writing failed.
*/ */
public void copyRawTo(final OutputStream w) throws IOException { public void copyRawTo(final OutputStream w) throws IOException {
@ -362,7 +362,7 @@ private static void writeRawLong(final OutputStream w, long v)
* *
* @param w * @param w
* the stream to copy to. * the stream to copy to.
* @throws IOException * @throws java.io.IOException
* the stream writing failed. * the stream writing failed.
*/ */
public void copyTo(final OutputStream w) throws IOException { public void copyTo(final OutputStream w) throws IOException {
@ -421,7 +421,7 @@ private static void formatHexByte(final byte[] dst, final int p, long w) {
* *
* @param w * @param w
* the stream to copy to. * the stream to copy to.
* @throws IOException * @throws java.io.IOException
* the stream writing failed. * the stream writing failed.
*/ */
public void copyTo(final Writer w) throws IOException { public void copyTo(final Writer w) throws IOException {
@ -437,7 +437,7 @@ public void copyTo(final Writer w) throws IOException {
* of object id (64 characters or larger). * of object id (64 characters or larger).
* @param w * @param w
* the stream to copy to. * the stream to copy to.
* @throws IOException * @throws java.io.IOException
* the stream writing failed. * the stream writing failed.
*/ */
public void copyTo(final char[] tmp, final Writer w) throws IOException { public void copyTo(final char[] tmp, final Writer w) throws IOException {
@ -486,6 +486,7 @@ static void formatHexChar(final char[] dst, final int p, long w) {
dst[o--] = '0'; dst[o--] = '0';
} }
/** {@inheritDoc} */
@SuppressWarnings("nls") @SuppressWarnings("nls")
@Override @Override
public String toString() { public String toString() {
@ -493,6 +494,8 @@ public String toString() {
} }
/** /**
* Get string form of the SHA-256
*
* @return string form of the SHA-256, in lower case hexadecimal. * @return string form of the SHA-256, in lower case hexadecimal.
*/ */
public final String name() { public final String name() {
@ -500,6 +503,8 @@ public final String name() {
} }
/** /**
* Get string form of the SHA-256
*
* @return string form of the SHA-256, in lower case hexadecimal. * @return string form of the SHA-256, in lower case hexadecimal.
*/ */
public final String getName() { public final String getName() {
@ -510,8 +515,10 @@ public final String getName() {
* Return an abbreviation (prefix) of this object SHA-256. * Return an abbreviation (prefix) of this object SHA-256.
* <p> * <p>
* This implementation does not guarantee uniqueness. Callers should instead * This implementation does not guarantee uniqueness. Callers should instead
* use {@link ObjectReader#abbreviate(AnyObjectId, int)} to obtain a unique * use
* abbreviation within the scope of a particular object database. * {@link org.eclipse.jgit.lib.ObjectReader#abbreviate(AnyObjectId, int)} to
* obtain a unique abbreviation within the scope of a particular object
* database.
* *
* @param len * @param len
* length of the abbreviated string. * length of the abbreviated string.
@ -529,8 +536,8 @@ public AbbreviatedLongObjectId abbreviate(final int len) {
* Obtain an immutable copy of this current object. * Obtain an immutable copy of this current object.
* <p> * <p>
* Only returns <code>this</code> if this instance is an unsubclassed * Only returns <code>this</code> if this instance is an unsubclassed
* instance of {@link LongObjectId}; otherwise a new instance is returned * instance of {@link org.eclipse.jgit.lfs.lib.LongObjectId}; otherwise a
* holding the same value. * new instance is returned holding the same value.
* <p> * <p>
* This method is useful to shed any additional memory that may be tied to * This method is useful to shed any additional memory that may be tied to
* the subclass, yet retain the unique identity of the object id for future * the subclass, yet retain the unique identity of the object id for future

View File

@ -52,7 +52,7 @@
* Misc. constants used throughout JGit LFS extension. * Misc. constants used throughout JGit LFS extension.
* *
* @since 4.3 * @since 4.3
**/ */
@SuppressWarnings("nls") @SuppressWarnings("nls")
public final class Constants { public final class Constants {
/** /**
@ -111,7 +111,7 @@ public final class Constants {
* Create a new digest function for objects. * Create a new digest function for objects.
* *
* @return a new digest object. * @return a new digest object.
* @throws RuntimeException * @throws java.lang.RuntimeException
* this Java virtual machine does not support the required hash * this Java virtual machine does not support the required hash
* function. Very unlikely given that JGit uses a hash function * function. Very unlikely given that JGit uses a hash function
* that is in the Java reference specification. * that is in the Java reference specification.

View File

@ -66,12 +66,15 @@ public class LfsPointerFilter extends TreeFilter {
private LfsPointer pointer; private LfsPointer pointer;
/** /**
* @return {@link LfsPointer} or {@code null} * Get the field <code>pointer</code>.
*
* @return {@link org.eclipse.jgit.lfs.LfsPointer} or {@code null}
*/ */
public LfsPointer getPointer() { public LfsPointer getPointer() {
return pointer; return pointer;
} }
/** {@inheritDoc} */
@Override @Override
public boolean include(TreeWalk walk) throws MissingObjectException, public boolean include(TreeWalk walk) throws MissingObjectException,
IncorrectObjectTypeException, IOException { IncorrectObjectTypeException, IOException {
@ -91,11 +94,13 @@ public boolean include(TreeWalk walk) throws MissingObjectException,
} }
} }
/** {@inheritDoc} */
@Override @Override
public boolean shouldBeRecursive() { public boolean shouldBeRecursive() {
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
public TreeFilter clone() { public TreeFilter clone() {
return new LfsPointerFilter(); return new LfsPointerFilter();

View File

@ -49,14 +49,13 @@
import java.io.Serializable; import java.io.Serializable;
import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException; import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
/** /**
* A SHA-256 abstraction. * A SHA-256 abstraction.
* *
* Ported to SHA-256 from {@link ObjectId} * Ported to SHA-256 from {@link org.eclipse.jgit.lib.ObjectId}
* *
* @since 4.3 * @since 4.3
*/ */
@ -288,6 +287,7 @@ protected LongObjectId(final AnyLongObjectId src) {
w4 = src.w4; w4 = src.w4;
} }
/** {@inheritDoc} */
@Override @Override
public LongObjectId toObjectId() { public LongObjectId toObjectId() {
return this; return this;

View File

@ -47,14 +47,13 @@
import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException; import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException;
import org.eclipse.jgit.lfs.internal.LfsText; import org.eclipse.jgit.lfs.internal.LfsText;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils; import org.eclipse.jgit.util.RawParseUtils;
/** /**
* A mutable SHA-256 abstraction. * A mutable SHA-256 abstraction.
* *
* Ported to SHA-256 from {@link MutableObjectId} * Ported to SHA-256 from {@link org.eclipse.jgit.lib.MutableObjectId}
* *
* @since 4.3 * @since 4.3
*/ */
@ -81,15 +80,17 @@ public MutableLongObjectId() {
* *
* @param index * @param index
* index of the byte to set in the raw form of the ObjectId. Must * index of the byte to set in the raw form of the ObjectId. Must
* be in range [0, {@link Constants#LONG_OBJECT_ID_LENGTH}). * be in range [0,
* {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH}).
* @param value * @param value
* the value of the specified byte at {@code index}. Values are * the value of the specified byte at {@code index}. Values are
* unsigned and thus are in the range [0,255] rather than the * unsigned and thus are in the range [0,255] rather than the
* signed byte range of [-128, 127]. * signed byte range of [-128, 127].
* @throws ArrayIndexOutOfBoundsException * @throws java.lang.ArrayIndexOutOfBoundsException
* {@code index} is less than 0, equal to * {@code index} is less than 0, equal to
* {@link Constants#LONG_OBJECT_ID_LENGTH}, or greater than * {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH},
* {@link Constants#LONG_OBJECT_ID_LENGTH}. * or greater than
* {@link org.eclipse.jgit.lfs.lib.Constants#LONG_OBJECT_ID_LENGTH}.
*/ */
public void setByte(int index, int value) { public void setByte(int index, int value) {
switch (index >> 3) { switch (index >> 3) {
@ -135,7 +136,10 @@ private static long set(long w, int index, long value) {
} }
} }
/** Make this id match {@link LongObjectId#zeroId()}. */ /**
* Make this id match
* {@link org.eclipse.jgit.lfs.lib.LongObjectId#zeroId()}.
*/
public void clear() { public void clear() {
w1 = 0; w1 = 0;
w2 = 0; w2 = 0;
@ -144,7 +148,7 @@ public void clear() {
} }
/** /**
* Copy an LongObjectId into this mutable buffer. * Copy a LongObjectId into this mutable buffer.
* *
* @param src * @param src
* the source id to copy from. * the source id to copy from.
@ -157,7 +161,7 @@ public void fromObjectId(AnyLongObjectId src) {
} }
/** /**
* Convert an LongObjectId from raw binary representation. * Convert a LongObjectId from raw binary representation.
* *
* @param bs * @param bs
* the raw byte buffer to read from. At least 32 bytes must be * the raw byte buffer to read from. At least 32 bytes must be
@ -168,7 +172,7 @@ public void fromRaw(final byte[] bs) {
} }
/** /**
* Convert an LongObjectId from raw binary representation. * Convert a LongObjectId from raw binary representation.
* *
* @param bs * @param bs
* the raw byte buffer to read from. At least 32 bytes after p * the raw byte buffer to read from. At least 32 bytes after p
@ -184,7 +188,7 @@ public void fromRaw(final byte[] bs, final int p) {
} }
/** /**
* Convert an LongObjectId from binary representation expressed in integers. * Convert a LongObjectId from binary representation expressed in integers.
* *
* @param longs * @param longs
* the raw long buffer to read from. At least 4 longs must be * the raw long buffer to read from. At least 4 longs must be
@ -195,14 +199,13 @@ public void fromRaw(final long[] longs) {
} }
/** /**
* Convert an LongObjectId from binary representation expressed in longs. * Convert a LongObjectId from binary representation expressed in longs.
* *
* @param longs * @param longs
* the raw int buffer to read from. At least 4 longs after p must * the raw int buffer to read from. At least 4 longs after p must
* be available within this longs array. * be available within this longs array.
* @param p * @param p
* position to read the first integer of data from. * position to read the first integer of data from.
*
*/ */
public void fromRaw(final long[] longs, final int p) { public void fromRaw(final long[] longs, final int p) {
w1 = longs[p]; w1 = longs[p];
@ -212,7 +215,7 @@ public void fromRaw(final long[] longs, final int p) {
} }
/** /**
* Convert an LongObjectId from hex characters (US-ASCII). * Convert a LongObjectId from hex characters (US-ASCII).
* *
* @param buf * @param buf
* the US-ASCII buffer to read from. At least 32 bytes after * the US-ASCII buffer to read from. At least 32 bytes after
@ -225,7 +228,7 @@ public void fromString(final byte[] buf, final int offset) {
} }
/** /**
* Convert an LongObjectId from hex characters. * Convert a LongObjectId from hex characters.
* *
* @param str * @param str
* the string to read from. Must be 64 characters long. * the string to read from. Must be 64 characters long.
@ -249,6 +252,7 @@ private void fromHexString(final byte[] bs, int p) {
} }
} }
/** {@inheritDoc} */
@Override @Override
public LongObjectId toObjectId() { public LongObjectId toObjectId() {
return new LongObjectId(this); return new LongObjectId(this);