Skip to main content

Request to declare StreamCodingType.getType(Integer value) public

4 replies [Last post]
titou10
Offline
Joined: 2010-01-05
Points: 0

Dear developers of DiscCreationTools,

I have a request: Could you change the visibility of the method "static StreamCodingType getType(Integer value)" in "net.java.bd.tools.playlist.StreamCodingType" to "public" (instead of "package")?

Many Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chihiro_saito
Offline
Joined: 2006-11-08
Points: 0

Hi,

It'll be easy to do, but can I ask the context behind the request? If this is about working around problems like Text Subtitle stream value mismatch that you've reported, then I think exposing register(StreamCodingType) method makes a bit more sense.

Thanks,
Chihiro

titou10
Offline
Joined: 2010-01-05
Points: 0

The problems comes from the fact that the "StreamAttribute" class declare the "streamCodingType" attribute as an "Integer"

So, given a StreamAttribute, when you want to display the description of the coding type, you need to call StreamCodingType.getType().getDescription(), which is not possible because getType() is not visible...

A better solution could be to declare the "streamCodingType" as a StrreamCodingType" instead of a Integer in "StreamAttribute"

chihiro_saito
Offline
Joined: 2006-11-08
Points: 0

I see, appreciate your explanation. I filed an RFE for it, # 208. I agree that making streamCodingType field in the StreamAttribute to be the class rather than Integer.

titou10
Offline
Joined: 2010-01-05
Points: 0

Chihiro, I've seen you comment on #208 and as I can not add a comment there, I will do it here.

1) This is a *very* bad practice in Java to have a getter method getXXX that does not return XXX. So if you want to return "streamCodingType.getValue()", please name the method "getStreamCodingTypeValue()", not "getStreamCodingType()". Same remark for the setter method

2) The class already exposes all its attributes, why not exposing StreamCodingType too?.

3) As for your remark on the xml generation, I think too that only the integer should be exported in the xml and the @XmlAttribute(name=streamCodingType) annotation on the "getStreamCodingTypeValue()" (.. not "getStreamCodingType()") method should be OK

Hope that helps.

Thanks!