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 Details

    • NULL_OBJECT

      public static final Material NULL_OBJECT
  • Constructor Details

  • Method Details

    • newEmptyMaterial

      public static Material newEmptyMaterial()
    • getFileType

      public IFileType getFileType()
    • getDescription

      public String getDescription()
    • getDescriptionSignature

      public String getDescriptionSignature()
    • getDiffability

      public FileTypeDiffability getDiffability()
    • getJobName

      public JobName getJobName()
    • getJobTimestamp

      public JobTimestamp getJobTimestamp()
    • getIndexEntry

      public IndexEntry getIndexEntry()
    • getMetadata

      public Metadata getMetadata()
    • getRelativePath

      public Path 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

      public Store getStore()
    • loadNoCounterpartPng

      public static byte[] loadNoCounterpartPng() throws MaterialstoreException
      Throws:
      MaterialstoreException
    • loadNoCounterpartText

      public static byte[] loadNoCounterpartText() throws MaterialstoreException
      Throws:
      MaterialstoreException
    • getNoCounterpartPngAsInputStream

      public static InputStream getNoCounterpartPngAsInputStream()
    • getNoCounterpartTxtAsInputStream

      public static InputStream getNoCounterpartTxtAsInputStream()
    • readInputStream

      public static byte[] readInputStream(InputStream inputStream) throws MaterialstoreException
      Throws:
      MaterialstoreException
    • getRelativeURL

      public String 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

      public ID getID()
      Specified by:
      getID in interface Identifiable
    • getShortID

      public String getShortID()
      Specified by:
      getShortID in interface Identifiable
    • toPath

      public Path toPath()
      turn the Material object to a Path relative to the root.
      Returns:
      the absolute Path of this Material
    • toURL

      public URL toURL() throws MaterialstoreException
      Throws:
      MaterialstoreException
    • isSimilarTo

      public boolean isSimilarTo(Material other)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isEmpty

      public boolean isEmpty()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Material other)
      Specified by:
      compareTo in interface Comparable<Material>
    • toJson

      public String toJson()
      Specified by:
      toJson in interface Jsonifiable
    • toJson

      public String toJson(boolean prettyPrint)
      Specified by:
      toJson in interface Jsonifiable
    • toVariableJson

      public String toVariableJson(SortKeys sortKeys)
    • toVariableJson

      public String toVariableJson(SortKeys sortKeys, boolean prettyPrint)