cuizhennan / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
1 stars 0 forks source link

Allow non-alphabetical BeanAccess for accessors as well as fields #170

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
BeanAccess.DEFAULT always returns the properties alphabetically, while 
BeanAccess.FIELD returns them unsorted albeit from the fields. It would be nice 
to have an additional mode that retrieves the bean properties from the getters 
and setters, but does not alphabetize them. Instead, it would return them in 
the order given on the class.

This allows the operation order on the class to be the desired order and does 
not expose private attributes. 

Original issue reported on code.google.com by jayjaybi...@gmail.com on 17 Feb 2013 at 6:38

GoogleCodeExporter commented 9 years ago
I would like to list this as an "enhancement," not a defect. I can not change 
the type, though.

Original comment by jayjaybi...@gmail.com on 17 Feb 2013 at 6:39

GoogleCodeExporter commented 9 years ago
Do you may be know how to get the list in the order you expect ?
By "the order given on the class" you probably mean "the order in the source". 
Feel free to help us to know this order.

Original comment by py4fun@gmail.com on 17 Feb 2013 at 9:32

GoogleCodeExporter commented 9 years ago
I do no know how to get the list, but I can try to take some time a few weeks 
to look at it. (Under the gun on a deliverable at the moment.)

Yes, the order I mean is the operation order in the source. So, if I have

public class Car {
    public int getSpeed() {...};
    public int getColor() {...};
    public int getTireType() {...};
}

I would expect the elements to be ordered as speed, color and tireType instead 
of alphabetical order with this enhancement.

Original comment by jayjaybi...@gmail.com on 17 Feb 2013 at 10:06

GoogleCodeExporter commented 9 years ago
check issue 59 , it may answer your question. 

Original comment by alexande...@gmail.com on 18 Feb 2013 at 6:58

GoogleCodeExporter commented 9 years ago

Original comment by py4fun@gmail.com on 8 Oct 2013 at 9:20