Class MimeType
-
- All Implemented Interfaces:
public final class MimeTypeRepresents the language and dialect of a source snippet, as an RFC 2046 mime type.
For example, a Kotlin source file may have the mime type
text/kotlin. However, if it corresponds to abuild.gradle.ktsfile, we'll also attach the mime parameterrole=gradle, resulting in mime typetext/kotlin; role=gradle.For XML resource files, we'll attach other attributes; for example
role=manifestfor Android manifest files androle=resourcefor XML resource files. For the latter we may also attach for examplefolderType=values, and for XML files in general, the root tag, such astext/xml; role=resource; folderType=layout; rootTag=LinearLayout.This class does not implement all aspects of the RFC; in particular, we don't treat attributes as case-insensitive, and we only support value tokens, not value strings -- neither of these are needed for our purposes.
This is implemented using a value class, such that behind the scenes we're really just passing a String around. This also means we can't initialize related values such as the corresponding Markdown fenced block names, or IntelliJ language id's. Instead, these are looked up via
when-tables. When adding a new language, update all lookup methods:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMimeType.Known
-
Method Summary
-
-
Constructor Detail
-
MimeType
MimeType(String mimeType)
-
-
-
-