Author: pete.muir(a)jboss.org
Date: 2009-06-08 09:02:25 -0400 (Mon, 08 Jun 2009)
New Revision: 2781
Modified:
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/wicket/gae/src/main/java/org/jboss/webbeans/examples/wicket/Game.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/examples/wicket/Game.java
Log:
update to new api
Modified:
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
---
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
12:59:51 UTC (rev 2780)
+++
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
13:02:25 UTC (rev 2781)
@@ -5,14 +5,13 @@
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Named;
-import javax.enterprise.inject.spi.BeanManager;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
+import javax.inject.Obtains;
@Named
@SessionScoped
@@ -29,7 +28,7 @@
private int biggest;
private int remainingGuesses;
- @Current BeanManager manager;
+ @Obtains @Random Instance<Integer> randomNumber;
public Game()
{
@@ -90,7 +89,7 @@
this.guess = 0;
this.remainingGuesses = 10;
this.biggest = maxNumber;
- this.number = manager.getInstanceByType(Integer.class, new
AnnotationLiteral<Random>(){});
+ this.number = randomNumber.get();
}
public void validateNumberRange(FacesContext context, UIComponent toValidate, Object
value)
Modified:
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
---
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
12:59:51 UTC (rev 2780)
+++
examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
13:02:25 UTC (rev 2781)
@@ -5,14 +5,13 @@
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Named;
-import javax.enterprise.inject.spi.BeanManager;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
+import javax.inject.Obtains;
@Named
@SessionScoped
@@ -29,7 +28,7 @@
private int biggest;
private int remainingGuesses;
- @Current BeanManager manager;
+ @Obtains @Random Instance<Integer> randomNumber;
public Game()
{
@@ -90,7 +89,7 @@
this.guess = 0;
this.remainingGuesses = 10;
this.biggest = maxNumber;
- this.number = manager.getInstanceByType(Integer.class, new
AnnotationLiteral<Random>(){});
+ this.number = randomNumber.get();
}
public void validateNumberRange(FacesContext context, UIComponent toValidate, Object
value)
Modified:
examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
---
examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
12:59:51 UTC (rev 2780)
+++
examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-06-08
13:02:25 UTC (rev 2781)
@@ -6,13 +6,12 @@
import javax.annotation.Named;
import javax.annotation.PostConstruct;
import javax.context.SessionScoped;
+import javax.enterprise.inject.Instance;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
-import javax.inject.AnnotationLiteral;
-import javax.inject.Current;
-import javax.inject.manager.Manager;
+import javax.inject.Obtains;
import javax.naming.NamingException;
@Named
@@ -30,7 +29,7 @@
private int biggest;
private int remainingGuesses;
- @Current Manager manager;
+ @Obtains @Random Instance<Integer> randomNumber;
public Game() throws NamingException {}
@@ -89,7 +88,7 @@
this.guess = 0;
this.remainingGuesses = 10;
this.biggest = maxNumber;
- this.number = manager.getInstanceByType(Integer.class, new
AnnotationLiteral<Random>(){});
+ this.number = randomNumber.get();;
}
public void validateNumberRange(FacesContext context, UIComponent toValidate, Object
value)
Modified:
examples/trunk/wicket/gae/src/main/java/org/jboss/webbeans/examples/wicket/Game.java
===================================================================
---
examples/trunk/wicket/gae/src/main/java/org/jboss/webbeans/examples/wicket/Game.java 2009-06-08
12:59:51 UTC (rev 2780)
+++
examples/trunk/wicket/gae/src/main/java/org/jboss/webbeans/examples/wicket/Game.java 2009-06-08
13:02:25 UTC (rev 2781)
@@ -6,9 +6,8 @@
import javax.annotation.Named;
import javax.annotation.PostConstruct;
import javax.context.SessionScoped;
-import javax.inject.AnnotationLiteral;
-import javax.inject.Current;
-import javax.inject.manager.Manager;
+import javax.inject.Instance;
+import javax.inject.Obtains;
@Named
@SessionScoped
@@ -25,7 +24,7 @@
private int biggest;
private int remainingGuesses;
- @Current Manager manager;
+ @Obtains @Random Instance<Integer> randomNumber;
public int getNumber()
{
@@ -79,7 +78,7 @@
this.guess = 0;
this.remainingGuesses = 10;
this.biggest = maxNumber;
- this.number = manager.getInstanceByType(Integer.class, new
AnnotationLiteral<Random>(){});
+ this.number = randomNumber.get();
}
Modified:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/examples/wicket/Game.java
===================================================================
---
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/examples/wicket/Game.java 2009-06-08
12:59:51 UTC (rev 2780)
+++
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/examples/wicket/Game.java 2009-06-08
13:02:25 UTC (rev 2781)
@@ -5,10 +5,9 @@
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Named;
-import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Obtains;
import javax.naming.NamingException;
@Named
@@ -26,7 +25,7 @@
private int biggest;
private int remainingGuesses;
- @Current BeanManager manager;
+ @Obtains @Random Instance<Integer> randomNumber;
public Game() throws NamingException {}
@@ -82,7 +81,7 @@
this.guess = 0;
this.remainingGuesses = 10;
this.biggest = maxNumber;
- this.number = manager.getInstanceByType(Integer.class, new
AnnotationLiteral<Random>(){});
+ this.number = randomNumber.get();
}
Show replies by date