Menu

#583 Gentrified IChemObject getProperty

Accepted
closed
nobody
IChemObject (1)
master
1
2012-12-12
2012-11-18
John May
No

Made the getProperty method of IChemObject generic so we don't have to do casts when calling. https://github.com/johnmay/cdk/tree/master+

currently

Integer number = (Integer) atom.getProperty("number");

now

Integer number = atom.getProperty("number");

I also made one which can be chained

String hex = atom.getProperty("number", Integer.class).toHexString();

This does not change any existing using code as they are effectively calling the return type of Object which is then cast if needed.

Discussion

  • Egon Willighagen

    This is cool stuff!

     
  • Egon Willighagen

    • status: open --> closed
    • milestone: Needs_Review --> Accepted
     
  • Egon Willighagen

    Applied and pushed.

     

Log in to post a comment.