Skip to content
Browse files

Corrected some directory stuff and updated the whole Vendor thing for…

… Java
  • Loading branch information...
1 parent 18d5692 commit 3c3f5e2d0b9dfc3c6ca16cd11ec5fabe70ba8ca4 @dpp dpp committed Feb 16, 2011
View
0 .../src/main/java/net/liftweb/util/Func.java → ...rc/main/java/net/liftweb/common/Func.java
File renamed without changes.
View
0 ...src/main/java/net/liftweb/util/Func0.java → ...c/main/java/net/liftweb/common/Func0.java
File renamed without changes.
View
0 ...src/main/java/net/liftweb/util/Func1.java → ...c/main/java/net/liftweb/common/Func1.java
File renamed without changes.
View
0 ...src/main/java/net/liftweb/util/Func2.java → ...c/main/java/net/liftweb/common/Func2.java
File renamed without changes.
View
0 ...src/main/java/net/liftweb/util/Func3.java → ...c/main/java/net/liftweb/common/Func3.java
File renamed without changes.
View
0 ...src/main/java/net/liftweb/util/Func4.java → ...c/main/java/net/liftweb/common/Func4.java
File renamed without changes.
View
48 core/util/src/main/java/net/liftweb/util/VendorJ.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2011 WorldWide Conferencing, LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.liftweb.util;
+
+import net.liftweb.common.Func0;
+import java.util.concurrent.Callable;
+
+/**
+ * The bridge from Java to Lift's Vendor stuff
+ */
+public final class VendorJ {
+ private static VendorJBridge j = new VendorJBridge();
+
+ /**
+ * Create a Vendor from a Func0
+ */
+ public static<T> Vendor<T> vendor(Func0<T> f) {
+ return j.vendor(f);
+ }
+
+ /**
+ * Create a Vendor from a Callable
+ */
+ public static<T> Vendor<T> vendor(Callable<T> f) {
+ return j.vendor(f);
+ }
+
+ /**
+ * Create a Vendor from a value
+ */
+ public static<T> Vendor<T> vendor(T v) {
+ return j.vendor(v);
+ }
+}
View
22 core/util/src/main/scala/net/liftweb/util/Maker.scala
@@ -17,7 +17,7 @@
package net.liftweb
package util
-import java.util.concurrent.{ConcurrentHashMap => CHash}
+import java.util.concurrent.{ConcurrentHashMap => CHash, Callable}
import java.lang.ThreadLocal
import scala.reflect.Manifest
import common._
@@ -174,6 +174,26 @@ trait Vendor[T] extends Maker[T] with Function0[T] {
}
/**
+ * A bridge from Java to Scala
+ */
+class VendorJBridge {
+ /**
+ * Create a Vendor from a Func0
+ */
+ def vendor[T](f: Func0[T]): Vendor[T] = Vendor(Func.lift(f))
+
+ /**
+ * Create a Vendor from a Callable
+ */
+ def vendor[T](f: Callable[T]): Vendor[T] = Vendor(Func.lift(f))
+
+ /**
+ * Create a Vendor from a value
+ */
+ def vendor[T](v: T): Vendor[T] = Vendor(v)
+}
+
+/**
* A companion to the Vendor trait
*/
object Vendor {

0 comments on commit 3c3f5e2

Please sign in to comment.
Something went wrong with that request. Please try again.