[webbeans-commits] Webbeans SVN: r3778 - examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Thu Sep 24 07:17:36 EDT 2009
Author: peteroyle
Date: 2009-09-24 07:17:35 -0400 (Thu, 24 Sep 2009)
New Revision: 3778
Modified:
examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java
examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java
Log:
Updated to latest changes in SE module
Modified: examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java
===================================================================
--- examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java 2009-09-24 10:44:54 UTC (rev 3777)
+++ examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java 2009-09-24 11:17:35 UTC (rev 3778)
@@ -22,7 +22,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
-
import org.jboss.webbeans.environment.se.bindings.Parameters;
/**
@@ -34,21 +33,24 @@
public class CommandLineArgsValidator
{
- @Inject
- @Parameters
- private List<String> validParams;
- private List<String> errors = new ArrayList<String>();
+ @Inject
+ private @Parameters List<String> validParams;
+ private List<String> errors = new ArrayList<String>();
- @Inject
- public void checkParameters()
- {
- if (validParams.size() != 1)
- {
- errors.add("Please supply just one parameter: your first name");
- validParams = Collections.EMPTY_LIST;
- }
- }
+ public CommandLineArgsValidator()
+ {
+ }
+ @Inject
+ public void checkParameters()
+ {
+ if (validParams.size() != 1)
+ {
+ errors.add( "Please supply just one parameter: your first name" );
+ validParams = Collections.EMPTY_LIST;
+ }
+ }
+
public boolean hasErrors()
{
return !this.errors.isEmpty();
Modified: examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java
===================================================================
--- examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java 2009-09-24 10:44:54 UTC (rev 3777)
+++ examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java 2009-09-24 11:17:35 UTC (rev 3778)
@@ -16,33 +16,39 @@
*/
package org.jboss.webbeans.environment.se.example.simple;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.inject.Inject;
+import org.jboss.webbeans.environment.se.events.ContainerInitialized;
+import javax.inject.Inject;
/**
* @author Peter Royle
*/
+ at ApplicationScoped
public class HelloWorld
{
- @Inject
- CommandLineArgsValidator argsVlidator;
+ @Inject
+ CommandLineArgsValidator argsValidator;
- /**
- * Prints a hello message using the first name.
- *
- * @param firstName The first name.
- */
- public void printHello(@Observes AfterDeploymentValidation after)
- {
- if (!argsVlidator.hasErrors())
- {
- System.out.println("Hello " + argsVlidator.getValidParameters().get(0));
- }
- else
- {
- System.out.println("Please provide just one argument: your first name");
- }
- }
+ public HelloWorld()
+ {
+ }
+
+ /**
+ * Prints a hello message using the first name.
+ * @param firstName The first name.
+ */
+ public void printHello( @Observes ContainerInitialized init )
+ {
+ if (!argsValidator.hasErrors())
+ {
+ System.out.println( "Hello " + argsValidator.getValidParameters().get( 0 ) );
+ } else
+ {
+ System.out.println( "Please provide just one argument: your first name" );
+ }
+ }
+
}
More information about the weld-commits
mailing list