From 0e9fa34d0b730195d2fcbf37b595d02d8a714609 Mon Sep 17 00:00:00 2001 From: Nathaniel Bauernfeind Date: Fri, 14 Dec 2012 18:29:10 -0600 Subject: [PATCH] Move everything to net.codingwell per codingwell/scala-guice#8 --- .../scala/{ => net/codingwell}/package.scala | 14 ++++---- .../scalaguice}/BindingExtensions.scala | 36 +++++++++---------- .../scalaguice}/InjectorExtensions.scala | 8 ++--- .../scalaguice}/KeyExtensions.scala | 6 ++-- .../codingwell/scalaguice}/MultiBinder.scala | 2 +- .../codingwell/scalaguice}/ScalaModule.scala | 2 +- .../codingwell/scalaguice}/SetProvider.scala | 2 +- .../scalaguice}/binder/BindingProxies.scala | 2 +- .../scalaguice}/BindingExtensionsSpec.scala | 18 +++++----- .../scalaguice}/ClassesForTesting.scala | 4 +-- .../scalaguice}/InjectorExtensionsSpec.scala | 6 ++-- .../scalaguice}/MultibinderSpec.scala | 2 +- .../scalaguice}/ScalaModuleSpec.scala | 2 +- .../scalaguice}/ScalaPrivateModuleSpec.scala | 2 +- .../scalaguice}/SetProviderSpec.scala | 2 +- .../scalaguice}/TypeLiteralSpec.scala | 8 ++--- 16 files changed, 58 insertions(+), 58 deletions(-) rename src/main/scala/{ => net/codingwell}/package.scala (98%) rename src/main/scala/{ => net/codingwell/scalaguice}/BindingExtensions.scala (94%) rename src/main/scala/{ => net/codingwell/scalaguice}/InjectorExtensions.scala (95%) rename src/main/scala/{ => net/codingwell/scalaguice}/KeyExtensions.scala (95%) rename src/main/scala/{ => net/codingwell/scalaguice}/MultiBinder.scala (99%) rename src/main/scala/{ => net/codingwell/scalaguice}/ScalaModule.scala (99%) rename src/main/scala/{ => net/codingwell/scalaguice}/SetProvider.scala (97%) rename src/main/scala/{ => net/codingwell/scalaguice}/binder/BindingProxies.scala (98%) rename src/test/scala/{ => net/codingwell/scalaguice}/BindingExtensionsSpec.scala (94%) rename src/test/scala/{ => net/codingwell/scalaguice}/ClassesForTesting.scala (94%) rename src/test/scala/{ => net/codingwell/scalaguice}/InjectorExtensionsSpec.scala (97%) rename src/test/scala/{ => net/codingwell/scalaguice}/MultibinderSpec.scala (99%) rename src/test/scala/{ => net/codingwell/scalaguice}/ScalaModuleSpec.scala (98%) rename src/test/scala/{ => net/codingwell/scalaguice}/ScalaPrivateModuleSpec.scala (99%) rename src/test/scala/{ => net/codingwell/scalaguice}/SetProviderSpec.scala (98%) rename src/test/scala/{ => net/codingwell/scalaguice}/TypeLiteralSpec.scala (97%) diff --git a/src/main/scala/package.scala b/src/main/scala/net/codingwell/package.scala similarity index 98% rename from src/main/scala/package.scala rename to src/main/scala/net/codingwell/package.scala index 57cf8b1..643621a 100644 --- a/src/main/scala/package.scala +++ b/src/main/scala/net/codingwell/package.scala @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings +package net.codingwell package object scalaguice { - + import com.google.inject._ import java.lang.reflect.Type - + private[scalaguice] def typeOf[T](implicit m: Manifest[T]): Type = { def toWrapper(c:Type) = c match { case java.lang.Byte.TYPE => classOf[java.lang.Byte] @@ -43,7 +43,7 @@ package object scalaguice { } } } - + /** * Create a [[com.google.inject.TypeLiteral]] from a [[scala.Manifest]]. * Subtypes of [[scala.AnyVal]] will be converted to their corresponding @@ -52,11 +52,11 @@ package object scalaguice { def typeLiteral[T : Manifest]: TypeLiteral[T] = { TypeLiteral.get(typeOf[T]).asInstanceOf[TypeLiteral[T]] } - + import java.lang.annotation.{Annotation => JAnnotation} - + type AnnotationClass[T <: JAnnotation] = Class[T] - + /** * Get the class for a Java Annotation using a [[scala.Manifest]]. */ diff --git a/src/main/scala/BindingExtensions.scala b/src/main/scala/net/codingwell/scalaguice/BindingExtensions.scala similarity index 94% rename from src/main/scala/BindingExtensions.scala rename to src/main/scala/net/codingwell/scalaguice/BindingExtensions.scala index e5af3ac..c3f619e 100644 --- a/src/main/scala/BindingExtensions.scala +++ b/src/main/scala/net/codingwell/scalaguice/BindingExtensions.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject._ @@ -22,7 +22,7 @@ import com.google.inject._ * These allow using a type parameter instead of classOf[Foo]} * or new TypeLiteral[Bar[Foo]] {}. The extra methods are * named as those in the normal binding DSL suffixed with Type. - * + * * For example, instead of * {{{ * binder.bind(new TypeLiteral[Bar[Foo]]{}).to(classOf[FooBarImpl]) @@ -38,52 +38,52 @@ import com.google.inject._ * manifests for wildcard types don't provide access to type bounds. */ object BindingExtensions { - + class ScalaBinder(b:Binder) { def bindType[T : Manifest] = b bind typeLiteral[T] } - - implicit def enrichBinder(b:Binder) = new ScalaBinder(b) - + + implicit def enrichBinder(b:Binder) = new ScalaBinder(b) + import com.google.inject.binder._ import java.lang.annotation.{Annotation => JAnnotation} - + class ScalaScopedBindingBuilder(b: ScopedBindingBuilder) { def inType[TAnn <: JAnnotation : ClassManifest] = b in annotation[TAnn] } - + implicit def enrichScopedBindingBuilder(b: ScopedBindingBuilder) = new ScalaScopedBindingBuilder(b) class ScalaLinkedBindingBuilder[T](b: LinkedBindingBuilder[T]) { def toType[TImpl <: T : Manifest] = b to typeLiteral[TImpl] def toProviderType[TProvider <: Provider[_ <: T] : ClassManifest] = b toProvider classManifest[TProvider].erasure.asInstanceOf[Class[TProvider]] } - - implicit def enrichLinkedBinding[T](b: LinkedBindingBuilder[T]) = + + implicit def enrichLinkedBinding[T](b: LinkedBindingBuilder[T]) = new ScalaLinkedBindingBuilder[T](b) - + class ScalaAnnotatedBindingBuilder[T](b: AnnotatedBindingBuilder[T]) { - def annotatedWithType[TAnn <: JAnnotation : ClassManifest] = + def annotatedWithType[TAnn <: JAnnotation : ClassManifest] = b annotatedWith annotation[TAnn] } - implicit def enrichAnnotatedBinding[T](b: AnnotatedBindingBuilder[T]) = + implicit def enrichAnnotatedBinding[T](b: AnnotatedBindingBuilder[T]) = new ScalaAnnotatedBindingBuilder[T](b) - + class ScalaAnnotatedConstantBindingBuilder(b: AnnotatedConstantBindingBuilder) { - def annotatedWithType[TAnn <: JAnnotation : ClassManifest] = + def annotatedWithType[TAnn <: JAnnotation : ClassManifest] = b annotatedWith annotation[TAnn] } - + implicit def enrichAnnotatedConstantBindingBuilder(b: AnnotatedConstantBindingBuilder) = new ScalaAnnotatedConstantBindingBuilder(b) class ScalaConstantBindingBuilder(b: ConstantBindingBuilder) { def toType[T: ClassManifest] = b to classManifest[T].erasure } - + implicit def enrichConstantBinding(b: ConstantBindingBuilder) = new ScalaConstantBindingBuilder(b) - + } diff --git a/src/main/scala/InjectorExtensions.scala b/src/main/scala/net/codingwell/scalaguice/InjectorExtensions.scala similarity index 95% rename from src/main/scala/InjectorExtensions.scala rename to src/main/scala/net/codingwell/scalaguice/InjectorExtensions.scala index 1ce09bb..8ff1b0b 100644 --- a/src/main/scala/InjectorExtensions.scala +++ b/src/main/scala/net/codingwell/scalaguice/InjectorExtensions.scala @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject.Injector object InjectorExtensions { - + import KeyExtensions._ - + class ScalaInjector(i:Injector) { def instance[T : Manifest] = i.getInstance(typeLiteral[T].toKey) } - + implicit def enrichInjector(i:Injector) = new ScalaInjector(i) } diff --git a/src/main/scala/KeyExtensions.scala b/src/main/scala/net/codingwell/scalaguice/KeyExtensions.scala similarity index 95% rename from src/main/scala/KeyExtensions.scala rename to src/main/scala/net/codingwell/scalaguice/KeyExtensions.scala index 8ed1e7c..0f958a9 100644 --- a/src/main/scala/KeyExtensions.scala +++ b/src/main/scala/net/codingwell/scalaguice/KeyExtensions.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject._ @@ -24,8 +24,8 @@ object KeyExtensions { implicit def enrichTypeLiteral[T](t: TypeLiteral[T]) = new { def toKey: Key[T] = Key.get(t) def annotatedWith(annotation: JAnnotation): Key[T] = Key.get(t, annotation) - def annotatedWith[TAnn <: JAnnotation : ClassManifest]:Key[T] = + def annotatedWith[TAnn <: JAnnotation : ClassManifest]:Key[T] = Key.get(t, annotation[TAnn]) } - + } diff --git a/src/main/scala/MultiBinder.scala b/src/main/scala/net/codingwell/scalaguice/MultiBinder.scala similarity index 99% rename from src/main/scala/MultiBinder.scala rename to src/main/scala/net/codingwell/scalaguice/MultiBinder.scala index 00a2a1d..9439716 100644 --- a/src/main/scala/MultiBinder.scala +++ b/src/main/scala/net/codingwell/scalaguice/MultiBinder.scala @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject._ import com.google.inject.multibindings._ diff --git a/src/main/scala/ScalaModule.scala b/src/main/scala/net/codingwell/scalaguice/ScalaModule.scala similarity index 99% rename from src/main/scala/ScalaModule.scala rename to src/main/scala/net/codingwell/scalaguice/ScalaModule.scala index 3f62ecc..055da8f 100644 --- a/src/main/scala/ScalaModule.scala +++ b/src/main/scala/net/codingwell/scalaguice/ScalaModule.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject._ import binder._ diff --git a/src/main/scala/SetProvider.scala b/src/main/scala/net/codingwell/scalaguice/SetProvider.scala similarity index 97% rename from src/main/scala/SetProvider.scala rename to src/main/scala/net/codingwell/scalaguice/SetProvider.scala index 4101eb3..262b151 100644 --- a/src/main/scala/SetProvider.scala +++ b/src/main/scala/net/codingwell/scalaguice/SetProvider.scala @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.common.collect.ImmutableSet import com.google.inject._ diff --git a/src/main/scala/binder/BindingProxies.scala b/src/main/scala/net/codingwell/scalaguice/binder/BindingProxies.scala similarity index 98% rename from src/main/scala/binder/BindingProxies.scala rename to src/main/scala/net/codingwell/scalaguice/binder/BindingProxies.scala index ba567fd..b2d6d77 100644 --- a/src/main/scala/binder/BindingProxies.scala +++ b/src/main/scala/net/codingwell/scalaguice/binder/BindingProxies.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice package binder import com.google.inject._ diff --git a/src/test/scala/BindingExtensionsSpec.scala b/src/test/scala/net/codingwell/scalaguice/BindingExtensionsSpec.scala similarity index 94% rename from src/test/scala/BindingExtensionsSpec.scala rename to src/test/scala/net/codingwell/scalaguice/BindingExtensionsSpec.scala index f038691..5d4487e 100644 --- a/src/test/scala/BindingExtensionsSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/BindingExtensionsSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers @@ -21,7 +21,7 @@ import org.scalatest.matchers.ShouldMatchers import com.google.inject._ class BindingExtensionsSpec extends WordSpec with ShouldMatchers { - + import BindingExtensions._ def module(body: Binder => Unit) = new Module { @@ -29,7 +29,7 @@ class BindingExtensionsSpec extends WordSpec with ShouldMatchers { } "Binding extensions" should { - + "allow binding source type using a type parameter" in { Guice createInjector module { binder => binder.bindType[A].to(classOf[B]) @@ -48,27 +48,27 @@ class BindingExtensionsSpec extends WordSpec with ShouldMatchers { } getInstance(new Key[Gen[String]] {}) inst.get should equal ("String") } - + "allow binding between nested types" in { val inst = Guice createInjector module { binder => binder.bindType[Outer.Gen[String]].toType[Outer.C] } getInstance(new Key[Outer.Gen[String]] {}) inst.get should equal ("String") } - - "allow binding to provider using type parameter" in { + + "allow binding to provider using type parameter" in { val inst = Guice createInjector module { binder => binder.bindType[Gen[String]].toProviderType[GenStringProvider] } getInstance(new Key[Gen[String]] {}) inst.get should equal ("String") } - - "allow binding to provider of subtype using type parameter" in { + + "allow binding to provider of subtype using type parameter" in { val inst = Guice createInjector module { binder => binder.bindType[Gen[String]].toProviderType[CProvider] } getInstance(new Key[Gen[String]] {}) inst.get should equal ("String") - } + } } diff --git a/src/test/scala/ClassesForTesting.scala b/src/test/scala/net/codingwell/scalaguice/ClassesForTesting.scala similarity index 94% rename from src/test/scala/ClassesForTesting.scala rename to src/test/scala/net/codingwell/scalaguice/ClassesForTesting.scala index b6680b2..27cc8e6 100644 --- a/src/test/scala/ClassesForTesting.scala +++ b/src/test/scala/net/codingwell/scalaguice/ClassesForTesting.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import com.google.inject.Inject import com.google.inject.Provider @@ -54,6 +54,6 @@ class GenStringProvider extends Provider[Gen[String]] { def get = new C } -class CProvider extends Provider[C] { +class CProvider extends Provider[C] { def get = new C } diff --git a/src/test/scala/InjectorExtensionsSpec.scala b/src/test/scala/net/codingwell/scalaguice/InjectorExtensionsSpec.scala similarity index 97% rename from src/test/scala/InjectorExtensionsSpec.scala rename to src/test/scala/net/codingwell/scalaguice/InjectorExtensionsSpec.scala index afc50e7..4c0d11c 100644 --- a/src/test/scala/InjectorExtensionsSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/InjectorExtensionsSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers @@ -22,7 +22,7 @@ import com.google.inject._ import com.google.inject.name.Names.named class InjectorExtensionsSpec extends WordSpec with ShouldMatchers { - + import InjectorExtensions._ val module = new AbstractModule { @@ -36,7 +36,7 @@ class InjectorExtensionsSpec extends WordSpec with ShouldMatchers { val injector = Guice createInjector module "Injector extensions" should { - + "allow instance to be retrieved using a type parameter" in { injector.instance[A] } diff --git a/src/test/scala/MultibinderSpec.scala b/src/test/scala/net/codingwell/scalaguice/MultibinderSpec.scala similarity index 99% rename from src/test/scala/MultibinderSpec.scala rename to src/test/scala/net/codingwell/scalaguice/MultibinderSpec.scala index 3e8ed25..e08d07e 100644 --- a/src/test/scala/MultibinderSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/MultibinderSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers diff --git a/src/test/scala/ScalaModuleSpec.scala b/src/test/scala/net/codingwell/scalaguice/ScalaModuleSpec.scala similarity index 98% rename from src/test/scala/ScalaModuleSpec.scala rename to src/test/scala/net/codingwell/scalaguice/ScalaModuleSpec.scala index ea16c08..b3a2bd0 100644 --- a/src/test/scala/ScalaModuleSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/ScalaModuleSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers diff --git a/src/test/scala/ScalaPrivateModuleSpec.scala b/src/test/scala/net/codingwell/scalaguice/ScalaPrivateModuleSpec.scala similarity index 99% rename from src/test/scala/ScalaPrivateModuleSpec.scala rename to src/test/scala/net/codingwell/scalaguice/ScalaPrivateModuleSpec.scala index 699faa1..170f9d3 100644 --- a/src/test/scala/ScalaPrivateModuleSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/ScalaPrivateModuleSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers diff --git a/src/test/scala/SetProviderSpec.scala b/src/test/scala/net/codingwell/scalaguice/SetProviderSpec.scala similarity index 98% rename from src/test/scala/SetProviderSpec.scala rename to src/test/scala/net/codingwell/scalaguice/SetProviderSpec.scala index 1db54c1..b66c9e8 100644 --- a/src/test/scala/SetProviderSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/SetProviderSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.WordSpec import org.scalatest.matchers.ShouldMatchers diff --git a/src/test/scala/TypeLiteralSpec.scala b/src/test/scala/net/codingwell/scalaguice/TypeLiteralSpec.scala similarity index 97% rename from src/test/scala/TypeLiteralSpec.scala rename to src/test/scala/net/codingwell/scalaguice/TypeLiteralSpec.scala index 4e0d129..1474947 100644 --- a/src/test/scala/TypeLiteralSpec.scala +++ b/src/test/scala/net/codingwell/scalaguice/TypeLiteralSpec.scala @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package uk.me.lings.scalaguice +package net.codingwell.scalaguice import org.scalatest.Spec import org.scalatest.matchers.ShouldMatchers class TypeLiteralSpec extends Spec with ShouldMatchers { - + import com.google.inject._ object Outer { @@ -39,7 +39,7 @@ class TypeLiteralSpec extends Spec with ShouldMatchers { it("should convert type parameters to wrapper classes") { typeLiteral[List[Int]] should equal (new TypeLiteral[List[java.lang.Integer]] {}) } - + it("should handle nested types") { typeLiteral[Outer.Inner] should equal (TypeLiteral.get(classOf[Outer.Inner])) } @@ -47,7 +47,7 @@ class TypeLiteralSpec extends Spec with ShouldMatchers { it("should handle type parameters that are nested types") { typeLiteral[List[Outer.Inner]] should equal (new TypeLiteral[List[Outer.Inner]] {}) } - + it("should handle type parameters that are arrays") { typeLiteral[Array[Int]] should equal (new TypeLiteral[Array[Int]] {}) }