Skip to content

Commit

Permalink
Make checkstyle happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Dec 21, 2015
1 parent 6c5a642 commit b504340
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ protected String value() {
}

@Override
public boolean equals(Object o) {
if (this == o) {
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (o == null || getClass() != o.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Entity entity = (Entity) o;
Entity entity = (Entity) obj;
return Objects.equals(type, entity.type) && Objects.equals(value, entity.value);
}

Expand Down Expand Up @@ -226,7 +226,7 @@ public static final class Project extends Entity {

private static final long serialVersionUID = 7933776866530023027L;

private final ProjectRole pRole;
private final ProjectRole projectRole;
private final String projectId;

public enum ProjectRole {
Expand All @@ -236,20 +236,20 @@ public enum ProjectRole {
/**
* Creates a project entity.
*
* @param pRole a role in the project, used to select project's teams
* @param projectRole a role in the project, used to select project's teams
* @param projectId id of the project
*/
public Project(ProjectRole pRole, String projectId) {
super(Type.PROJECT, pRole.name().toLowerCase() + "-" + projectId);
this.pRole = pRole;
public Project(ProjectRole projectRole, String projectId) {
super(Type.PROJECT, projectRole.name().toLowerCase() + "-" + projectId);
this.projectRole = projectRole;
this.projectId = projectId;
}

/**
* Returns the role in the project for this entity.
*/
public ProjectRole projectRole() {
return pRole;
return projectRole;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static <T extends Serializable> Result<T> empty() {
}
}

public BatchResponse(List<Result<Boolean>> deleteResult, List<Result<BlobInfo>> updateResult,
BatchResponse(List<Result<Boolean>> deleteResult, List<Result<BlobInfo>> updateResult,
List<Result<BlobInfo>> getResult) {
this.deleteResult = ImmutableList.copyOf(deleteResult);
this.updateResult = ImmutableList.copyOf(updateResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
/**
* A Google cloud storage object.
*
* <p>
* Objects of this class are immutable. Operations that modify the blob like {@link #update} and
* <p>Objects of this class are immutable. Operations that modify the blob like {@link #update} and
* {@link #copyTo} return a new object. To get a {@code Blob} object with the most recent
* information use {@link #reload}.
* </p>
Expand Down Expand Up @@ -239,13 +238,13 @@ public Blob reload(BlobSourceOption... options) {
* made on the metadata generation of the current blob. If you want to update the information only
* if the current blob metadata are at their latest version use the {@code metagenerationMatch}
* option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch())}.
* <p>
* Original metadata are merged with metadata in the provided {@code blobInfo}. To replace
*
* <p>Original metadata are merged with metadata in the provided {@code blobInfo}. To replace
* metadata instead you first have to unset them. Unsetting metadata can be done by setting the
* provided {@code blobInfo}'s metadata to {@code null}.
* </p>
* <p>
* Example usage of replacing blob's metadata:
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code blob.update(blob.info().toBuilder().metadata(null).build());}
* {@code blob.update(blob.info().toBuilder().metadata(newMetadata).build());}
* </pre>
Expand All @@ -261,6 +260,17 @@ public Blob update(BlobInfo blobInfo, BlobTargetOption... options) {
return new Blob(storage, storage.update(blobInfo, options));
}

/**
* Deletes this blob.
*
* @param options blob delete options
* @return {@code true} if blob was deleted, {@code false} if it was not found
* @throws StorageException upon failure
*/
public boolean delete(BlobSourceOption... options) {
return storage.delete(info.blobId(), toSourceOptions(info, options));
}

/**
* Sends a copy request for the current blob to the target blob. Possibly also some of the
* metadata are copied (e.g. content-type).
Expand All @@ -277,17 +287,6 @@ public CopyWriter copyTo(BlobId targetBlob, BlobSourceOption... options) {
return storage.copy(copyRequest);
}

/**
* Deletes this blob.
*
* @param options blob delete options
* @return {@code true} if blob was deleted, {@code false} if it was not found
* @throws StorageException upon failure
*/
public boolean delete(BlobSourceOption... options) {
return storage.delete(info.blobId(), toSourceOptions(info, options));
}

/**
* Sends a copy request for the current blob to the target bucket, preserving its name. Possibly
* copying also some of the metadata (e.g. content-type).
Expand Down Expand Up @@ -381,8 +380,8 @@ public static List<Blob> get(final Storage storage, BlobId... blobs) {
return Collections.unmodifiableList(Lists.transform(storage.get(blobs),
new Function<BlobInfo, Blob>() {
@Override
public Blob apply(BlobInfo f) {
return f != null ? new Blob(storage, f) : null;
public Blob apply(BlobInfo blobInfo) {
return blobInfo != null ? new Blob(storage, blobInfo) : null;
}
}));
}
Expand Down Expand Up @@ -410,8 +409,8 @@ public static List<Blob> update(final Storage storage, BlobInfo... infos) {
return Collections.unmodifiableList(Lists.transform(storage.update(infos),
new Function<BlobInfo, Blob>() {
@Override
public Blob apply(BlobInfo f) {
return f != null ? new Blob(storage, f) : null;
public Blob apply(BlobInfo blobInfo) {
return blobInfo != null ? new Blob(storage, blobInfo) : null;
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
/**
* A channel for reading data from a Google Cloud Storage object.
*
* Implementations of this class may buffer data internally to reduce remote calls. This interface
* implements {@link Restorable} to allow saving the reader's state to continue reading afterwards.
* <p>Implementations of this class may buffer data internally to reduce remote calls. This
* interface implements {@link Restorable} to allow saving the reader's state to continue reading
* afterwards.
* </p>
*/
public interface BlobReadChannel extends ReadableByteChannel, Closeable,
Restorable<BlobReadChannel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
/**
* A channel for writing data to a Google Cloud Storage object.
*
* Implementations of this class may further buffer data internally to reduce remote calls. Written
* data will only be visible after calling {@link #close()}. This interface implements
* <p>Implementations of this class may further buffer data internally to reduce remote calls.
* Written data will only be visible after calling {@link #close()}. This interface implements
* {@link Restorable} to allow saving the writer's state to continue writing afterwards.
* </p>
*/
public interface BlobWriteChannel extends WritableByteChannel, Closeable,
Restorable<BlobWriteChannel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
/**
* A Google cloud storage bucket.
*
* <p>
* Objects of this class are immutable. Operations that modify the bucket like {@link #update}
* <p>Objects of this class are immutable. Operations that modify the bucket like {@link #update}
* return a new object. To get a {@code Bucket} object with the most recent information use
* {@link #reload}.
* </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public class CopyWriter implements Restorable<CopyWriter> {
/**
* Returns the updated information for the written blob. Calling this method when {@code isDone()}
* is {@code false} will block until all pending chunks are copied.
* <p>
* This method has the same effect of doing:
*
* <p>This method has the same effect of doing:
* <pre> {@code while (!copyWriter.isDone()) {
* copyWriter.copyChunk();
* }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Objects;

/**
* Base class for Storage operation option
* Base class for Storage operation option.
*/
class Option implements Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ public static BlobSourceOption generationMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_MATCH, null);
}

/**
* Returns an option for blob's data generation match. If this option is used the request will
* fail if blob's generation does not match the provided value.
*/
public static BlobSourceOption generationMatch(long generation) {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_MATCH, generation);
}

/**
* Returns an option for blob's data generation mismatch. If this option is used the request
* will fail if blob's generation matches. The generation value to compare with the actual
Expand All @@ -499,10 +507,6 @@ public static BlobSourceOption generationNotMatch() {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_NOT_MATCH, null);
}

public static BlobSourceOption generationMatch(long generation) {
return new BlobSourceOption(StorageRpc.Option.IF_GENERATION_MATCH, generation);
}

/**
* Returns an option for blob's data generation mismatch. If this option is used the request
* will fail if blob's generation matches the provided value.
Expand Down Expand Up @@ -554,6 +558,14 @@ public static BlobGetOption generationMatch() {
return new BlobGetOption(StorageRpc.Option.IF_GENERATION_MATCH, (Long) null);
}

/**
* Returns an option for blob's data generation match. If this option is used the request will
* fail if blob's generation does not match the provided value.
*/
public static BlobGetOption generationMatch(long generation) {
return new BlobGetOption(StorageRpc.Option.IF_GENERATION_MATCH, generation);
}

/**
* Returns an option for blob's data generation mismatch. If this option is used the request
* will fail if blob's generation matches. The generation value to compare with the actual
Expand All @@ -565,10 +577,6 @@ public static BlobGetOption generationNotMatch() {
return new BlobGetOption(StorageRpc.Option.IF_GENERATION_NOT_MATCH, (Long) null);
}

public static BlobGetOption generationMatch(long generation) {
return new BlobGetOption(StorageRpc.Option.IF_GENERATION_MATCH, generation);
}

/**
* Returns an option for blob's data generation mismatch. If this option is used the request
* will fail if blob's generation matches the provided value.
Expand Down Expand Up @@ -1287,8 +1295,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* Update blob information. Original metadata are merged with metadata in the provided
* {@code blobInfo}. To replace metadata instead you first have to unset them. Unsetting metadata
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
* <p>
* Example usage of replacing blob's metadata:
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* </pre>
Expand All @@ -1302,8 +1310,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* Update blob information. Original metadata are merged with metadata in the provided
* {@code blobInfo}. To replace metadata instead you first have to unset them. Unsetting metadata
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
* <p>
* Example usage of replacing blob's metadata:
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* </pre>
Expand Down Expand Up @@ -1360,8 +1368,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* returns, regardless of the {@link CopyRequest#megabytesCopiedPerChunk} parameter.
* If source and destination have different location or storage class {@link CopyWriter#result()}
* might issue multiple RPC calls depending on blob's size.
* <p>
* Example usage of copy:
*
* <p>Example usage of copy:
* <pre> {@code BlobInfo blob = service.copy(copyRequest).result();}
* </pre>
* To explicitly issue chunk copy requests use {@link CopyWriter#copyChunk()} instead:
Expand Down Expand Up @@ -1449,8 +1457,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* is only valid within a certain time period.
* This is particularly useful if you don't want publicly
* accessible blobs, but don't want to require users to explicitly log in.
* <p>
* Example usage of creating a signed URL that is valid for 2 weeks:
*
* <p>Example usage of creating a signed URL that is valid for 2 weeks:
* <pre> {@code
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
* }</pre>
Expand Down
Loading

0 comments on commit b504340

Please sign in to comment.