[jboss-cvs] JBossAS SVN: r106126 - in projects/demos/microcontainer/trunk: wpojo/src/main/java/org/jboss/demos/wpojo and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 17 12:11:07 EDT 2010


Author: alesj
Date: 2010-06-17 12:11:07 -0400 (Thu, 17 Jun 2010)
New Revision: 106126

Added:
   projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/teams/USA.java
Modified:
   projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java
   projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/Lottery.java
Log:
Fix lotto. :-)

Modified: projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java
===================================================================
--- projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java	2010-06-17 15:55:24 UTC (rev 106125)
+++ projects/demos/microcontainer/trunk/opojo/src/main/java/org/jboss/demos/opojo/api/AbstractTeam.java	2010-06-17 16:11:07 UTC (rev 106126)
@@ -30,6 +30,11 @@
    @Override
    public String toString()
    {
-      return name();
+      StringBuilder builder = new StringBuilder();
+      builder.append("Team: ").append(name()).append("\n");
+      builder.append("Captain: ").append(captain()).append("\n");
+      builder.append("Best player: ").append(bestPlayer()).append("\n");
+      builder.append("Coach: ").append(coach()).append("\n");
+      return builder.toString();
    }
 }
\ No newline at end of file

Modified: projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/Lottery.java
===================================================================
--- projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/Lottery.java	2010-06-17 15:55:24 UTC (rev 106125)
+++ projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/Lottery.java	2010-06-17 16:11:07 UTC (rev 106126)
@@ -29,6 +29,8 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.jboss.demos.opojo.api.Team;
 
@@ -37,6 +39,7 @@
  */
 public class Lottery
 {
+   private Logger log = Logger.getLogger(Lottery.class.getName());
    private Instance<Team> teams;
 
    @Produces @Winner
@@ -46,6 +49,9 @@
       for (Team t : teams)
          list.add(t);
 
+      if (log.isLoggable(Level.FINE))
+         log.fine("Teams: " + list);
+
       Random r = new Random();
       int x = r.nextInt(list.size());
       return list.get(x);

Copied: projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/teams/USA.java (from rev 106123, projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/teams/Slovenia.java)
===================================================================
--- projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/teams/USA.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/wpojo/src/main/java/org/jboss/demos/wpojo/teams/USA.java	2010-06-17 16:11:07 UTC (rev 106126)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.demos.wpojo.teams;
+
+import org.jboss.demos.opojo.api.AbstractTeam;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class USA extends AbstractTeam
+{
+   public String name()
+   {
+      return "USA";
+   }
+
+   public String captain()
+   {
+      return "Carlos Bocanegra";
+   }
+
+   public String bestPlayer()
+   {
+      return "Landon Donovan";
+   }
+
+   public String coach()
+   {
+      return "Bob Bradley";
+   }
+}
\ No newline at end of file



More information about the jboss-cvs-commits mailing list