Set Methods v/s Vector

Hello,
In my Java Program, I have a doubt.
I have 2 set methods, setName(string) and setData(int)
Eg:
Name = A
Data (for A) = 12, 14, 20, 22
I am having a 'Vector of Array' for storing the data, where each position of the Vector will contain an array. From the Eg., Assume....A will be stored as the 0th element of the array in the 2nd position of the vector. A will be followed by the data items which will occupy the array from the 1st element onwards.
With respect to the Bean Standards, I can have only one parameter passed into a set method. I am not able to understand how do I add the name and the data inside the Vector. Where exactly should I call my 'addData(String, int)' method?
Since setName() and setData() come in the 'Properties Window', I am unable to understand how to add the data in the vector. The properties change when there is a 'lost focus', so the method gets called even if either is entered. Whereas, I need the 'Name' and the 'Data' to go into the Vector together.
Waiting for reply
Thanks

In this case directly call the function name and pass the arguments..The get set methods sometimes do not behave properly
Hello,
In my Java Program, I have a doubt.
I have 2 set methods, setName(string) and
setData(int)
Eg:
Name = A
Data (for A) = 12, 14, 20, 22
I am having a 'Vector of Array' for storing the data,
where each position of the Vector will contain an
array. From the Eg., Assume....A will be stored as
the 0th element of the array in the 2nd position of
the vector. A will be followed by the data items which
will occupy the array from the 1st element onwards.
With respect to the Bean Standards, I can have only
one parameter passed into a set method. I am not able
to understand how do I add the name and the data
inside the Vector. Where exactly should I call my
'addData(String, int)' method?
Since setName() and setData() come in the 'Properties
Window', I am unable to understand how to add the data
in the vector. The properties change when there is a
'lost focus', so the method gets called even if either
is entered. Whereas, I need the 'Name' and the 'Data'
to go into the Vector together.
Waiting for reply
Thanks

Similar Messages

  • Hi, I cant run set Method of bindings on my class with  ADF BC

    Hi I made a private definition, as follow.
    private BindingContainer bindings;
    get and set method
    public void setBindings(BindingContainer bindings) {
    this.bindings = bindings;
    public BindingContainer getBindings() {
    return this.bindings;
    How can I run set method when the Page loading.
    Onur...............

    Thanks, I wrote your code it worked.But there is another problem.I'am sending my code and the place of error.
    I wrote this code for reading column of the table. Can you help me please?
    Here is the code:
    public Vector getNid(){
    Vector vNid = new Vector();
    CoreTable table = this.getMasterDetail1();
    Set rowSet = table.getSelectionState().getKeySet();
    Iterator rowSetIter = (Iterator)rowSet.iterator();
    BindingContainer bindings = getBindings();
    DCIteratorBinding pr_dcib=null;
    try {
    pr_dcib = (DCIteratorBinding) bindings.get("EgitimTalepHareketiIViewSorgu1Iterator");
    catch (Exception e) {
    System.out.println(e.toString());
    while (rowSetIter.hasNext()){        
    //set the current row in the ADF binding to the same row
    pr_dcib.setCurrentRowIndexInRange(((Integer)rowSetIter.next()).intValue());//in this place Iam taking error
    ViewRowImpl prRow = (ViewRowImpl) pr_dcib.getCurrentRow();
    String rid="0";
    try {
    rid = (String)prRow.getAttribute("HareketId").toString();
    catch (Exception e) {
    System.out.println(e.toString());
    System.out.println("Hareket ID : "+rid);
    vNid.add(rid);
    return vNid;
    The eror is like this
    javax.faces.FacesException: #{backing_GenelEgitimListesi.commandButton1_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.jbo.Key     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)     at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)

  • Set Methods are not running

    I am writing my first jsp. I have a bean that I am wanting to use and my understanding is that if I put the following commands in, that all the set methods for my properties will run in the bean automatically as long as the names of the properties are the same as those on the form.
    <jsp:useBean id="MedicalBean" class="Project5.MedicalReimbursementRecord" scope="session"/>
    <jsp:setProperty name="MedicalBean" property="*"/>
    The form has a number of textboxes, each text box has a name of one of the properties in my bean. I put display in my bean and I know that it is never running any of the "set" methods for any of the properties. I know that it is indeed getting into my bean, as I have displayed which indicate that methods that I request are indeed running.
    I have not "ACTION" parameter on the FORM, but I have looked at the examples in Tomcat and they have forms which do not have an "Action". I don't think this is a problem, but maybe I am wrong about that. If I put in the statement of:
    <jsp:setProperty name="MedicalBean" property="GrpAcctNbr"/>
    Then I get the error "Cannot find any information on property 'GrpAcctMbr' in a bean of type 'Project5.MedicalReimbursementRecord'"
    So there must be something wrong with my setProperty statement, but what is it?
    Thanks in advance for your assistance.

    Can you show the relevant JSP code and set/get methods in the bean?
    Sometimes this error is caused by capitalization. e.g. a request param of "myName" calls setMyName(). Also, your bean must have a no arguments constructor.
    Also, if you don't specify an action,the form submits to the current URL so you should be ok. Are you sure that the JSP runs when the user submits the form?

  • Confusion about get/set method not working

    Hi
    Hopefully someone can point out the elementary mistake I have made in my code. I have created a get/set method to hold a value"total" so that I can then get it to display it further down my code in an HTML page. I am setting the value as I can check this by printing it out (line 102) but when I try to use it again it displays 0.0. What have I done wrong?
    class ReportListener implements ActionListener
         Context context;
         ResultSet resultAll;
         ResultSet resultTotal;
         JFrame frame;
         int daysInMonth;
         int i;
         DisplayCurrencyOnBills d;
         DateFormatSymbols symbols;
         String[] newWeekday;
         Date theDate;
         String date;
         ReportListener (Context theContext)
              context = theContext;
         public void actionPerformed(ActionEvent e)
           try
              printWeeklyReport();
              //countDaysInMonth();
              getReportMoneyTotal();
         catch (SQLException s)
                   s.printStackTrace();
         public void countDaysInMonth()
         public void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              double total =resultTotal.getDouble("Total");     
              context.setReportIncomeTotal(total);
              System.out.println("Line 102 "+context.getReportIncomeTotal());
              preparedT.close();
         public void printWeeklyReport() throws SQLException
              Calendar today =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement prepared =context.getConnection().prepareStatement(
                   "SELECT tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee, Count(tblBooking.BookingID) AS CountOfBookingID "+
                   "FROM tblSession INNER JOIN (tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON "+
                   "tblSession.SessionID = tblBooking.SessionID GROUP BY tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee "+
                   "HAVING (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(today.getTime())+"#)) AND ((tblSession.Session)='Morning' Or "+
                   "(tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultAll =prepared.executeQuery();
              resultAll.next();
              System.out.println("Line 123 "+context.getReportIncomeTotal());
                        PrintWriter printWriter;
                        try
                             JFileChooser fc=new JFileChooser();
                             int returnVal = fc.showSaveDialog(frame);
                             if (returnVal != JFileChooser.APPROVE_OPTION)
                                  return;
                             FileOutputStream outputStream=
                                  new FileOutputStream(fc.getSelectedFile());
                             OutputStreamWriter writer=
                                  new OutputStreamWriter(outputStream,"UTF-8");
                             printWriter=new PrintWriter(writer);     
                           printWriter.println("<html><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><body><h1>Monthly Usage Statistics</h1>");
                           printWriter.println("<table width='100%' border='1'><tr><td width='100%' colspan='8'><h2 align='center'>Monthly Summary</h2></td></tr>");
                         System.out.println("Line 152 "+context.getReportIncomeTotal());
                         int count = 0;
                             while ( resultAll.next() )
                              count++;
                              String session = resultAll.getString("Session");
                              Double fee= resultAll.getDouble("Fee");
                           // display currency correctly
                         //double d=Double.parseDouble(fee);
                         Locale locale = new Locale("GBP");
                         NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
                             symbols = new DateFormatSymbols(new Locale("en"));
                         newWeekday =symbols.getWeekdays();
                             SimpleDateFormat formatter = new SimpleDateFormat("EEEE",symbols);
                             Date theEventDate = new Date();
                             theEventDate=resultAll.getDate("EventDate");
                             date = formatter.format(theEventDate);
                             // set date for Usage Report
                             Calendar reportDate = Calendar.getInstance();
                             Calendar reportToday =Calendar.getInstance();
                             reportDate.add(Calendar.MONTH,-1);
                             SimpleDateFormat reportFormat = new SimpleDateFormat("EEEE ,dd MMM yyy");     
                             //setDecimalFormat for report total
                             DecimalFormat decFormat = new DecimalFormat(".##");
                             printWriter.println(
                             "<tr><td width='100%' colspan='8'>For month from "+reportFormat.format(reportDate.getTime())+" to "+reportFormat.format(reportToday.getTime())+"</td></tr><tr><td width='100%' colspan='8'>Total amount of income from occasional bookings "+decFormat.format(context.getReportIncomeTotal())+"</td>"+
                               "</tr><tr><td width='100%' colspan='8'>Percentage use for all bookings</td></tr><tr><td width='8%'></td><td width='8%'>MON</td><td width='9%'>TUES</td>"+
                            "<td width='9%'>WEDS</td><td width='9%'>THURS</td><td width='9%'>FRI</td><td width='9%'>SAT</td><td width='9%'>SUN</td></tr><tr><td width='8%'>AM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>PM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>EVE</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr>"
                             System.out.println(count);
                             printWriter.println("</table>");
                             printWriter.println("</body></html>");
                             printWriter.close();
                             prepared.close();
                             JDialog reportDialog=new JDialog(frame);
                             reportDialog.setSize(800,600);
                             JEditorPane editorPane=new JEditorPane(fc.getSelectedFile().toURL());
                             editorPane.setContentType("text/html; charset=UTF-8");
                             reportDialog.getContentPane().add(editorPane);
                             reportDialog.setVisible(true);
                        catch (IOException exception)
                             exception.printStackTrace();
         This code finds data from a database(this works as it also prints a report). Here is the extraxt of my get/set method which is located in a "context" class.
    public void setReportIncomeTotal(double total)
              this.total=total;
         public double getReportIncomeTotal()
              return total;
         }I'd be grateful for any help.

    but when I try to use it again it displays 0.0This seems to mean that either the value has been reset or you are calling the method on another (new) ReportListener.
    It's hard to say, as you didn't provide us with the code sample that illustrate the corresponding scenario (did you?.)
    Note that I didn't get into details, but I just noticed that your actionPerformed method first print weekly report, and then get the money total. (Shouldn't it be the opposite order?)

  • Setting value for attribute  'PO_NUMBER_SOLD'  using setter method

    Hi Experts,
    I need to set the value of a screen field according to some condition. I am using setter method of this attribute to set the value but it is not getting changed.
    I have written following code in DO_PREPARE_OUTPUT method of implementation class ZL_ZZBT131I_ZCREDITCHECK_IMPL using setter method of attribute
    Get Referral Authorization Code
          lv_val1 = me->typed_context->crechkresph->get_po_number( attribute_path = 'PO_NUMBER' ).
          me->typed_context->crechkresph->set_po_number( attribute_path = 'PO_NUMBER'
                                                            value     = ' ' ).
    while debugging I found that in method set_po_number set_property method has been used:--
    current->set_property(
                          iv_attr_name = 'PO_NUMBER_SOLD' "#EC NOTEXT
                          iv_value     = <nval> ).
    In set_property method  following code is getting executed
    if ME->IS_CHANGEABLE( ) = ABAP_TRUE and
               LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY.
              if <VALUE> ne IV_VALUE.
                if ME->MY_MANAGER_ENTRY->DELTA_FLAG is initial.
                first 'change' -> proof that entity is locked
                  if ME->MY_MANAGER_ENTRY->LOCKED = FALSE.
                    if ME->LOCK( ) = FALSE.
                      return.
                    endif.
                  endif.
                flag entity as modified
                  ME->MY_MANAGER_ENTRY->DELTA_FLAG = IF_GENIL_CONTAINER_OBJECT=>DELTA_CHANGED.
                endif.
                ME->ACTIVATE_SENDING( ).
              change value
                <VALUE> = IV_VALUE.
              log change
                set bit LV_IDX of ME->CHANGE_LOG->* to INDICATOR_SET.
              endif.
            else.
            check if it is a real read-only field or a display mode violation
              assert id BOL_ASSERTS subkey 'READ-ONLY_VIOLATION'
                     fields ME->MY_INSTANCE_KEY->OBJECT_NAME
                            IV_ATTR_NAME
                     condition ME->CHANGEABLE = ABAP_TRUE.
            endif.
    and in debugging I found that if part ( ME->IS_CHANGEABLE( ) = ABAP_TRUE and
               LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY) fails and hence else part is getting executed and hence my field a real read-only field or a display mode violation is happening according to comments in code.
    What shall I do so that I would be able to change the screen field value?
    Any help would be highly appreciated.
    Regards,
    Vimal

    Hi,
    Try this:
    data: lr_entity type cl_crm_bol_entity.
    lr_entity = me->typed_context->crechkresph->collection_wrapper->get_current( ).
    lr_entity->set_property( iv_attr_name = 'PO_NUMBER' value = '').
    Also, make sure the field is not read-only.
    Regards
    Prasenjit

  • Getter/setter methods -- how do I use the return values

    I'm just learning Java, and I haven't been to this site since the end of July, I think. I have a question regarding getter and setter methods. I switched to the book Head First Java after a poster here recommended it. I'm only about a hundred pages into the book, so the code I'm submitting here reflects that. It's the beginnings of a program I'd eventually like to complete that will take the entered information of my CD's and alphabetize them according to whatever criteria I (or any user for that matter) choose. I realize that this is just the very beginning, and I don't expect to have the complete program completed any time soon -- it's my long term goal, but I thought I could take what I'm learning in the book and put it to practical use as I go along (or at lest try to).
    Yes I could have this already done it Excel, but where's the fun and challenge in that? :) Here's the code:
    // This program allows the user to enter CD information - Artist name, album title, and year of release -- and then organizes it according the the user's choice according to the user's criteria -- either by artist name, then title, then year of release, or by any other order according to the user's choice.
    //First, the class CDList is created, along with the necessary variables.
    class CDList{
         private String artistName;//only one string for the artist name -- including spaces.
         private String albumTitle;//only one string the title name -- including spaces.
         private int yearOfRelease;
         private String recordLabel;
         public void setArtistName(String artist){
         artistName = artist;
         public void setAlbumTitle(String album){
         albumTitle = album;
         public void setYearOfRelease(int yor){
         yearOfRelease = yor;
         public void setLabel(String label){
         recordLabel = label;
         public String getArtistName(){
         return artistName;
         public String getAlbumTitle(){
         return albumTitle;
         public int getYearOfRelease(){
         return yearOfRelease;
        public String getLabel(){
        return recordLabel;
    void printout () {
           System.out.println ("Artist Name: " + getArtistName());
           System.out.println ("Album Title: " + getAlbumTitle());
           System.out.println ("Year of Release: " + getYearOfRelease());
           System.out.println ("Record Label: " + getLabel());
           System.out.println ();
    import static java.lang.System.out;
    import java.util.Scanner;
    class CDListTestDrive {
         public static void main( String[] args ) {
              Scanner s=new Scanner(System.in);
              CDList[] Record = new CDList[4];
              int x=0;     
              while (x<4) {
              Record[x]=new CDList();
              out.println ("Artist Name: ");
              String artist = s.nextLine();
              Record[x].setArtistName(artist);
              out.println ("Album Title: ");
              String album = s.nextLine();
              Record[x].setAlbumTitle(album);
              out.println ("Year of Release: ");
              int yor= s.nextInt();
                    s.nextLine();
              Record[x].setYearOfRelease(yor);
              out.println ("Record Label: ");
              String label = s.nextLine();
              Record[x].setLabel(label);
              System.out.println();
              x=x+1;//moves to next CDList object;
              x=0;
              while (x<4) {
              Record[x].getArtistName();
              Record[x].getAlbumTitle();
              Record[x].getYearOfRelease();
              Record[x].getLabel();
              Record[x].printout();
              x=x+1;
                   out.println("Enter a Record Number: ");
                   x=s.nextInt();
                   x=x-1;
                   Record[x].getArtistName();
                Record[x].getAlbumTitle();
                Record[x].getYearOfRelease();
                Record[x].getLabel();
                Record[x].printout();
         }//end main
    }//end class          First, I'd like to ask anyone out there to see if I could have written this any more efficiently, with the understanding that I'm only one hundred pages into the book, and I've only gotten as far as getter and setter methods, instance variables, objects and methods. The scanner feature I got from another book, but I abandoned it in favor of HFJ.
    Secondly --
    I'm confused about getter and setter methods -- I'd like someone to explain to me what they are used for exactly and the difference between the two. I have a general idea, that getters get a result from the method and setters set or maybe assign a value to variable. I submitted this code on another site, and one of the responders told me I wasn't using the returned values from the getter methods (he also told me about using a constructor method, but I haven't got that far in the book yet.). The program compiles and runs fine, but I can't seem to figure out how I'm not using the returned values from the getter methods. Please help and if you can explain in 'beginners terms,' with any code examples you think are appropriate. It will be greatly appreciated.
    By the way, I'm not a professional programmer -- I'm learning Java because of the intellectual exercise and the fun of it. So please keep that in mind as well.
    Edited by: Straitsfan on Sep 29, 2009 2:03 PM

    Straitsfan wrote:
    First, I'd like to ask anyone out there to see if I could have written this any more efficiently, with the understanding that I'm only one hundred pages into the book, and I've only gotten as far as getter and setter methods, instance variables, objects and methods. The scanner feature I got from another book, but I abandoned it in favor of HFJ.Yes, there is tons you could have done more efficiently. But this is something every new programmer goes through, and I will not spoil the fun. You see, in 3 to 6 months when you have learned much more Java, assuming you stick with it, you will look back at this and be like "what the hell was I thinking" and then realize just haw far you have come. So enjoy that moment and don't spoil it now by asking for what could have been better/ more efficient. If it works it works, just be happy it works.
    Straitsfan wrote:
    Secondly --
    I'm confused about getter and setter methods -- I'd like someone to explain to me what they are used for exactly and the difference between the two. I have a general idea, that getters get a result from the method and setters set or maybe assign a value to variable. I submitted this code on another site, and one of the responders told me I wasn't using the returned values from the getter methods (he also told me about using a constructor method, but I haven't got that far in the book yet.). The program compiles and runs fine, but I can't seem to figure out how I'm not using the returned values from the getter methods. Please help and if you can explain in 'beginners terms,' with any code examples you think are appropriate. It will be greatly appreciated.
    By the way, I'm not a professional programmer -- I'm learning Java because of the intellectual exercise and the fun of it. So please keep that in mind as well.First, if you posted this somewhere else you should link to that post, it is good you at least said you did, but doubleposting is considered very rude because what inevitably happens in many cases is the responses are weighed against each other. So you are basically setting anyone up who responds to the post for a trap that could make them look bad when you double post.
    You are setting you getters and setters up right as far as I can tell. Which tells me that I think you grasp that a getter lets another class get the variables data, and a setter lets another class set the data. One thing, be sure to use the full variable name so you should have setRecordLabel() and getRecodLabel() as opposed to setLabel() and getLabel(). Think about what happens if you go back and add a label field to the CDList class, bad things the way you have it currently. Sometimes shortcuts are not your friend.
    And yes, you are using the getters all wrong since you are not saving off what they return, frankly I am suprised it compiles. It works because you don't really need to use the getters where you have them since the CDList Record (should be lowercase R by the way) object already knows the data and uses it in the printout() method. Basically what you are doing in lines like:
    Record[x].getArtistName();is asking for the ArtistName in Record[x] and then getting the name and just dropping it on the floor. You need to store it in something if you want to keep it, like:
    String artistName = Record[x].getArtistName();See how that works?
    Hope this helped, keep up the good learning and good luck.
    JSG

  • How to call setter Method of ActionScript class with in a Flex Application

    Hi
    I have Action class as shown :
    public class MyClass
    private var name:String 
    public function get name():String {
        return _initialCount;
    public function set name(name:String):void {
        name = name;
    Now please let me know how can i access this Action class under my Flex Application and call the setter Method of it to set the value for the name .
    For example on entering some data in a TextInput and  click of a submit Button , on to the Event Listener , i want to call the set name method of my ActionScript class .
    Please share your ideas on this .

    Thanks  Gordon for your resonse .
    Say for example my Action class is like this :
    public class MyClass
    private var name:String 
    public function get name():String {
        return name;
    public function set name(name:String):void {
        name = name;
    This is inside the MXML
    I know this way we can do it
    public var myclass:MyClass = new MyClass();
    myclass.name="Kiran";
    Now my query is can we do in this way also ??
    myclass.set name(SomeTextInput.text);
    Please share your views on this , waiting for your replies .
    Thanks in advance .

  • How to call a set method from within a constructor

    Hello,
    I want to be able to call a set method from within a Scanner, to be used as the argument to pass to the Scanner (from a source file). Here's what i tried:
    private void openFiles()
            input = new Scanner( setSource );              
        and here is the set method:
    public String setSource( String in )
            source = in;
            return source;
        }obviously there will be more code in this method but i'm trying to tackle one problem at a time. Thanks in advance..

    The "String in" declaration says: "Nobody may ever invoke setSource() without specifying a certain String. The content of the String is known at run-time only."
    In no place in your code you say the compiler: "I want the 'in' variable (actually, parameter) of method setSource() to contain the first arg which is passed to the application".
    This is exactly the same mechanism allowing you to write "new Scanner" with something inside the two parentheses.

  • Pass as a parameter or use set() method?

    This question may be a bit too abstract:
    A method of ClassB needs the HashMap member variable 'map' from ClassA. Should I pass map as a parameter into a method of ClassB, i.e.
    ClassB b = new ClassB();
    b.aMethod(map);or should I use a set() method in ClassB to set a member variable of type HashMap in ClassB, i.e.
    ClassB b = new ClassB();
    b.setMap(map); //sets the HashMap member variable in ClassB to equal map
    b.aMethod(); //aMethod now performs its operation on the HashMap member variable of ClassBHow do you decide which way is prefereable?

    Depends on your model, I suppose. Form the example, though, I wouldn't make the map a member of Class B, unless Class B should logically possess such a map. If the method in Class B is just operating on some values from the map, it makes more sense to me just to pass it in as an argument.

  • Setter method not getitng called in the custom tag

    Hi,
    I have written a custom tag and I have declared an attribute in the tld file and have specified the setter method for the same in the java tag file but that setter method is not getting called...for rest of the attributes, the methods are getting called and not just for one!! any idea what could be the problem....
    Regards
    Deepak Saini

    Do you have a getter method to match that property?
    Post some example code - what does your tld define for this property, and what get/set methods have you defined for it?

  • Getter & Setter Method not getting called for a field enhanced through AET

    Hello,
    I am new to SAP CRM 7.0 and working on a requirement.
    A Z-field was added by our functional guy in CRM 7.0 WebGui through AET in the 'Create Opportunity' transaction (Header data).
    Now the requirement is, as soon as the opportunity is created through the WebGui, I should post a document in R/3 and paste that document number back to the enhanced Z-field in opportunity.
    Work done by me:
    I pressed F2 on the enhanced Z-field in the WebGui screen and took the details of view, component name etc. After this I went to normal SAP CRM system and open tcode "BSP_WD_CMPWB", located the corresponding view "BT111H_OPPT/Details" and right clicked & enhanced the same.
    Then I opened the structure of this view, expanded context node, located context "BTOPPORTH" and inside this, located my Z-attribute. Now right clicked on the Z-attribute & selected the option "Generate SETTER & GETTER Methods" and these were generated successfully.
    Problem:
    The problem is even after putting external break points in these methods, these methods are not getting called while creating, modifying & displaying the Opportunity in WebGui.
    I hope that for the requirements that I have, I have to do the coding in "Getter & Setter" methods. But since these are not getting called, I am unable to proceed.
    Please help/suggest how to achieve this.
    Thanks in anticipation.
    Best Regards,
    Rahul Malani

    Hi,
    If you can see the field in UI and still get_ method is not being triggered then try to regenerate these methods. If it still doesn't work then please look for SAP notes or raise an OSS.
    There should be some note for the issue you faced.
    please refer:
    Help Needed immediately - AET getter setter methods not getting triggered
    Regards,
    BJ

  • How can i invoke the set method before value change listener?

    Hi,
    My code is like this:
    <af:selectManyCheckbox value="#{bean.statusList}"
                                     binding="#{bean.statusCheckBox}"
                                     label=" " autoSumit="true"
                                     valueChangeListener="#{bean.changeStatusList}"
                                     id="dc_smc1" layout="vertical"">
                <f:selectItems value="#{bean.statusBuckets}"
                               id="statusBuckets"/>
              </af:selectManyCheckbox>
    public void changeStatusList(ValueChangeEvent valueChangeEvent)
      //in this method, i want to set the statusList by myself, this is not the same with the ui.
    public void setStatusList(List<String> statusList)
            this.statusList = statusList;
        public List<String> getStatusList()
            return statusList;
    As i set the autoSumit="true", then no matter what i set the statusList in the method changeStatusList, it will be reset the value after invoke the method setStatusList, Therefore, it will always change the checkbox status through ui operation, i cannot change it through code.
    Pl help me!
    Thanks,
    Emma

    Emma, which jdev version do you use?
    As you have set the value property to the list you try to change in the valueChangeListener method this is expected behavior. If the list is bound to the af:selectManyCheckbox values you can't change it with a set method.
    It would help if you tell us what you are trying to do in a broader scope.
    Timo

  • Initialize in the constructor is better or set the value thro' set method?

    Hi,
    For the normal helper classes for servelt or jsp or EJB,
    Which of the following one is the better ...?
    1.
    i.initialize all the fields in the constructor, then
    ii.use the set methods
    or
    2.
    i.do not use the contructor and
    ii.use the set methods to set the values
    Anybody can give the solution for this one...
    With regards
    vkm

    Your option 1 puzzles me, why would you need tyo use the setter methods if you already initialized in the constructor?

  • Where is the "set" method for this ELEMENT?

    Hi
    I'm trying to understand the relationship between the DTD and XJS, and the JAXB generated code.
    Consider the example DTD, XJS, and generated source code (i.e., "value07.java") for ELEMENT value07, below ...
    QUESTION#1: Why is there no "set" method generated for ELEMENT "value07a" within the generated value07.java ???
    QUESTION#2: How to I code the DTD/XJS in order to force the generation of a "set" method in value07.java???.
    -- I want to be able to set a new value for ELEMENT "value07a" in order to generate an XML document containing the new value!!
    (NOTE: the reason that ELEMENT value07 (as well as other ELEMENTs) has only a single subelement, is in order to satisfy the XSLT definition in a preexisting application.)
    * * * this is the DTD* * *
    <!ELEMENT request                          (value01,value02,value03,value04,value05?,value06?,value07?,value08?,value09?,value10?,value11?,value12?,value13?,value14?,value15?,value16?,value17?,value18?)>
    <!ELEMENT value01                          (#PCDATA)>
    <!ELEMENT value02                          (#PCDATA)>
    <!ELEMENT value03                          (#PCDATA)>
    <!ELEMENT value04                          (value04a, value04b?)>
    <!ELEMENT value04a                          (#PCDATA)>
    <!ELEMENT value04b                          (#PCDATA)>
    <!ELEMENT value05                          (value05a, value05b?)>
    <!ELEMENT value05a                          (#PCDATA)>
    <!ELEMENT value05b                          (#PCDATA)>
    <!ELEMENT value06                          (value06a+)>
    <!ELEMENT value06a                          (#PCDATA)>
    <!ELEMENT value07                          (value07a+)>
    <!ELEMENT value07a                          (#PCDATA)>
    <!ELEMENT value08                          (value08a+)>
    <!ELEMENT value08a                          (#PCDATA)>
    <!ELEMENT value09                          (value09a+)>
    <!ELEMENT value09a                          (#PCDATA)>
    <!ELEMENT value10                          (value10a+)>
    <!ELEMENT value10a                          (#PCDATA)>
    <!ELEMENT value11                          (value11a+)>
    <!ELEMENT value11a                          (#PCDATA)>
    <!ELEMENT value12                          (value12a+)>
    <!ELEMENT value12a                          (#PCDATA)>
    <!ELEMENT value13                          (value13a+)>
    <!ELEMENT value13a                          (#PCDATA)>
    <!ELEMENT value14                          (value14a+)>
    <!ELEMENT value14a                          (#PCDATA)>
    <!ELEMENT value15                          (value15a+)>
    <!ELEMENT value15a                          (#PCDATA)>
    <!ELEMENT value16                          (value16a+)>
    <!ELEMENT value16a                          (#PCDATA)>
    <!ELEMENT value17                          (value17a+)>
    <!ELEMENT value17a                          (#PCDATA)>
    <!ELEMENT value18                          (value18a+)>
    <!ELEMENT value18a                          (#PCDATA)>
    * * * this is the XJS * * *
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE xml-java-binding-schema SYSTEM "http://java.sun.com/dtd/jaxb/1.0-ea/xjs.dtd">
    <xml-java-binding-schema version="1.0-ea">
    <options package="testSourceCode"/>
    <element name="request" type="class" root="true"/>
         <element name="value01"                               type="value"/>
         <element name="value02"                               type="value"/>
         <element name="value03"                          type="value"/>
         <element name="value04" type="class">
              <content>
                   <element-ref name="value04a" />
                   <element-ref name="value04b" />
              </content>
         </element>
         <element name="value05" type="class">
              <content>
                   <element-ref name="value05a" />
                   <element-ref name="value05b" />
              </content>
         </element>
         <element name="value06" type="class">
              <content>
                   <element-ref name="value06a" />
              </content>
         </element>
         <element name="value07" type="class">
              <content>
                   <element-ref name="value07a" />
              </content>
         </element>
         <element name="value08" type="class">
              <content>
                   <element-ref name="value08a" />
              </content>
         </element>
         <element name="value09" type="class">
              <content>
                   <element-ref name="value09a" />
              </content>
         </element>
         <element name="value10" type="class">
              <content>
                   <element-ref name="value10a" />
              </content>
         </element>
         <element name="value11" type="class">
              <content>
                   <element-ref name="value11a" />
              </content>
         </element>
         <element name="value12" type="class">
              <content>
                   <element-ref name="value12a" />
              </content>
         </element>
         <element name="value13" type="class">
              <content>
                   <element-ref name="value13a" />
              </content>
         </element>
         <element name="value14" type="class">
              <content>
                   <element-ref name="value14a" />
              </content>
         </element>
         <element name="value15" type="class">
              <content>
                   <element-ref name="value15a" />
              </content>
         </element>
         <element name="value16" type="class">
              <content>
                   <element-ref name="value16a" />
              </content>
         </element>
         <element name="value17" type="class">
              <content>
                   <element-ref name="value17a" />
              </content>
         </element>
         <element name="value18" type="class">
              <content>
                   <element-ref name="value18a" />
              </content>
         </element>
    </xml-java-binding-schema>
    * * * generated sourcecode for ELEMENT "value07"...i.e., "value07.java" * * *
    package testSourceCode;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.bind.ConversionException;
    import javax.xml.bind.Dispatcher;
    import javax.xml.bind.Element;
    import javax.xml.bind.InvalidAttributeException;
    import javax.xml.bind.InvalidContentObjectException;
    import javax.xml.bind.LocalValidationException;
    import javax.xml.bind.MarshallableObject;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.MissingContentException;
    import javax.xml.bind.PredicatedLists;
    import javax.xml.bind.PredicatedLists.Predicate;
    import javax.xml.bind.StructureValidationException;
    import javax.xml.bind.UnmarshalException;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.bind.Validator;
    import javax.xml.marshal.XMLScanner;
    import javax.xml.marshal.XMLWriter;
    public class Value07
    extends MarshallableObject
    implements Element
    private List _Value07A = PredicatedLists.createInvalidating(this, new Value07APredicate(), new ArrayList());
    private PredicatedLists.Predicate pred_Value07A = new Value07APredicate();
    public List getValue07A() {
    return _Value07A;
    public void deleteValue07A() {
    _Value07A = null;
    invalidate();
    public void emptyValue07A() {
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, new ArrayList());
    public void validateThis()
    throws LocalValidationException
    if (_Value07A == null) {
    throw new MissingContentException("value07a");
    public void validate(Validator v)
    throws StructureValidationException
    public void marshal(Marshaller m)
    throws IOException
    XMLWriter w = m.writer();
    w.start("value07");
    for (Iterator i = _Value07A.iterator(); i.hasNext(); ) {
    w.leaf("value07a", ((String) i.next()).toString());
    w.end("value07");
    public void unmarshal(Unmarshaller u)
    throws UnmarshalException
    XMLScanner xs = u.scanner();
    Validator v = u.validator();
    xs.takeStart("value07");
    while (xs.atAttribute()) {
    String an = xs.takeAttributeName();
    throw new InvalidAttributeException(an);
    List l = new ArrayList();
    while (xs.atStart()) {
    if (xs.atStart("value07a")) {
    xs.takeStart("value07a");
    String s;
    if (xs.atChars(XMLScanner.WS_COLLAPSE)) {
    s = xs.takeChars(XMLScanner.WS_COLLAPSE);
    } else {
    s = "";
    String uf;
    try {
    uf = String.valueOf(s);
    } catch (Exception x) {
    throw new ConversionException("value07a", x);
    l.add(uf);
    xs.takeEnd("value07a");
    } else {
    break;
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, l);
    xs.takeEnd("value07");
    public static Value07 unmarshal(InputStream in)
    throws UnmarshalException
    return unmarshal(XMLScanner.open(in));
    public static Value07 unmarshal(XMLScanner xs)
    throws UnmarshalException
    return unmarshal(xs, newDispatcher());
    public static Value07 unmarshal(XMLScanner xs, Dispatcher d)
    throws UnmarshalException
    return ((Value07) d.unmarshal(xs, (Value07 .class)));
    public boolean equals(Object ob) {
    if (this == ob) {
    return true;
    if (!(ob instanceof Value07)) {
    return false;
    Value07 tob = ((Value07) ob);
    if (_Value07A!= null) {
    if (tob._Value07A == null) {
    return false;
    if (!_Value07A.equals(tob._Value07A)) {
    return false;
    } else {
    if (tob._Value07A!= null) {
    return false;
    return true;
    public int hashCode() {
    int h = 0;
    h = ((127 *h)+((_Value07A!= null)?_Value07A.hashCode(): 0));
    return h;
    public String toString() {
    StringBuffer sb = new StringBuffer("<<value07");
    if (_Value07A!= null) {
    sb.append(" value07a=");
    sb.append(_Value07A.toString());
    sb.append(">>");
    return sb.toString();
    public static Dispatcher newDispatcher() {
    return Request.newDispatcher();
    private static class Value07APredicate
    implements PredicatedLists.Predicate
    public void check(Object ob) {
    if (!(ob instanceof String)) {
    throw new InvalidContentObjectException(ob, (String.class));

    I discovered something similar this morning...i.e., for
    <element name="value07" type="class">
    <content>
    <element-ref name="value07a" />
    </content>
    </element>
    -- I did something like this...
    Value7 v7 = new Value7();
    for (int i=0; i< Value7_input_array.length; i++)
    ((List)(v7.getValue07A())).add(Value7_input_array);
    Thanks for responding, barry!

  • How to call  set method

    hi i have a set method which i what to call from another class how can i do that
    Edited by: ADF007 on 2012/09/13 2:08 PM
    Edited by: ADF007 on 2012/09/13 2:08 PM
    Edited by: ADF007 on 2012/09/13 3:14 PM

    Where are these methods written? What technologies/versions are you using?
    From the looks of it, I'm assuming assignRolesToUser seems to be a method in some ADFbc component (AM?)
    and RowButtonListener seems to be a managed bean method.
    You need to first read and understand how to expose ADFbc service operations (such as AM methods) in a client interface and call from your UI layer (such as bean method or similar UI action).
    Here's something: https://blogs.oracle.com/jdevotnharvest/entry/best_practice_invoking_business_services

Maybe you are looking for

  • Error while executing DB procedure proxy

    I am getting error 'Database error text: Insufficient privilege: Not Authorized ' when I call a database procedure proxy in a abap report program. Can any one help? CALL DATABASE PROCEDURE zdpp_oia_topandflop EXPORTING iv_number = lv_number IMPORTING

  • For Persian Language show wrong (generated by Oracle Report Server)

    Hi, When Oracle Report Server (10.1.2) Generate PDF output show persian characters wrong. persian language(Use in Iran , Azarbayjan , Tajikestan ,... ) has 4 characters more than Arabic (cp1256) . this 4 characters is (پ  ,ژ,گ,ج) . when come (this ch

  • Movie clips

    How can I convert layered .fla or .swf files into movie clips (not sure which to use)? I'd like to be able to use 3 of them (at reduced sizes) in one larger file. Flash - CS3. Thanks in advance.

  • ATV and Air Video Streaming stopped working

    I have been using AIR VIDEO (Standard and HD Version) for months now flawlessly, no issues at all, until the other day any of my devices (iPhones and iPads) will only stream to my ATV's for a few seconds then they cut off and jump back to home screen

  • Unknown error 1140

    Just got my new iPhone 5/made a purchase at the app store received msg back that an unknown device made a purchase at the app store? I confirmed it was an authroized purchase. Then the fun begins/updated my password (changed PW) on all devices/worked