diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-06-28 11:57:41 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-06-28 11:57:41 -0700 |
commit | aa4b06e08781f9f4e33259d92eb919b3c6da22ef (patch) | |
tree | eee974b42e4da94702449d3094dfd8e786bc0a18 /org.eclipse.jgit/src | |
parent | acb7be2c5adb270d21182d389ce93f3bca38cd29 (diff) | |
download | jgit-aa4b06e08781f9f4e33259d92eb919b3c6da22ef.tar.gz jgit-aa4b06e08781f9f4e33259d92eb919b3c6da22ef.zip |
Rename openObject, hasObject to just open, has
Similar to what we did on Repository, the openObject method
already implied we wanted to open an object, given its main
argument was of type AnyObjectId. Simplify the method name
to just the action, has or open.
Change-Id: If055e5e0d8de0e2424c18a773f6d2bc2f66054f4
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src')
12 files changed, 27 insertions, 27 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java index a095663bf4..15d118c0e9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java @@ -119,10 +119,10 @@ public abstract class ObjectDatabase { * @throws IOException * the object store cannot be accessed. */ - public boolean hasObject(final AnyObjectId objectId) throws IOException { + public boolean has(final AnyObjectId objectId) throws IOException { final ObjectReader or = newReader(); try { - return or.hasObject(objectId); + return or.has(objectId); } finally { or.release(); } @@ -142,9 +142,9 @@ public abstract class ObjectDatabase { * @throws IOException * the object store cannot be accessed. */ - public ObjectLoader openObject(final AnyObjectId objectId) + public ObjectLoader open(final AnyObjectId objectId) throws IOException { - return openObject(objectId, ObjectReader.OBJ_ANY); + return open(objectId, ObjectReader.OBJ_ANY); } /** @@ -168,12 +168,12 @@ public abstract class ObjectDatabase { * @throws IOException * the object store cannot be accessed. */ - public ObjectLoader openObject(AnyObjectId objectId, int typeHint) + public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { final ObjectReader or = newReader(); try { - return or.openObject(objectId, typeHint); + return or.open(objectId, typeHint); } finally { or.release(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java index 001b18c4c8..e9afc5043e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java @@ -68,9 +68,9 @@ public abstract class ObjectReader { * @throws IOException * the object store cannot be accessed. */ - public boolean hasObject(AnyObjectId objectId) throws IOException { + public boolean has(AnyObjectId objectId) throws IOException { try { - openObject(objectId); + open(objectId); return true; } catch (MissingObjectException notFound) { return false; @@ -88,9 +88,9 @@ public abstract class ObjectReader { * @throws IOException * the object store cannot be accessed. */ - public ObjectLoader openObject(AnyObjectId objectId) + public ObjectLoader open(AnyObjectId objectId) throws MissingObjectException, IOException { - return openObject(objectId, OBJ_ANY); + return open(objectId, OBJ_ANY); } /** @@ -111,7 +111,7 @@ public abstract class ObjectReader { * @throws IOException * the object store cannot be accessed. */ - public abstract ObjectLoader openObject(AnyObjectId objectId, int typeHint) + public abstract ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index a2d9f61e0a..aeb160e521 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -213,7 +213,7 @@ public abstract class Repository { */ public boolean hasObject(AnyObjectId objectId) { try { - return getObjectDatabase().hasObject(objectId); + return getObjectDatabase().has(objectId); } catch (IOException e) { // Legacy API, assume error means "no" return false; @@ -236,7 +236,7 @@ public abstract class Repository { */ public ObjectLoader open(final AnyObjectId objectId) throws MissingObjectException, IOException { - return getObjectDatabase().openObject(objectId); + return getObjectDatabase().open(objectId); } /** @@ -263,7 +263,7 @@ public abstract class Repository { public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { - return getObjectDatabase().openObject(objectId, typeHint); + return getObjectDatabase().open(objectId, typeHint); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java index 9fa79e15e3..14f4836d7a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java @@ -77,7 +77,7 @@ public abstract class RevObject extends ObjectId { final byte[] loadCanonical(final RevWalk walk) throws IOException, MissingObjectException, IncorrectObjectTypeException, CorruptObjectException { - return walk.curs.openObject(this, getType()).getCachedBytes(); + return walk.curs.open(this, getType()).getCachedBytes(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java index 2c849beb57..60c8024b3c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -720,7 +720,7 @@ public class RevWalk implements Iterable<RevCommit> { throws MissingObjectException, IOException { RevObject r = objects.get(id); if (r == null) { - final ObjectLoader ldr = curs.openObject(id); + final ObjectLoader ldr = curs.open(id); final byte[] data = ldr.getCachedBytes(); final int type = ldr.getType(); switch (type) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CachedObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CachedObjectDirectory.java index 194561238d..df62342d8f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CachedObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CachedObjectDirectory.java @@ -149,7 +149,7 @@ class CachedObjectDirectory extends FileObjectDatabase { } @Override - public boolean hasObject(final AnyObjectId objectId) { + public boolean has(final AnyObjectId objectId) { return hasObjectImpl1(objectId); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java index f0609897a3..0218234888 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java @@ -69,7 +69,7 @@ abstract class FileObjectDatabase extends ObjectDatabase { * @return true if the specified object is stored in this database, or any * of the alternate databases. */ - public boolean hasObject(final AnyObjectId objectId) { + public boolean has(final AnyObjectId objectId) { return hasObjectImpl1(objectId) || hasObjectImpl2(objectId.name()); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java index e6ed54022f..5016679894 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java @@ -83,7 +83,7 @@ class ObjectDirectoryInserter extends ObjectInserter { final MessageDigest md = digest(); final File tmp = toTemp(md, type, len, is); final ObjectId id = ObjectId.fromRaw(md.digest()); - if (db.hasObject(id)) { + if (db.has(id)) { // Object is already in the repository, remove temporary file. // tmp.delete(); @@ -102,7 +102,7 @@ class ObjectDirectoryInserter extends ObjectInserter { if (tmp.renameTo(dst)) return id; - if (db.hasObject(id)) { + if (db.has(id)) { tmp.delete(); return id; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java index 0272201e22..5444985736 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java @@ -77,11 +77,11 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs { this.db = db; } - public boolean hasObject(AnyObjectId objectId) throws IOException { - return db.hasObject(objectId); + public boolean has(AnyObjectId objectId) throws IOException { + return db.has(objectId); } - public ObjectLoader openObject(AnyObjectId objectId, int typeHint) + public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { final ObjectLoader ldr = db.openObject(this, objectId); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index a0e711f272..c7e3c0c9b0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java @@ -714,7 +714,7 @@ public class PackWriter { private void writeWholeObjectDeflate(PackOutputStream out, final ObjectToPack otp) throws IOException { - final ObjectLoader loader = reader.openObject(otp, otp.getType()); + final ObjectLoader loader = reader.open(otp, otp.getType()); final byte[] data = loader.getCachedBytes(); out.writeHeader(otp, data.length); deflater.reset(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java index 494c077e02..0699fc47a6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java @@ -595,7 +595,7 @@ public class IndexPack { baseObjectIds.add(baseId); final ObjectLoader ldr; try { - ldr = readCurs.openObject(baseId); + ldr = readCurs.open(baseId); } catch (MissingObjectException notFound) { missing.add(baseId); continue; @@ -856,7 +856,7 @@ public class IndexPack { } try { - final ObjectLoader ldr = readCurs.openObject(id, type); + final ObjectLoader ldr = readCurs.open(id, type); final byte[] existingData = ldr.getCachedBytes(); if (!Arrays.equals(data, existingData)) { throw new IOException(MessageFormat.format(JGitText.get().collisionOn, id.name())); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java index 6ceb839bde..fc088d7760 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java @@ -198,7 +198,7 @@ public class CanonicalTreeParser extends AbstractTreeIterator { public void reset(final Repository repo, final AnyObjectId id, final ObjectReader curs) throws IncorrectObjectTypeException, IOException { - reset(curs.openObject(id, Constants.OBJ_TREE).getCachedBytes()); + reset(curs.open(id, Constants.OBJ_TREE).getCachedBytes()); } @Override |