=htc #19418 avoid LUB problem in javadsl.model.ContentType, see SI-9621

This commit is contained in:
Konrad Malawski 2016-01-14 14:25:43 +01:00
parent 30103888cc
commit 2cd552294d
3 changed files with 47 additions and 42 deletions

View file

@ -1,41 +0,0 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.javadsl.model;
import akka.japi.Option;
/**
* Represents an Http content-type. A content-type consists of a media-type and an optional charset.
*/
public interface ContentType {
/**
* The media-type of this content-type.
*/
MediaType mediaType();
/**
* True if this ContentType is non-textual.
*/
boolean binary();
/**
* Returns the charset if this ContentType is non-binary.
*/
Option<HttpCharset> getCharsetOption();
interface Binary extends ContentType {
}
interface NonBinary extends ContentType {
HttpCharset charset();
}
interface WithFixedCharset extends NonBinary {
}
interface WithCharset extends NonBinary {
}
}

View file

@ -0,0 +1,45 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.javadsl.model
import akka.japi.Option
/**
* Represents an Http content-type. A content-type consists of a media-type and an optional charset.
*/
// Has to be defined in Scala even though it's JavaDSL because of:
// https://issues.scala-lang.org/browse/SI-9621
object ContentType {
trait Binary extends ContentType {
}
trait NonBinary extends ContentType {
def charset: HttpCharset
}
trait WithFixedCharset extends NonBinary {
}
trait WithCharset extends NonBinary {
}
}
trait ContentType {
/**
* The media-type of this content-type.
*/
def mediaType: MediaType
/**
* True if this ContentType is non-textual.
*/
def binary: Boolean
/**
* Returns the charset if this ContentType is non-binary.
*/
def getCharsetOption: Option[HttpCharset]
}

View file

@ -6,8 +6,9 @@ package akka.http.javadsl.model
/**
* Represents an Http media-type. A media-type consists of a main-type and a sub-type.
*
* Has to be defined in Scala even though it's JavaDSL because of: https://issues.scala-lang.org/browse/SI-9621
*/
// Has to be defined in Scala even though it's JavaDSL because of:
// https://issues.scala-lang.org/browse/SI-9621
object MediaType {
trait Binary extends MediaType {