Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom Resource and Item classes (Read 37 times)
Raeees
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Dec 11th, 2024
Custom Resource and Item classes
Jan 31st, 2025 at 2:22pm
Print Post  
Hi,
When using custom made classes like
Code (Java)
Select All
public class CustomResource  extends Resource 


or
Code (Java)
Select All
public class CustomItem extends Item 



do all the references from calendar point to the custom class objects?
Lets say for exampe i use
Code (Java)
Select All
calendar.getResources(); 


This line of code will return a list of ''ResourceList<Resource>'' and not ''ResourceList<CustomResource>'' or ''ResourceList<? extends Resource>''. issue with this is that i cant acces some of the new elements i add in my custom class. there are more instances of this ''small'' issue like with CustomItem Object but this is the first example to come to my mind.

Any insights in this issue will be appreciated.

Cordially.
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3342
Joined: Oct 19th, 2005
Re: Custom Resource and Item classes
Reply #1 - Feb 3rd, 2025 at 9:19am
Print Post  
Hi,

I don't think the control limits you to a single type of custom resources in the collection, you could add instances of other Resource -derived classes. So if you need to access your custom properties, you'd have to use instanceof and downcasting. If you'll be using a single type of custom resource, you could add a helper method returning the proper type to do the typecasting just from one place.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint