package com.qianwen.core.oss.model;
|
|
import io.minio.messages.Item;
|
import io.minio.messages.Owner;
|
import java.util.Date;
|
import com.qianwen.core.tool.utils.DateUtil;
|
|
public class MinioItem {
|
private String objectName;
|
private Date lastModified;
|
private String etag;
|
private Long size;
|
private String storageClass;
|
private Owner owner;
|
private boolean isDir;
|
private String category;
|
|
public void setObjectName(final String objectName) {
|
this.objectName = objectName;
|
}
|
|
public void setLastModified(final Date lastModified) {
|
this.lastModified = lastModified;
|
}
|
|
public void setEtag(final String etag) {
|
this.etag = etag;
|
}
|
|
public void setSize(final Long size) {
|
this.size = size;
|
}
|
|
public void setStorageClass(final String storageClass) {
|
this.storageClass = storageClass;
|
}
|
|
public void setOwner(final Owner owner) {
|
this.owner = owner;
|
}
|
|
public void setDir(final boolean isDir) {
|
this.isDir = isDir;
|
}
|
|
public void setCategory(final String category) {
|
this.category = category;
|
}
|
|
public boolean equals(final Object o) {
|
if (o == this) {
|
return true;
|
}
|
if (o instanceof MinioItem) {
|
MinioItem other = (MinioItem) o;
|
if (other.canEqual(this) && isDir() == other.isDir()) {
|
Object this$size = getSize();
|
Object other$size = other.getSize();
|
if (this$size == null) {
|
if (other$size != null) {
|
return false;
|
}
|
} else if (!this$size.equals(other$size)) {
|
return false;
|
}
|
Object this$objectName = getObjectName();
|
Object other$objectName = other.getObjectName();
|
if (this$objectName == null) {
|
if (other$objectName != null) {
|
return false;
|
}
|
} else if (!this$objectName.equals(other$objectName)) {
|
return false;
|
}
|
Object this$lastModified = getLastModified();
|
Object other$lastModified = other.getLastModified();
|
if (this$lastModified == null) {
|
if (other$lastModified != null) {
|
return false;
|
}
|
} else if (!this$lastModified.equals(other$lastModified)) {
|
return false;
|
}
|
Object this$etag = getEtag();
|
Object other$etag = other.getEtag();
|
if (this$etag == null) {
|
if (other$etag != null) {
|
return false;
|
}
|
} else if (!this$etag.equals(other$etag)) {
|
return false;
|
}
|
Object this$storageClass = getStorageClass();
|
Object other$storageClass = other.getStorageClass();
|
if (this$storageClass == null) {
|
if (other$storageClass != null) {
|
return false;
|
}
|
} else if (!this$storageClass.equals(other$storageClass)) {
|
return false;
|
}
|
Object this$owner = getOwner();
|
Object other$owner = other.getOwner();
|
if (this$owner == null) {
|
if (other$owner != null) {
|
return false;
|
}
|
} else if (!this$owner.equals(other$owner)) {
|
return false;
|
}
|
Object this$category = getCategory();
|
Object other$category = other.getCategory();
|
return this$category == null ? other$category == null : this$category.equals(other$category);
|
}
|
return false;
|
}
|
return false;
|
}
|
|
protected boolean canEqual(final Object other) {
|
return other instanceof MinioItem;
|
}
|
|
public int hashCode() {
|
int result = (1 * 59) + (isDir() ? 79 : 97);
|
Object $size = getSize();
|
int result2 = (result * 59) + ($size == null ? 43 : $size.hashCode());
|
Object $objectName = getObjectName();
|
int result3 = (result2 * 59) + ($objectName == null ? 43 : $objectName.hashCode());
|
Object $lastModified = getLastModified();
|
int result4 = (result3 * 59) + ($lastModified == null ? 43 : $lastModified.hashCode());
|
Object $etag = getEtag();
|
int result5 = (result4 * 59) + ($etag == null ? 43 : $etag.hashCode());
|
Object $storageClass = getStorageClass();
|
int result6 = (result5 * 59) + ($storageClass == null ? 43 : $storageClass.hashCode());
|
Object $owner = getOwner();
|
int result7 = (result6 * 59) + ($owner == null ? 43 : $owner.hashCode());
|
Object $category = getCategory();
|
return (result7 * 59) + ($category == null ? 43 : $category.hashCode());
|
}
|
|
public String toString() {
|
return "MinioItem(objectName=" + getObjectName() + ", lastModified=" + getLastModified() + ", etag=" + getEtag() + ", size=" + getSize() + ", storageClass=" + getStorageClass() + ", owner=" + getOwner() + ", isDir=" + isDir() + ", category=" + getCategory() + ")";
|
}
|
|
public String getObjectName() {
|
return this.objectName;
|
}
|
|
public Date getLastModified() {
|
return this.lastModified;
|
}
|
|
public String getEtag() {
|
return this.etag;
|
}
|
|
public Long getSize() {
|
return this.size;
|
}
|
|
public String getStorageClass() {
|
return this.storageClass;
|
}
|
|
public Owner getOwner() {
|
return this.owner;
|
}
|
|
public boolean isDir() {
|
return this.isDir;
|
}
|
|
public String getCategory() {
|
return this.category;
|
}
|
|
public MinioItem(Item item) {
|
this.objectName = item.objectName();
|
this.lastModified = DateUtil.toDate(item.lastModified().toLocalDateTime());
|
this.etag = item.etag();
|
this.size = Long.valueOf(item.size());
|
this.storageClass = item.storageClass();
|
this.owner = item.owner();
|
this.isDir = item.isDir();
|
this.category = this.isDir ? "dir" : "file";
|
}
|
}
|