input
stringlengths
10
828
output
stringlengths
5
107
public file get script return script
get the script file
public void set script file script this script script if script exists script root type equals script root type file this script new file script root script get path
set the script file
public void set script string script if script null set script new file script
set the script file
public void configure internal configuration configuration throws exception set script configuration get child value script
configure the validator using the given jdom element
public void configure configuration configuration throws exception
configure the rule
public class get validator class return validator class
get the validator class
public void configure configuration configuration iterator property elements configuration get children property iterator while property elements has next configuration property element configuration property elements next string name property element get attribute name string value property element get attribute value properties put name value
configure the validator map entry by loading all properties for that validator
private void init user user user form get target object data name user get name occupation user get occupation age new integer user get age birthdate user get birthdate username user get username password user get password string column names name value object table new jtable data column names get content pane set layout new border layout get content pane add new jscroll pane object table border layout center get content pane add create button panel border layout south set title all fields valid pack
initialize the user interface
private jpanel create button panel jpanel panel new jpanel ok button new jbutton ok ok button add action listener new action listener public void action performed action event evt dispose panel add ok button return panel
return the dialog button panel
private void init tabbed pane new jtabbed pane tabbed pane add fields create fields error panel tabbed pane add groups create groups error panel get content pane set layout new border layout get content pane add tabbed pane border layout center get content pane add create button panel border layout south get root pane set default button ok button set title error list pack
initialize the user interface
private jpanel create fields error panel jpanel panel new jpanel panel set layout new border layout validation results table model table model new validation results table model form result get validation results jtable table new jtable table model jscroll pane scroll pane new jscroll pane table panel add scroll pane border layout center return panel
create the error panel for field errors
private jpanel create groups error panel jpanel panel new jpanel panel set layout new border layout validation results table model table model new validation results table model form result get group validation results jtable table new jtable table model jscroll pane scroll pane new jscroll pane table panel add scroll pane border layout center return panel
create the error panel for group errors
public int get row count return keys size
get the number of rows
public object get value at int row int column string key string keys get row switch column case 0 return key case 1 string error message results get error message key locale if error message null return default error message else return error message default throw new illegal argument exception invalid column column
get the value at the given row and column indeces
public object convert object data locale locale throws exception if data instanceof byte return data else return new byte data to string
convert the given data object to a byte
public object convert object data locale locale throws exception if data instanceof character return data else string data string data to string if data string length 0 return new character data string char at 0 return new character 0
convert the given data object to a character
public object convert object data locale locale throws exception if data instanceof double return data else return new double data to string
convert the given data object to an double
public object convert object data locale locale throws exception if data instanceof float return data else return new float data to string
convert the given data object to an float
public object convert object data locale locale throws exception if data instanceof short return data else return new short data to string
convert the given data object to a short
public object convert object data locale locale throws exception if data instanceof long return data else return new long data to string
convert the given data object to a long
public object convert object data locale locale throws exception if data instanceof big integer return data else return new big integer data to string
convert the given data object to a big integer
public object convert object data locale locale throws exception if data instanceof big decimal return data else return new big decimal data to string
convert the given data object to a big decimal
public object convert object data locale locale throws exception if data null data instanceof number return data else string data string data to string number format number format get number format locale return number format parse data string
convert the given data object to a date
private void set type string type this type type
set the type property
public void set grouping used string grouping used if true equals ignore case grouping used this grouping used true else if false equals ignore case grouping used this grouping used false else should we throw exception here
set the grouping used property
public void set maximum fraction digits string maximum fraction digits if maximum fraction digits null this maximum fraction digits integer parse int maximum fraction digits
set the maximum fraction digits property
public void set maximum integer digits string maximum integer digits if maximum integer digits null this maximum integer digits integer parse int maximum integer digits
set the maximum integer digits property
public void set minimum fraction digits string minimum fraction digits if minimum fraction digits null this minimum fraction digits integer parse int minimum fraction digits
set the minimum fraction digits property
public void set minimum integer digits string minimum integer digits if minimum integer digits null this minimum integer digits integer parse int minimum integer digits
set the minimum integer digits property
public void set parse integer only string parse integer only if true equals ignore case parse integer only this parse integer only true else if false equals ignore case parse integer only this parse integer only false else should we throw exception here
set the parse integer only property
public object convert object data locale locale throws exception if data instanceof boolean return data else string data string data to string to lower case if allow extended for int i 0 i true values length i if data string equals true values i convert to int data string 0 return new boolean true else return new boolean data string return new boolean data string
convert the given data object to an boolean
public boolean is allow extended return allow extended
get the allow extended property value
public void set allow extended boolean allow extended this allow extended allow extended
set the allow extended property
public void set allow extended string allow extended if allow extended null set allow extended new boolean allow extended boolean value else set allow extended false
set the allow extended property
private int convert to int string data try return integer parse int data catch exception e return 0
convert the given string to an int
public object convert object data locale locale throws exception if data null data instanceof date return data else string data string data to string date format date format get date format locale date format set lenient false return date format parse data string
convert the given data object to a date
private date format get date format locale locale date format date format if type equals ignore case date date format date format get date instance date style locale else if type equals ignore case time date format date format get time instance time style locale else if type equals ignore case both type equals ignore case datetime date format date format get date time instance date style time style locale else if type equals ignore case custom date format new simple date format pattern locale else date format date format get instance return date format
gets date format constructed with passed locale
public void set date style string date style this date style get style code date style
set the date style property
public void set time style string time style this time style get style code time style
set the time style property
private int get style code string style name int style code if default equals ignore case style name style code date format default else if short equals ignore case style name style code date format short else if medium equals ignore case style name style code date format medium else if long equals ignore case style name style code date format long else if full equals ignore case style name style code date format full else should we throw exception here instead return default style code date format default return style code
get the style code that the name associated with
public object convert object data locale locale throws exception if data instanceof integer return data else return new integer data to string
convert the given data object to an integer
public string get message locale locale throws exception try resource bundle bundle resource bundle get bundle resource bundle name locale return bundle get string resource bundle key catch missing resource exception e log error missing resource resource bundle name for locale locale throw e
get the message for the given locale
public string get message locale locale throws exception string lang locale get language string message string messages get lang if message null message string messages get return message
get the message for the given locale
public string get message element name return message element name
get the element name which is used for finding the inline messages
public void set message element name string message element name this message element name message element name
set the element name which is used for finding the inline messages
public validation result map get validation results return validation results
get the validation result map for all element validation results
public validation result map get group validation results return group validation results
get the validation result map for all element group validation results
public boolean is element valid string name return validation results is valid name
return true if the given form element is valid
public boolean is element group valid string name return group validation results is valid name
return true if the given form element group is valid
public map get original data return collections unmodifiable map original data
return a non mutable version of the original data map
public object get original value string name return original data get name
get the original value submitted for the given field
public string get original value as string string name object value original data get name if value null return else return value to string
get the original value submitted for the given field as a string
public string get error or message string name validation result validation result validation result validation results get name if validation result null return get error or message name validation result get locale return
return the error message or user message for the given named element
public string get error or message string name locale locale validation result validation result validation result validation results get name if validation result null form element form elements validation result get form elements if form elements null form elements length 0 if validation result is valid string message form elements 0 get message locale if message null return message else string error message validation result get error message locale if error message null return error message return
return the error message or user message for the given named element
public string get group error message string name validation result validation result validation result group validation results get name if validation result null validation result is valid return validation result get validator get error message validation result get locale return null
get the error message for the named form element group
public string get group error message string name locale locale validation result validation result validation result group validation results get name if validation result null validation result is valid return validation result get validator get error message locale return null
get the error message for the named form element group
public string get message string name if log is debug enabled log debug get message name check configuration form element form element form configuration get form element name if form element null return return form element get message
get a message for the given field using the default locale
public string get message string name locale locale if log is debug enabled log debug get message name locale check configuration form element form element form configuration get form element name if form element null return return form element get message locale
get a message for the given field using the given locale
public string get error message string name if log is debug enabled log debug get error message name if validation results null return validation result validation result validation result validation results get name if validation result null string error message validation result get error message if error message null error message return error message else return
get the last error message for the given field
public string get error message string name locale locale if log is debug enabled log debug get error message name locale if validation results null return validation result validation result validation result validation results get name if validation result null string error message validation result get error message locale if error message null error message return error message else if log is debug enabled log debug validation result for name is null return
get the last error message for the given field using the given locale
public string get write method string name check configuration form element form element form configuration get form element name if form element null return get default write method name string write method form element get write method if write method null return get default write method name return write method
get the write method for the given field name
public void configure form configuration form configuration this form configuration form configuration
configure this form from the given form configuration
public form configuration get form configuration return form configuration
get the form configuration for this form
public form result process form data form data throws exception return process form data locale get default
process the given form data objects
public form result process list form data throws exception return process form data locale get default
process the given form data objects
public list get form elements return form elements
get the list of form elements in this group
public form result process list form data locale locale throws exception return process form data form data to array new form data form data size locale
process the given form data objects
public void set optional boolean optional this optional optional if log is debug enabled optional log debug element name is optional
set to true if the form element is optional
public void set optional string optional set optional true equals ignore case optional
set to true if the form element is optional
public string get message return get message locale get default
get the fields message in the default locale
public string get message locale locale if message provider null try return message provider get message locale catch exception e log error error retrieving message from provider e get message return message provider error e get message else return
get the message in the given locale
public string get write method return write method
get a predefined write method for the given form element
protected void store form element form element object value locale locale throws exception storer storer form element get storer if no form element storer is specified then use the storer specified in the form configuration if storer null storer form configuration get storer if storer null storer store this form element get name value locale
store the value for the named field in the target object
private void check configuration if form configuration null throw new form configuration exception form not configured
throw a runtime exception if the form is not configured
public void configure configuration configuration throws exception set name configuration get attribute name configuration validator element configuration get child validator if validator element null log debug validator element is null else log debug loading validator validator form manager get validator validator element if log is debug enabled log debug validator loaded validator
configure the form element group
public void set write method string write method this write method write method
set the write method
private string get default write method string name return set capitalize name
get the default write method name based on the given field name
public string get message provider return message provider
get the default message provider class name
public void set message provider string message provider this message provider message provider
set the default message provider class name
public void configure form form throws exception string form name form get name if form name null throw new form configuration exception form name cannot be null form configure get form configuration form name
configure the given form
public map get validator map return validator map
get the validator map
public map get shared validators return shared validators
get a map of shared validators
public void load configuration file file throws configuration exception try file system manager fs manager get file system manager load configuration fs manager to file object file catch file system exception e throw new configuration exception e
load the configuration from the given file
public void reload input stream in null try if log is info enabled log info loading configuration from configuration file in configuration file get content get input stream load configuration in log info configuration loaded catch exception e e print stack trace do something here finally ioutilities close in
reload the configuration
protected void load message provider configuration configuration message provider configuration get attribute classname
load the default message provider
public void set value string key object value values put key value
save a value specified by key
public void set online boolean online if online null this online online else this online boolean false
sets the online field to passed value
public set key set return values key set
returns a set of keys
public void set new files boolean new files if new files null this new files new files else this new files boolean false
sets the new files field to the passed value
public void set search options string search options this search options search options
sets the search options field to passed value
public object clone return new ip subnet this ipstring
clones the subnet
public boolean has next return num now
returns code true code if the iteration has more elements
public boolean get new files return new files
returns the value of the field new files
public string get search options return search options
return the value of the field search options
public string to string return this ipstring
returns string representation ob the ip subnet in the form a
private void check range of values int i if i 255 i 0 throw new illegal argument exception ip segment must be between 0 and 255
checks whether the number is an unsigned byte
public iterator get online ip string iterator return new online ip string iterator this
returns an iterator over the online ip addresses
public boolean has next while this keys has next if name online this h get ip get online equals boolean true return true return true if we get an online ip if it was false or null try the next one this ip string this keys next return false if there is no next key return false
returns true if the iteration has more elements
public object next while this keys has next if name online this h get ip get online equals boolean true string temp this ip save current value this ip string keys next forward iterator return temp return value this ip string this keys next if there is no next key has next would return false throw new java util no such element exception
returns the next element in the iteration
public object next while this keys has next if name online this h get ip get online equals boolean true assemble computer computer c new computer name online no name online this h get this ip c set ip this ip c set name no get name c set net files null c set online no get online this ip string keys next forward iterator return c return value this ip string this keys next if there is no next key has next would return false throw new java util no such element exception
returns the next element in the iteration