Object

com.eharmony.aloha.score.proto.conversions

StrictConversions

Related Doc: package conversions

Permalink

object StrictConversions extends BasicTypeScoreConversions[[+A]Option[Either[ScoreType, A]]]

This object differentiates between a missing score and a score that could not be retrieved because the wrong type was queried. This is harder to deal with than com.eharmony.aloha.score.proto.conversions.RelaxedConversions but encodes additional information. Example usage:

// Scala
import com.eharmony.aloha.io.score.ops.StrictConversions._
val asdf: Option[Boolean] = asBoolean(s).map(_.fold(t => throw new Exception("Tried to get a " + t + " as a Boolean"), identity))

// Java
import static com.eharmony.aloha.score.proto.conversions.StrictConversions.*;
// ...
Boolean b = null;
try {
  b = asJavaBoolean(s);
} catch (IncorrectScoreTypeAccessException e) {
  // ...
}

Note: If the score value in the score doesn't exist, then the java converters will return null. If however a score exists but the data type contained in the score is different from the queried type, the java-oriented converters will throw an com.eharmony.aloha.score.proto.conversions.IncorrectScoreTypeAccessException.

Linear Supertypes
BasicTypeScoreConversions[[+A]Option[Either[ScoreType, A]]], BasicTypeJavaScoreConversions, BasicScalaTypeConversions[[+A]Option[Either[ScoreType, A]]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StrictConversions
  2. BasicTypeScoreConversions
  3. BasicTypeJavaScoreConversions
  4. BasicScalaTypeConversions
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asBoolean(s: Score): Option[Either[ScoreType, Boolean]]

    Permalink

    Get the score as a Boolean wrapped in a container where the outermost container type is Option.

    Get the score as a Boolean wrapped in a container where the outermost container type is Option. If the Score object doesn't contain a valid score, Return None; otherwise return Some. Note that subclasses will contain different representations of score.

    s

    the score

    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  5. final def asByte(s: Score): Option[Either[ScoreType, Byte]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  6. final def asDouble(s: Score): Option[Either[ScoreType, Double]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  7. final def asFloat(s: Score): Option[Either[ScoreType, Float]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. final def asInt(s: Score): Option[Either[ScoreType, Int]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  10. def asJavaBoolean(s: Score): Boolean

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-boolean score." ) @inline()
  11. def asJavaByte(s: Score): Byte

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-byte score." ) @inline()
  12. def asJavaDouble(s: Score): Double

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-double score." ) @inline()
  13. def asJavaFloat(s: Score): Float

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-float score." ) @inline()
  14. def asJavaInteger(s: Score): Integer

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-integer score." ) @inline()
  15. def asJavaLong(s: Score): Long

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-long score." ) @inline()
  16. def asJavaShort(s: Score): Short

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-short score." ) @inline()
  17. def asJavaString(s: Score): String

    Permalink
    Definition Classes
    StrictConversionsBasicTypeScoreConversionsBasicTypeJavaScoreConversions
    Annotations
    @throws( "if called on a non-string score." ) @inline()
  18. final def asLong(s: Score): Option[Either[ScoreType, Long]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  19. final def asShort(s: Score): Option[Either[ScoreType, Short]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  20. final def asString(s: Score): Option[Either[ScoreType, String]]

    Permalink
    Definition Classes
    BasicTypeScoreConversionsBasicScalaTypeConversions
    Annotations
    @inline()
  21. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def conversion[A](s: Score)(implicit arg0: ScoreConverter[A]): Option[Either[ScoreType, A]]

    Permalink

    Convert a score to a container the score.

    Convert a score to a container the score.

    A

    the type to which the score should be converted.

    s

    the score

    returns

    a container containing a value of the expected output type.

    Attributes
    protected[this]
    Definition Classes
    StrictConversionsBasicTypeScoreConversions
  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. def javaMapper[A](s: Score, container: Option[Either[ScoreType, A]])(implicit arg0: RefInfo[A]): Option[A]

    Permalink

    If no score is present, return None; if a score is present but the wrong type of score was queried, throw an com.eharmony.aloha.score.proto.conversions.IncorrectScoreTypeAccessException.

    If no score is present, return None; if a score is present but the wrong type of score was queried, throw an com.eharmony.aloha.score.proto.conversions.IncorrectScoreTypeAccessException.

    Attributes
    protected[this]
    Definition Classes
    StrictConversionsBasicTypeScoreConversions
    Annotations
    @throws( ... )
  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from BasicTypeScoreConversions[[+A]Option[Either[ScoreType, A]]]

Inherited from BasicScalaTypeConversions[[+A]Option[Either[ScoreType, A]]]

Inherited from AnyRef

Inherited from Any

Ungrouped