MATLAB Answers

Call Java Method with enum parameter

16 views (last 30 days)
Taiwo on 17 Oct 2011
Edited: David on 13 Jun 2019
How can i call a Java Class and pass an enum parameter into the method. Eg when i do the methodsview Security: I have the class show as : (java.lang.String,$Type,java.lang.String,$Broker)

Answers (1)

David on 13 Jun 2019
Edited: David on 13 Jun 2019
There is an explanation here:
It took me a while to make it work because my ennumeration 'EstimationMethod' is an inner class of 'SeatsSpecification',
public class SeatsSpecification implements IProcSpecification, Cloneable {
public static enum EstimationMethod {
Burman, KalmanSmoother, McElroyMatrix
and in this case I had to proceed as follows to define my three parameters in the ennumeration:
Burman=javaMethod('valueOf','ec.satoolkit.seats.SeatsSpecification$EstimationMethod', 'KalmanSmoother')
KalmanSmoother=javaMethod('valueOf','ec.satoolkit.seats.SeatsSpecification$EstimationMethod', 'Burman')
McElroyMatrix=javaMethod('valueOf','ec.satoolkit.seats.SeatsSpecification$EstimationMethod', 'McElroyMatrix')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!