Package mops.persistence.file
Class FileInfo
- java.lang.Object
-
- mops.persistence.file.FileInfo
-
@AggregateRoot public class FileInfo extends java.lang.Object
Represents a file.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<FileInfo>NAME_COMPARATORName Comparator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileInfoBuilderbuilder()Gives you FileInfoBuilder.protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)java.time.InstantgetAvailableFrom()Get the available from time.java.time.InstantgetAvailableTo()Get the available to time.java.time.InstantgetCreationTime()Get the creation time.longgetDirectoryId()Id of the Directory this file resides in.java.lang.LonggetId()Database Id.java.time.InstantgetLastModifiedTime()Get the last modified time.@NonNull java.lang.StringgetName()File name.@NonNull java.lang.StringgetOwner()Username of the owner.longgetSize()Size in bytes.java.lang.StringgetSizeString()Converts Byte to a String.@NonNull java.util.Set<mops.persistence.file.FileTag>getTags()File tags.@NonNull java.lang.StringgetType()File type.inthashCode()booleanhasTag(java.lang.String otherTag)Checks if the file is tagged with a specific tag.booleanisAvailable(java.time.Instant time)Tests whether this file is available at the given time.voidsetDirectoryId(long directoryId)Id of the Directory this file resides in.voidsetName(@NonNull java.lang.String name)File name.voidsetOwner(@NonNull java.lang.String owner)Username of the owner.voidsetSize(long size)Size in bytes.voidsetTags(@NonNull java.util.Set<mops.persistence.file.FileTag> tags)File tags.voidsetType(@NonNull java.lang.String type)File type.java.lang.StringtoString()
-
-
-
Field Detail
-
NAME_COMPARATOR
public static final java.util.Comparator<FileInfo> NAME_COMPARATOR
Name Comparator.
-
-
Method Detail
-
builder
public static FileInfoBuilder builder()
Gives you FileInfoBuilder.- Returns:
- FileInfoBuilder
-
hasTag
public boolean hasTag(java.lang.String otherTag)
Checks if the file is tagged with a specific tag.- Parameters:
otherTag- tag to check for- Returns:
- boolean
-
getAvailableFrom
public java.time.Instant getAvailableFrom()
Get the available from time.- Returns:
- available from time
-
getAvailableTo
public java.time.Instant getAvailableTo()
Get the available to time.- Returns:
- available to time
-
getCreationTime
public java.time.Instant getCreationTime()
Get the creation time.- Returns:
- creation time
-
getLastModifiedTime
public java.time.Instant getLastModifiedTime()
Get the last modified time.- Returns:
- last modified time
-
getSizeString
public java.lang.String getSizeString()
Converts Byte to a String.- Returns:
- Filesize with prefix.
-
isAvailable
public boolean isAvailable(java.time.Instant time)
Tests whether this file is available at the given time.- Parameters:
time- current time- Returns:
- if this file is available
-
getId
public java.lang.Long getId()
Database Id.
-
getName
@NonNull public @NonNull java.lang.String getName()
File name.
-
getDirectoryId
public long getDirectoryId()
Id of the Directory this file resides in.
-
getType
@NonNull public @NonNull java.lang.String getType()
File type.
-
getSize
public long getSize()
Size in bytes.
-
getOwner
@NonNull public @NonNull java.lang.String getOwner()
Username of the owner.
-
getTags
@NonNull public @NonNull java.util.Set<mops.persistence.file.FileTag> getTags()
File tags.
-
setName
public void setName(@NonNull @NonNull java.lang.String name)File name.
-
setDirectoryId
public void setDirectoryId(long directoryId)
Id of the Directory this file resides in.
-
setType
public void setType(@NonNull @NonNull java.lang.String type)File type.
-
setSize
public void setSize(long size)
Size in bytes.
-
setOwner
public void setOwner(@NonNull @NonNull java.lang.String owner)Username of the owner.
-
setTags
public void setTags(@NonNull @NonNull java.util.Set<mops.persistence.file.FileTag> tags)File tags.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-