File tree Expand file tree Collapse file tree
wayang-api/wayang-api-json/src/main/scala
wayang-commons/wayang-core/src/main/java/org/apache/wayang/core/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,5 +70,8 @@ object Main extends ZIOAppDefault {
7070 val app = Routes (drawRoute, jsonRoute).toHttpApp
7171
7272 // Run it like any simple app
73- override val run = Server .serve(app).provide(Server .default)
73+ def run = for {
74+ args <- getArgs
75+ _ <- Server .serve(app).provide(Server .defaultWithPort((args.headOption getOrElse " 8080" toInt)))
76+ } yield ()
7477}
Original file line number Diff line number Diff line change 7575import java .util .Map ;
7676import java .util .Optional ;
7777import java .util .OptionalDouble ;
78+ import java .util .OptionalInt ;
7879import java .util .OptionalLong ;
7980import java .util .Properties ;
8081import java .util .Random ;
@@ -778,6 +779,20 @@ public long getLongProperty(String key) {
778779 return optionalLongProperty .getAsLong ();
779780 }
780781
782+
783+ public OptionalInt getOptionalIntProperty (String key ) {
784+ final Optional <String > intValue = this .properties .optionallyProvideFor (key );
785+ if (intValue .isPresent ()) {
786+ return OptionalInt .of (Integer .valueOf (intValue .get ()));
787+ } else {
788+ return OptionalInt .empty ();
789+ }
790+ }
791+
792+ public int getIntProperty (String key ) {
793+ return getOptionalIntProperty (key ).orElseThrow (() -> new WayangException (String .format ("No value for \" %s\" ." , key )));
794+ }
795+
781796 public long getLongProperty (String key , long fallback ) {
782797 return this .getOptionalLongProperty (key ).orElse (fallback );
783798 }
You can’t perform that action at this time.
0 commit comments