Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

ParamCollection< T > Class Reference

List of all members.

Public Member Functions

 ParamCollection (Integer id)
Integer getCollectionId ()
ParamCollection< T > setCollectionId (Integer id)
Vector< Param< T > > getParams ()
Param< T > get (String name)
Param< T > get (Integer id)
Integer size ()
ParamCollection< T > add (Param< T > param) throws JetWebException
boolean retrieve ()
boolean store ()

Private Attributes

Integer id_ = -1
HashMap< Integer, Param< T > > paramsById_
HashMap< String, Param< T > > paramsByName_

Member Function Documentation

ParamCollection<T> add Param< T >  param  )  throws JetWebException
 

Adds a parameter to this collection

Definition at line 56 of file ParamCollection.java.

00057                           {
00058     
00059     String name = param.getName();
00060     Integer id = param.getParamId();
00061 
00062     if(id<0 && name.equals("")){
00063         throw new JetWebException
00064         ("Attempting to add unspecified parameter to collection",
00065          "param value = " + param.getValue());
00066     }
00067     Param<T> byName = paramsByName_.get(name);
00068     Param<T> byId = paramsById_.get(id);
00069     
00070     boolean gotName = byName != null;
00071     boolean gotId = byId != null;
00072     
00073     if(gotName && gotId ){
00074         if(!byName.equals(byId)){
00075         throw new JetWebException
00076             ("Attempting to add parameter to collection " + 
00077              "with conflicting name and id!",
00078              "name, id = " + name + ", " + id);
00079         }else{
00080         return this;
00081         }
00082     }
00083 
00084     if(gotName){
00085         paramsById_.put(byName.getParamId(), byName);
00086         return this;
00087     }
00088 
00089     if(gotId){
00090         paramsByName_.put(byId.getName(), byId);
00091         return this;
00092     }
00093     
00094     if(id>0){
00095         paramsById_.put(id, param);
00096     }
00097 
00098     if(!name.equals("")){
00099         paramsByName_.put(name, param);
00100     }
00101 
00102     return this;
00103     }

Param<T> get Integer  id  ) 
 

Definition at line 42 of file ParamCollection.java.

00042                                    {
00043     return paramsById_.get(id);
00044     }

Param<T> get String  name  ) 
 

Definition at line 38 of file ParamCollection.java.

00038                                     {
00039     return paramsByName_.get(name);
00040     }

Integer getCollectionId  ) 
 

Definition at line 25 of file ParamCollection.java.

00025                                     {
00026     return id_;
00027     }

Vector<Param<T> > getParams  ) 
 

Definition at line 34 of file ParamCollection.java.

00034                                         {
00035     return (Vector<Param<T>>)paramsById_.values();
00036     }

ParamCollection Integer  id  ) 
 

Definition at line 21 of file ParamCollection.java.

00021                                       {
00022     id_ = id;
00023     }

boolean retrieve  ) 
 

Definition at line 107 of file ParamCollection.java.

00107                              {
00108     return false;
00109     }

ParamCollection<T> setCollectionId Integer  id  ) 
 

Definition at line 29 of file ParamCollection.java.

00029                                                          {
00030     id_ = id;
00031     return this;
00032     }

Integer size  ) 
 

Definition at line 46 of file ParamCollection.java.

00046                          {
00047     return paramsById_.size();
00048     }

boolean store  ) 
 

Definition at line 111 of file ParamCollection.java.

00111                           {
00112     return false;
00113     }


Member Data Documentation

Integer id_ = -1 [private]
 

Definition at line 12 of file ParamCollection.java.

HashMap<Integer, Param<T> > paramsById_ [private]
 

Initial value:

 
    new HashMap<Integer Param<T> >()

Definition at line 13 of file ParamCollection.java.

HashMap<String, Param<T> > paramsByName_ [private]
 

Initial value:

 
    new HashMap<String Param<T> >()

Definition at line 16 of file ParamCollection.java.


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007