Skip to content

Commit

Permalink
s/Super/AnyVal
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jun 7, 2016
1 parent 03a50ec commit 18267aa
Show file tree
Hide file tree
Showing 34 changed files with 33 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object DurationBuilder {
}

// Duration Builder
class DurationBuilder(val underlying: Period) extends Super {
class DurationBuilder(val underlying: Period) extends AnyVal {
// DurationBuilder + DurationBuilder = DurationBuilder
// This is the only operation that can maintain a DurationBuilder
// Everything else kicks us out to DateTime, Duration, or Period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.{Locale, Calendar}
import org.joda.time.base.AbstractDateTime
import com.github.nscala_time.PimpedType

class RichAbstractDateTime(val underlying: AbstractDateTime) extends Super
class RichAbstractDateTime(val underlying: AbstractDateTime) extends AnyVal
with PimpedType[AbstractDateTime] {

def calendar(locale: Locale): Calendar = underlying.toCalendar(locale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.joda.time._
import org.joda.time.base.AbstractInstant
import com.github.nscala_time.PimpedType

class RichAbstractInstant(val underlying: AbstractInstant) extends Super
class RichAbstractInstant(val underlying: AbstractInstant) extends AnyVal
with PimpedType[AbstractInstant] {

def date: Date = underlying.toDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time.base.AbstractPartial
import com.github.nscala_time.PimpedType

class RichAbstractPartial(val underlying: AbstractPartial) extends Super with Ordered[AbstractPartial] with
class RichAbstractPartial(val underlying: AbstractPartial) extends AnyVal with Ordered[AbstractPartial] with
PimpedType[AbstractPartial] {
def fields = underlying.getFields
def fieldTypes = underlying.getFieldTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.joda.time._
import org.joda.time.field.AbstractReadableInstantFieldProperty
import com.github.nscala_time.PimpedType

class RichAbstractReadableInstantFieldProperty(val underlying: AbstractReadableInstantFieldProperty) extends Super
class RichAbstractReadableInstantFieldProperty(val underlying: AbstractReadableInstantFieldProperty) extends AnyVal
with PimpedType[AbstractReadableInstantFieldProperty] {

def shortText: String = underlying.getAsShortText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichChronology(val underlying: Chronology) extends Super with PimpedType[Chronology] {
class RichChronology(val underlying: Chronology) extends AnyVal with PimpedType[Chronology] {

def zone: Option[DateTimeZone] = nullCheck(underlying.getZone)

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/github/nscala_time/time/RichDate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.util.Date
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichDate(val underlying: Date) extends Super with PimpedType[Date] {
class RichDate(val underlying: Date) extends AnyVal with PimpedType[Date] {

def toLocalDateTime: LocalDateTime = StaticLocalDateTime.fromDateFields(underlying)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichDateTime(val underlying: DateTime) extends Super with PimpedType[DateTime] {
class RichDateTime(val underlying: DateTime) extends AnyVal with PimpedType[DateTime] {

def -(duration: Long): DateTime = underlying.minus(duration)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.joda.time.format.{DateTimeFormatter, DateTimeParser,
DateTimePrinter}
import com.github.nscala_time.PimpedType

class RichDateTimeFormatter(val underlying: DateTimeFormatter) extends Super
class RichDateTimeFormatter(val underlying: DateTimeFormatter) extends AnyVal
with PimpedType[DateTimeFormatter] {

def chronology: Chronology = underlying.getChronology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichDateTimeProperty(val underlying: DateTime.Property) extends Super with PimpedType[DateTime.Property] {
class RichDateTimeProperty(val underlying: DateTime.Property) extends AnyVal with PimpedType[DateTime.Property] {

def dateTime: DateTime = underlying.getDateTime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichDateTimeZone(val underlying: DateTimeZone) extends Super with PimpedType[DateTimeZone] {
class RichDateTimeZone(val underlying: DateTimeZone) extends AnyVal with PimpedType[DateTimeZone] {

def id: String = underlying.getID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.joda.time._
import com.github.nscala_time.PimpedType
import scala.concurrent.duration.{ MILLISECONDS , FiniteDuration }

class RichDuration(val underlying: Duration) extends Super with PimpedType[Duration] {
class RichDuration(val underlying: Duration) extends AnyVal with PimpedType[Duration] {

def days: Long = underlying.getStandardDays

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichInstant(val underlying: Instant) extends Super with PimpedType[Instant] {
class RichInstant(val underlying: Instant) extends AnyVal with PimpedType[Instant] {

def -(duration: Long): Instant = underlying.minus(duration)

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/github/nscala_time/time/RichInt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichInt(val underlying: Int) extends Super with PimpedType[Int] {
class RichInt(val underlying: Int) extends AnyVal with PimpedType[Int] {
// These units of time can build durations or periods.
// At most we lose a leap second. (Unless someone adopts
// leap minutes).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.github.nscala_time.PimpedType
import org.joda.time._
import scala.collection.generic.CanBuildFrom

class RichInterval(val underlying: Interval) extends Super with PimpedType[Interval] {
class RichInterval(val underlying: Interval) extends AnyVal with PimpedType[Interval] {

/** Returns a collection containing every instance between the interval, `period` time apart.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalDate(val underlying: LocalDate) extends Super with PimpedType[LocalDate] {
class RichLocalDate(val underlying: LocalDate) extends AnyVal with PimpedType[LocalDate] {

def -(period: ReadablePeriod): LocalDate = underlying.minus(period)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalDateProperty(val underlying: LocalDate.Property) extends Super with PimpedType[LocalDate.Property] {
class RichLocalDateProperty(val underlying: LocalDate.Property) extends AnyVal with PimpedType[LocalDate.Property] {

def localDate: LocalDate = underlying.getLocalDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalDateTime(val underlying: LocalDateTime) extends Super with PimpedType[LocalDateTime] {
class RichLocalDateTime(val underlying: LocalDateTime) extends AnyVal with PimpedType[LocalDateTime] {

def -(duration: ReadableDuration): LocalDateTime = underlying.minus(duration)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalDateTimeProperty(val underlying: LocalDateTime.Property) extends Super
class RichLocalDateTimeProperty(val underlying: LocalDateTime.Property) extends AnyVal
with PimpedType[LocalDateTime.Property] {

def localDateTime: LocalDateTime = underlying.getLocalDateTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalTime(val underlying: LocalTime) extends Super with PimpedType[LocalTime] {
class RichLocalTime(val underlying: LocalTime) extends AnyVal with PimpedType[LocalTime] {

def -(period: ReadablePeriod): LocalTime = underlying.minus(period)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLocalTimeProperty(val underlying: LocalTime.Property) extends Super with PimpedType[LocalTime.Property] {
class RichLocalTimeProperty(val underlying: LocalTime.Property) extends AnyVal with PimpedType[LocalTime.Property] {

def localTime: LocalTime = underlying.getLocalTime

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/github/nscala_time/time/RichLong.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichLong(val underlying: Long) extends Super with PimpedType[Long] {
class RichLong(val underlying: Long) extends AnyVal with PimpedType[Long] {

def toDateTime = new DateTime(underlying)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichPartial(val underlying: Partial) extends Super with PimpedType[Partial] {
class RichPartial(val underlying: Partial) extends AnyVal with PimpedType[Partial] {

def formatter = underlying.getFormatter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.Locale
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichPartialProperty(val underlying: Partial.Property) extends Super with PimpedType[Partial.Property] {
class RichPartialProperty(val underlying: Partial.Property) extends AnyVal with PimpedType[Partial.Property] {

def partial: Partial = underlying.getPartial

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichPeriod(val underlying: Period) extends Super with PimpedType[Period] {
class RichPeriod(val underlying: Period) extends AnyVal with PimpedType[Period] {

def days: Int = underlying.getDays

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadableDateTime(val underlying: ReadableDateTime) extends Super
class RichReadableDateTime(val underlying: ReadableDateTime) extends AnyVal
with PimpedType[ReadableDateTime] {

def second: Int = underlying.getSecondOfMinute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadableDuration(val underlying: ReadableDuration) extends Super with Ordered[ReadableDuration]
class RichReadableDuration(val underlying: ReadableDuration) extends AnyVal with Ordered[ReadableDuration]
with PimpedType[ReadableDuration] {

def millis: Long = underlying.getMillis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadableInstant(val underlying: ReadableInstant) extends Super with Ordered[ReadableInstant]
class RichReadableInstant(val underlying: ReadableInstant) extends AnyVal with Ordered[ReadableInstant]
with PimpedType[ReadableInstant] {

def chronology: Chronology = underlying.getChronology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadableInterval(val underlying: ReadableInterval) extends Super
class RichReadableInterval(val underlying: ReadableInterval) extends AnyVal
with PimpedType[ReadableInterval] {

def chronology: Chronology = underlying.getChronology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadablePartial(val underlying: ReadablePartial) extends Super with PimpedType[ReadablePartial] {
class RichReadablePartial(val underlying: ReadablePartial) extends AnyVal with PimpedType[ReadablePartial] {

def chronology = underlying.getChronology

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.github.nscala_time.time
import org.joda.time._
import com.github.nscala_time.PimpedType

class RichReadablePeriod(val underlying: ReadablePeriod) extends Super with PimpedType[ReadablePeriod] {
class RichReadablePeriod(val underlying: ReadablePeriod) extends AnyVal with PimpedType[ReadablePeriod] {

def periodType: PeriodType = underlying.getPeriodType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.joda.time._
import com.github.nscala_time.PimpedType
import scala.concurrent.duration.{ Duration => SDuration }

class RichSDuration(val underlying: SDuration) extends Super with PimpedType[SDuration] {
class RichSDuration(val underlying: SDuration) extends AnyVal with PimpedType[SDuration] {

def toJodaDuration: Duration = new Duration(underlying.toMillis)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.joda.time._

import org.joda.time.format.DateTimeFormat

class RichString(val s: String) extends Super {
class RichString(val s: String) extends AnyVal {
def toDateTime = new DateTime(s)
def toInterval = new Interval(s)
def toLocalDate = new LocalDate(s)
Expand Down
5 changes: 0 additions & 5 deletions src/main/scala/com/github/nscala_time/time/package.scala

This file was deleted.

0 comments on commit 18267aa

Please sign in to comment.