William Cheng 4ecb9f4186
[java][native] Fix urlQuery string method in oneOf (#14488)
* better tests, fix oneOf in urlquery string method

* update samples

* update
2023-01-20 01:57:32 +08:00

1.2 KiB

Mammal

oneOf schemas

Example

// Import classes:
import org.openapitools.client.model.Mammal;
import org.openapitools.client.model.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;

public class Example {
    public static void main(String[] args) {
        Mammal exampleMammal = new Mammal();

        // create a new Pig
        Pig examplePig = new Pig();
        // set Mammal to Pig
        exampleMammal.setActualInstance(examplePig);
        // to get back the Pig set earlier
        Pig testPig = (Pig) exampleMammal.getActualInstance();

        // create a new Whale
        Whale exampleWhale = new Whale();
        // set Mammal to Whale
        exampleMammal.setActualInstance(exampleWhale);
        // to get back the Whale set earlier
        Whale testWhale = (Whale) exampleMammal.getActualInstance();

        // create a new Zebra
        Zebra exampleZebra = new Zebra();
        // set Mammal to Zebra
        exampleMammal.setActualInstance(exampleZebra);
        // to get back the Zebra set earlier
        Zebra testZebra = (Zebra) exampleMammal.getActualInstance();
    }
}