Java Doc for Parameters.java in  » Database-ORM » MMBase » org » mmbase » util » functions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » MMBase » org.mmbase.util.functions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.mmbase.util.functions.Parameters

All known Subclasses:   org.mmbase.util.functions.AutodefiningParameters,
Parameters
public class Parameters extends AbstractList implements java.io.Serializable(Code)
This class implemements the Parameters interface. It provides a convenient way to create a List that allows the use of 'named parameters'. This List is therefore backed by a HashMap, but it behaves as a list. So if you set a parameter with a certain name, it always appears in the same location of the List. This List is modifiable but not resizeable. It is always the size of the definition array.
author:
   Michiel Meeuwissen
since:
   MMBase-1.7
version:
   $Id: Parameters.java,v 1.39 2008/01/22 16:43:41 michiel Exp $
See Also:   Parameter
See Also:   Parameters.Parameters(Parameter[])


Field Summary
final public static  ParametersVOID
     No need to bother for the functions with no parameters.
protected  booleanautoCasting
     If true, values are automatically cast to the right type (if possible) when set.
final protected  Map<String, Object>backing
     The contents of this List are stored in this HashMap.
protected  Parameter<Object>[]definition
     This array maps integers (position in array) to map keys, making it possible to implement List.
protected  inttoIndex
    

Constructor Summary
public  Parameters(Parameter... def)
     Constructor, taking an Parameter[] array argument. The Parameter may also be Parameter.Wrapper (to implement overriding of functions).
public  Parameters(Parameter[] def, Collection values)
     If you happen to have a List of parameters, then you can wrap it into an Parameters with this constructor.
Parameters:
  values - Collection with values.
public  Parameters(Parameter[] def, Object... values)
    
public  Parameters(Map<String, Object> backing)
    
public  Parameters(List<Map.Entry<String, Object>> list)
    
protected  Parameters(Parameters params, int from, int to)
     Used for nicer implemenation of subList (which we want to also be instanceof Parameters).

Method Summary
final protected  voidcheckDef()
    
public  voidcheckRequiredParameters()
     Throws an IllegalArgumentException if one of the required parameters was not entered.
public  booleancontainsParameter(Parameter parameter)
     Checks wether a certain parameter is available, using the Parameter as a qualifier.
public  booleancontainsParameter(String parameterName)
     Checks wether a certain parameter is available, using the parameter name as a qualifier.
public  Objectget(int i)
    
public  Fget(Parameter<F> parameter)
     Gets the value of a parameter.
public  Objectget(String parameterName)
     Gets the value of a parameter.
public  Parameter[]getDefinition()
    
public  StringgetString(Parameter parameter)
     Gets the value of a parameter, cast to a String.
public  StringgetString(String parameterName)
     Gets the value of a parameter, cast to a String.
public  intindexOfParameter(Parameter parameter)
     Returns the position of a parameter in the parameters list, using the Parameter as a qualifier.
public  intindexOfParameter(String parameterName)
     Returns the position of a parameter in the parameters list, using the parameter name as a qualifier.
public  booleanisAutoCasting()
     Whether this Parameters object is 'automaticly casting'.
public  Objectset(int i, Object value)
    
public  Parametersset(Parameter<F> parameter, F value)
     Sets the value of a parameter.
public  Parametersset(String parameterName, Object value)
     Sets the value of a parameter.
public  ParameterssetAll(Map<String, ?> map)
     Copies all values of a map to the corresponding values of this Parameters Object.
public  ParameterssetAll(Collection values)
     Copies all values of a collection to the corresponding values of this Parameters Object.
public  ParameterssetAll(Object... values)
    
public  ParameterssetAllIfDefinied(Parameters params)
    
public  voidsetAutoCasting(boolean autocast)
    
public  ParameterssetIfDefined(Parameter<F> parameter, F value)
     Sets the value of an argument, if the argument is defined, otherwise do nothing.
public  ParameterssetIfDefined(String parameterName, Object value)
     Sets the value of an argument, if the argument is defined, otherwise do nothing.
public  intsize()
    
public  ParameterssubList(int fromIndex, int toIndex)
    
public  Class[]toClassArray()
    
public  List<Map.Entry<String, Object>>toEntryList()
    
public  Map<String, Object>toMap()
     Gives the arguments back as a (unmodifiable) map.
public  StringtoString()
    

Field Detail
VOID
final public static Parameters VOID(Code)
No need to bother for the functions with no parameters. This is a constant you could supply.



autoCasting
protected boolean autoCasting(Code)
If true, values are automatically cast to the right type (if possible) when set.



backing
final protected Map<String, Object> backing(Code)
The contents of this List are stored in this HashMap.



definition
protected Parameter<Object>[] definition(Code)
This array maps integers (position in array) to map keys, making it possible to implement List.



toIndex
protected int toIndex(Code)




Constructor Detail
Parameters
public Parameters(Parameter... def)(Code)
Constructor, taking an Parameter[] array argument. The Parameter may also be Parameter.Wrapper (to implement overriding of functions). The idea is that these array arguments are defined as constants in the classes which define a function with variable arguments.
The Parameter[] array could e.g. be somewhere defined as a constant, like this:
 
 public final static Parameter[] MYFUNCTION_PARAMETERS = {
 new Parameter("type", Integer.class),
 new Parameter("text", String.class),
 Parameter.CLOUD,                                 // a predefined parameter
 new Parameter.Wrapper(OTHERFUNCTION_PARAMETERS)  // a way to include another definition in this one
 };
 
 



Parameters
public Parameters(Parameter[] def, Collection values)(Code)
If you happen to have a List of parameters, then you can wrap it into an Parameters with this constructor.
Parameters:
  values - Collection with values. This Collection should have a predictable iteration order.
throws:
  NullPointerException - if definition is null
See Also:   Parameters.Parameters(Parameter[])



Parameters
public Parameters(Parameter[] def, Object... values)(Code)

since:
   MMBase-1.9



Parameters
public Parameters(Map<String, Object> backing)(Code)

since:
   MMBase-1.9



Parameters
public Parameters(List<Map.Entry<String, Object>> list)(Code)

since:
   MMBase-1.9



Parameters
protected Parameters(Parameters params, int from, int to)(Code)
Used for nicer implemenation of subList (which we want to also be instanceof Parameters).




Method Detail
checkDef
final protected void checkDef()(Code)



checkRequiredParameters
public void checkRequiredParameters()(Code)
Throws an IllegalArgumentException if one of the required parameters was not entered.



containsParameter
public boolean containsParameter(Parameter parameter)(Code)
Checks wether a certain parameter is available, using the Parameter as a qualifier.
Parameters:
  parameter - the parameter true if a parameter exists.



containsParameter
public boolean containsParameter(String parameterName)(Code)
Checks wether a certain parameter is available, using the parameter name as a qualifier.
Parameters:
  parameterName - the name of the parameter true if a parameter exists.



get
public Object get(int i)(Code)



get
public F get(Parameter<F> parameter)(Code)
Gets the value of a parameter.
Parameters:
  parameter - the parameter to get value the parameter value



get
public Object get(String parameterName)(Code)
Gets the value of a parameter.
Parameters:
  parameterName - the name of the parameter to get value the parameter value



getDefinition
public Parameter[] getDefinition()(Code)



getString
public String getString(Parameter parameter)(Code)
Gets the value of a parameter, cast to a String.
Parameters:
  parameter - the parameter to get value the parameter value as a STring



getString
public String getString(String parameterName)(Code)
Gets the value of a parameter, cast to a String.
Parameters:
  parameterName - the name of the parameter to get value the parameter value as a String



indexOfParameter
public int indexOfParameter(Parameter parameter)(Code)
Returns the position of a parameter in the parameters list, using the Parameter as a qualifier. you can tehn acecss that paramter with Parameters.get(int) .
Parameters:
  parameter - the parameter the index of the parameter, or -1 if it doesn't exist



indexOfParameter
public int indexOfParameter(String parameterName)(Code)
Returns the position of a parameter in the parameters list, using the parameter name as a qualifier. you can then acecss that paramter with Parameters.get(int) .
Parameters:
  parameterName - the name of the parameter the index of the parameter, or -1 if it doesn't exist



isAutoCasting
public boolean isAutoCasting()(Code)
Whether this Parameters object is 'automaticly casting'. If it is, that means that you can set e.g. an Integer by a String. true if autocasting is on



set
public Object set(int i, Object value)(Code)



set
public Parameters set(Parameter<F> parameter, F value)(Code)
Sets the value of a parameter.
Parameters:
  parameter - the Parameter describing the parameter to set
Parameters:
  value - the object value to set
throws:
  IllegalArgumentException - if either the argument name is unknown to this Parameters, or the value is of the wrong type.



set
public Parameters set(String parameterName, Object value)(Code)
Sets the value of a parameter.
Parameters:
  parameterName - the name of the parameter to set
Parameters:
  value - the object value to set
throws:
  IllegalArgumentException - if either the argument name is unknown to this Parameters, or the value is of the wrong type.



setAll
public Parameters setAll(Map<String, ?> map)(Code)
Copies all values of a map to the corresponding values of this Parameters Object.



setAll
public Parameters setAll(Collection values)(Code)
Copies all values of a collection to the corresponding values of this Parameters Object.



setAll
public Parameters setAll(Object... values)(Code)

since:
   MMBase-1.9



setAllIfDefinied
public Parameters setAllIfDefinied(Parameters params)(Code)

since:
   MMBase-1.9



setAutoCasting
public void setAutoCasting(boolean autocast)(Code)
Sets the 'auto casting' property (which on default is false)
Parameters:
  autocast - the new value for autocast
See Also:   Parameters.isAutoCasting



setIfDefined
public Parameters setIfDefined(Parameter<F> parameter, F value)(Code)
Sets the value of an argument, if the argument is defined, otherwise do nothing.
Parameters:
  parameter - the parameter to set
Parameters:
  value - the object value to set



setIfDefined
public Parameters setIfDefined(String parameterName, Object value)(Code)
Sets the value of an argument, if the argument is defined, otherwise do nothing.
Parameters:
  parameterName - the name of the parameter to set
Parameters:
  value - the object value to set



size
public int size()(Code)



subList
public Parameters subList(int fromIndex, int toIndex)(Code)



toClassArray
public Class[] toClassArray()(Code)



toEntryList
public List<Map.Entry<String, Object>> toEntryList()(Code)
Returns the Parameters as an unmodifiable List of Map.Entrys with predictable iteration order (the same order of this Parameters, which is a List of the values only, itself)
since:
   MMBase-1.9



toMap
public Map<String, Object> toMap()(Code)
Gives the arguments back as a (unmodifiable) map.



toString
public String toString()(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.