calimero-project / calimero-core

Core library for KNX network access and management
Other
129 stars 65 forks source link

Update DatapointMap.java #4

Closed mcicolella closed 10 years ago

mcicolella commented 10 years ago

Modified DatapointMap class to store StateDP and CommandDP instead of a generic Datapoint

bmalinowsky commented 10 years ago

Can you further explain that? I don't understand this change (besides the unnecessary reformatting). There is never a concrete type Datapoint created, its an abstract class. You basically inline the create factory method, no?

mcicolella commented 10 years ago

Hi, sorry for delay. I want to store in DatapointMap the correct type of datapoints read from datapoints xml file. So I modified loadXML method to set the subclass type

Datapoint dp = null; // sets the correct datapoint subclass StateDP or CommandDP if (readDPType(r)) { dp = new StateDP(r); } else { dp = new CommandDP(r); }

Using a generic Datapoint I can't read updating addresses of StateDP. Thanks

bmalinowsky commented 10 years ago

And how is that different from the create method that is currently used? The created object assigned is always an instance of StateDP or CommandDP. That the declared type is Datapoint doesn't matter.

Again, there is never a Datapoint instantiated directly (it's an abstract class), always subclasses thereof.

mcicolella commented 10 years ago

You are right. Please close this. Thanks