Skip to content Skip to sidebar Skip to footer

Return Calendar Event Details In An Array

I have a calendar in which if the user selects the date and it takes him to an event details page. On the event details page the data is displayed in a tabular format. So far so go

Solution 1:

Create a class that contains these event details and return an instance of it. For example:

publicclassEvent{
    publicfinalString name;
    publicfinalString title;
    publicfinalString details;

    public Event(finalString a_name,
                 finalString a_title,
                 finalString a_details)
    {
        name = a_name;
        title = a_title;
        details = a_details;
    }
};

public Event eventDetails(int m, int d) {
    if (some-condition)
        returnnew Event("my-name1", "my-title1", "mydetails1");
    elsereturnnew Event("my-name2", "my-title2", "mydetails2");
}

final Event e = eventDetails(1, 4);
name.setText(e.name);
title.setText(e.title);
details.setText(e.details);

Solution 2:

There two ways you can return, 1) as array you specified 2) Create HolidayVO with required variables and gettter/setters.

Based on case:

case1:
    if (d == 1) {
       //Create holiday object with values;
    } elseif (d == 10) {
        //Create holiday object with values;
    }
    break; 

Post a Comment for "Return Calendar Event Details In An Array"