home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java EE 6 example source code file (Generator.java)

This example Java EE 6 source code file (Generator.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Java EE 6 tags/keywords

applicationscoped, applicationscoped, generator, io, maxnumber, produces, produces, random, random, serializable, serializable

The Java EE 6 Generator.java source code

package weldguess; 


import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

@ApplicationScoped
public class Generator implements Serializable 
{
   
   private static final long serialVersionUID = -7213673465118041882L;

   private java.util.Random random = new java.util.Random( System.currentTimeMillis() );
   
   private int maxNumber = 100;
   
   java.util.Random getRandom()
   {
      return random;
   }
   
   @Produces @Random int next() { 
      return getRandom().nextInt(maxNumber); 
   }
   
   @Produces @MaxNumber int getMaxNumber()
   {
      return maxNumber;
   }

} 

Other Java EE 6 examples (source code examples)

Here is a short list of links related to this Java EE 6 Generator.java source code file:



my book on functional programming

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.