-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added standard types enum (#29)
Added some standard types and wildcard type. Ticket: #27
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* The MIT License (MIT) Copyright (c) 2017-2021 Kirill Ch. <g4s8.public@gmail.com> | ||
* https://github.com/g4s8/mime/LICENSE.txt | ||
*/ | ||
package wtf.g4s8.mime; | ||
|
||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
/** | ||
* Standard MIME types. | ||
* @since 2.2 | ||
*/ | ||
public enum StandardTypes implements MimeType { | ||
|
||
WILDCARD("*", "*"), | ||
APPLICATION_OCTETSTREAM("application", "octet-stream"), | ||
TEXT_PLAIN("text", "plain"), | ||
TEXT_CSS("text", "css"), | ||
TEXT_HTML("text", "html"), | ||
TEXT_JAVASCRIPT("text", "javascript"), | ||
APPLICATION_JAVASCRIPT("application", "javascript"); | ||
|
||
/** | ||
* Origin MIME. | ||
*/ | ||
private final MimeType origin; | ||
|
||
/** | ||
* Private enum constructor. | ||
* @param type MIME type | ||
* @param subtype MIME subtype | ||
*/ | ||
private StandardTypes(final String type, final String subtype) { | ||
this.origin = new MimeTypeSimple(type, subtype); | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return this.origin.type(); | ||
} | ||
|
||
@Override | ||
public String subtype() { | ||
return this.origin.subtype(); | ||
} | ||
|
||
@Override | ||
public Optional<String> param(String name) { | ||
return this.origin.param(name); | ||
} | ||
|
||
@Override | ||
public Set<String> params() { | ||
return this.origin.params(); | ||
} | ||
} |