Package com.kazurayam.materialstore.core
Class Material
java.lang.Object
com.kazurayam.materialstore.core.Material
- All Implemented Interfaces:
Identifiable
,Jsonifiable
,TemplateReady
,Comparable<Material>
public final class Material
extends Object
implements Comparable<Material>, Jsonifiable, TemplateReady, Identifiable
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMaterial
(Store store, JobName jobName, JobTimestamp jobTimestamp, IndexEntry indexEntry) Material
(Store store, JobName jobName, JobTimestamp jobTimestamp, IndexEntry indexEntry, String randomId) -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
getID()
static InputStream
static InputStream
getStore()
int
hashCode()
boolean
isEmpty()
boolean
isSimilarTo
(Material other) static byte[]
static byte[]
static Material
static byte[]
readInputStream
(InputStream inputStream) toJson()
toJson
(boolean prettyPrint) toPath()
turn the Material object to a Path relative to the root.toString()
toURL()
toVariableJson
(SortKeys sortKeys) toVariableJson
(SortKeys sortKeys, boolean prettyPrint) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.kazurayam.materialstore.core.TemplateReady
toTemplateModel, toTemplateModelAsJson, toTemplateModelAsJson
-
Field Details
-
NULL_OBJECT
-
-
Constructor Details
-
Material
-
Material
public Material(Store store, JobName jobName, JobTimestamp jobTimestamp, IndexEntry indexEntry, String randomId)
-
-
Method Details
-
newEmptyMaterial
-
getFileType
-
getDescription
-
getDescriptionSignature
-
getDiffability
-
getJobName
-
getJobTimestamp
-
getIndexEntry
-
getMetadata
-
getRelativePath
- Returns:
- the String of relative path of the MaterialIO file,
relative to the root dir.
On Mac and Linux, the path separator will be '/',
On Windows, the path separator will be '\'
Materialオブジェクトが表すファイルのパス(ただしrootを基底とする相対パス)のString表現を返す。
ああ、このメソッドひとつをきれいに実装するために materialstore を作ったのだ。 Materialsライブラリのぐちゃぐちゃさ加減に比べてこの実装の簡潔なことよ。
-
getStore
-
loadNoCounterpartPng
- Throws:
MaterialstoreException
-
loadNoCounterpartText
- Throws:
MaterialstoreException
-
getNoCounterpartPngAsInputStream
-
getNoCounterpartTxtAsInputStream
-
readInputStream
- Throws:
MaterialstoreException
-
getRelativeURL
- Returns:
- the returned value of getRelative() is stringified, and replace all of `\` character to `/` to make it a valid relative URL string. Material.NULL_OBJECT.getRelativeURL() will return a string which represent the "No Material is Found" image encoded by base64. It will like something like "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4 //8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
-
getID
- Specified by:
getID
in interfaceIdentifiable
-
getShortID
- Specified by:
getShortID
in interfaceIdentifiable
-
toPath
turn the Material object to a Path relative to the root.- Returns:
- the absolute Path of this Material
-
toURL
- Throws:
MaterialstoreException
-
isSimilarTo
-
equals
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Material>
-
toJson
- Specified by:
toJson
in interfaceJsonifiable
-
toJson
- Specified by:
toJson
in interfaceJsonifiable
-
toVariableJson
-
toVariableJson
-