private Controller(NewController newController) { checkState(!newController.actions.isEmpty(), "At least one action must be declared in the web service '%s'", newController.path); this.path = newController.path; this.description = newController.description; this.since = newController.since; Map<String, Action> mapBuilder = new HashMap<>(); for (NewAction newAction : newController.actions.values()) { mapBuilder.put(newAction.key, new Action(this, newAction)); } this.actions = Collections.unmodifiableMap(mapBuilder); }
private Controller(NewController newController) { if (newController.actions.isEmpty()) { throw new IllegalStateException( String.format("At least one action must be declared in the web service '%s'", newController.path)); } this.path = newController.path; this.description = newController.description; this.since = newController.since; ImmutableMap.Builder<String, Action> mapBuilder = ImmutableMap.builder(); for (NewAction newAction : newController.actions.values()) { mapBuilder.put(newAction.key, new Action(this, newAction)); } this.actions = mapBuilder.build(); }
private Controller(NewController newController) { checkState(!newController.actions.isEmpty(), "At least one action must be declared in the web service '%s'", newController.path); this.path = newController.path; this.description = newController.description; this.since = newController.since; Map<String, Action> mapBuilder = new HashMap<>(); for (NewAction newAction : newController.actions.values()) { mapBuilder.put(newAction.key, new Action(this, newAction)); } this.actions = Collections.unmodifiableMap(mapBuilder); }