private Action(Controller controller, NewAction newAction) { this.key = newAction.key; this.deprecatedKey = newAction.deprecatedKey; this.path = format("%s/%s", controller.path(), key); this.description = newAction.description; this.since = newAction.since; this.deprecatedSince = newAction.deprecatedSince; this.post = newAction.post; this.isInternal = newAction.isInternal; this.responseExample = newAction.responseExample; this.handler = newAction.handler; this.changelog = newAction.changelog; checkState(this.handler != null, "RequestHandler is not set on action %s", path); logWarningIf(isNullOrEmpty(this.description), "Description is not set on action " + path); logWarningIf(isNullOrEmpty(this.since), "Since is not set on action " + path); logWarningIf(!this.post && this.responseExample == null, "The response example is not set on action " + path); Map<String, Param> paramsBuilder = new HashMap<>(); for (NewParam newParam : newAction.newParams.values()) { paramsBuilder.put(newParam.key, new Param(this, newParam)); } this.params = Collections.unmodifiableMap(paramsBuilder); }
private Action(Controller controller, NewAction newAction) { this.key = newAction.key; this.deprecatedKey = newAction.deprecatedKey; this.path = format("%s/%s", controller.path(), key); this.description = newAction.description; this.since = newAction.since; this.deprecatedSince = newAction.deprecatedSince; this.post = newAction.post; this.isInternal = newAction.isInternal; this.responseExample = newAction.responseExample; this.handler = newAction.handler; this.changelog = newAction.changelog; checkState(this.handler != null, "RequestHandler is not set on action %s", path); logWarningIf(isNullOrEmpty(this.description), "Description is not set on action " + path); logWarningIf(isNullOrEmpty(this.since), "Since is not set on action " + path); logWarningIf(!this.post && this.responseExample == null, "The response example is not set on action " + path); Map<String, Param> paramsBuilder = new HashMap<>(); for (NewParam newParam : newAction.newParams.values()) { paramsBuilder.put(newParam.key, new Param(this, newParam)); } this.params = Collections.unmodifiableMap(paramsBuilder); }