Package io.github.qishr.cascara.common.util
Class ContentType
java.lang.Object
io.github.qishr.cascara.common.util.ContentType
public class ContentType
A stable, persisted canonical content type used throughout Cascara.This class represents the authoritative identity of a content type, including its canonical ID, canonical name, and the full set of MIME types and filename suffixes associated with it.
ContentType instances are loaded from and saved to the canonical-content-types.yaml registry file. They provide stable, user\u2011facing identifiers that remain consistent across application runs, module changes, and plugin installations.
All editor selection, syntax highlighting, file associations, and user preferences should reference ContentType.
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
| protected String | canonicalId | |
| protected List |
mimeTypes | |
| protected String | name | |
| protected List |
suffixes |
Constructor Summary
| Constructor | Description |
|---|---|
| ContentType() | |
| ContentType(String name) |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public ContentType | withType(String mimeType) | |
| public ContentType | withSuffix(String suffix) | |
| public String | getCanonicalId() | |
| public void | setCanonicalId(String id) | |
| public String | getName() | |
| public void | setName(String canonicalName) | |
| public List<String> | getMimeTypes() | |
| public void | setMimeTypes(List<String> mimeTypes) | |
| public List<String> | getSuffixes() | |
| public void | setSuffixes(List<String> suffixes) | |
| public boolean | isText() | |
| public boolean | matches(String mimeType) | |
| public boolean | matches(ContentType contentType) | |
| public String | toString() | |
| public int | hashCode() | |
| public boolean | equals(Object o) |
Field Details
canonicalId
@io.github.qishr.cascara.common.lang.annotation.DataField
protected String canonicalId
mimeTypes
@io.github.qishr.cascara.common.lang.annotation.DataField
protected List
name
@io.github.qishr.cascara.common.lang.annotation.DataField
protected String name
suffixes
@io.github.qishr.cascara.common.lang.annotation.DataField
protected List
Method Details
withType
public ContentType withType(String mimeType)
withSuffix
public ContentType withSuffix(String suffix)
getCanonicalId
public String getCanonicalId()
setCanonicalId
public void setCanonicalId(String id)
getName
public String getName()
setName
public void setName(String canonicalName)
getMimeTypes
public List<String> getMimeTypes()
setMimeTypes
public void setMimeTypes(List<String> mimeTypes)
getSuffixes
public List<String> getSuffixes()
setSuffixes
public void setSuffixes(List<String> suffixes)
isText
public boolean isText()
matches
public boolean matches(String mimeType)
matches
public boolean matches(ContentType contentType)
toString
public String toString()
hashCode
public int hashCode()
equals
public boolean equals(Object o)