Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DagAConfV1{
- String person_id:
- }
- class DagBConfV1{
- String name:
- }
- MIGRATION_DATE LocalDate = LocalDate.parse("2016-06-12").atStartOfDay();
- class DagBConfV2{
- String first_name:
- }
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- JSONParser parse = new JSONParser();
- dagruns_collection: DagRunCollection = client.getDagRuns()
- for(DagRun nazwa_obiektu : dagruns_collection.getDagRuns()) {
- // Java idiomatic types
- if(dag_runs.dag_id == "DAG_ID") {
- DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagAConfV1.class);
- // Do somethings
- } else (dag_runs.dag_id == "DAG_ID") {
- if(MIGRATION_DATE.isBefore(dag_run.getExecutionDate()))
- DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagBConfV1.class);
- // Do somethings
- }else{
- DagAConfV1 empObject = gson.fromJson(dag_run.getConf(), DagBConfV2.class);
- }
- }else{
- // Dynamic typed object - Dynamic lnaguage idiomatic
- JSONObject jobj = (JSONObject) parse.parse(dag_run.getConf());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment