public static JsonObject toJson ( Project project ) { JsonObjectBuilder builder = Json . createObjectBuilder ( ) ; Optional . ofNullable ( project . getBaseLocation ( ) ) . ifPresent ( uri -> builder . add ( REFBASE_KEY , String . valueOf ( uri ) ) ) ; if ( project . getSystemInputLocation ( ) != null ) { builder . add ( INPUTDEF_KEY , String . valueOf ( project . getSystemInputLocation ( ) ) ) ; } else if ( project . getSystemInput ( ) != null ) { builder . add ( INPUTDEF_KEY , SystemInputJson . toJson ( project . getSystemInput ( ) ) ) ; } if ( project . getGeneratorsLocation ( ) != null ) { builder . add ( GENERATORS_KEY , String . valueOf ( project . getGeneratorsLocation ( ) ) ) ; } else if ( project . getGenerators ( ) != null ) { builder . add ( GENERATORS_KEY , GeneratorSetJson . toJson ( project . getGenerators ( ) ) ) ; } if ( project . getBaseTestsLocation ( ) != null ) { builder . add ( BASETESTS_KEY , String . valueOf ( project . getBaseTestsLocation ( ) ) ) ; } else if ( project . getBaseTests ( ) != null ) { builder . add ( BASETESTS_KEY , SystemTestJson . toJson ( project . getBaseTests ( ) ) ) ; } return builder . build ( ) ; }
Returns the JSON object that represents the given project definition .