com.zepben.vertxutils.routing.handlers.params.QueryParamRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-utils Show documentation
Show all versions of vertx-utils Show documentation
Helpers and utils for working with Vert.x in Zepben projects.
/*
* Copyright 2020 Zeppelin Bend Pty Ltd
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.zepben.vertxutils.routing.handlers.params;
import com.zepben.annotations.EverythingIsNonnullByDefault;
import javax.annotation.Nullable;
@EverythingIsNonnullByDefault
public class QueryParamRule extends ParamRule {
@Nullable private final T defaultValue;
private final boolean isRequired;
public static QueryParamRule of(String name, RequestValueConverter converter) {
return new QueryParamRule<>(name, converter, null, false);
}
public static QueryParamRule of(String name, RequestValueConverter converter, T defaultValue) {
return new QueryParamRule<>(name, converter, defaultValue, false);
}
public static QueryParamRule ofRequired(String name, RequestValueConverter converter) {
return new QueryParamRule<>(name, converter, null, true);
}
private QueryParamRule(String name, RequestValueConverter converter, @Nullable T defaultValue, boolean isRequired) {
super(name, converter);
this.defaultValue = defaultValue;
this.isRequired = isRequired;
}
@Nullable
public T defaultValue() {
return defaultValue;
}
public boolean isRequired() {
return isRequired;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy