001/* 002 * Configurate 003 * Copyright (C) zml and Configurate contributors 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.spongepowered.configurate.interfaces.meta.range; 018 019import java.lang.annotation.ElementType; 020import java.lang.annotation.Retention; 021import java.lang.annotation.RetentionPolicy; 022import java.lang.annotation.Target; 023 024/** 025 * This annotation limits the values that a config node can have. 026 * Because of annotation limits, there is an annotation for: 027 * {@link DecimalRange decimals}, {@link NumericRange numerics} and 028 * {@link StringRange String length}. 029 * 030 * <p>When the String is null, the range validation is skipped. Use 031 * {@link org.spongepowered.configurate.objectmapping.meta.Required Required} 032 * if null shouldn't be allowed.</p> 033 * 034 * @since 4.2.0 035 */ 036@Retention(RetentionPolicy.RUNTIME) 037@Target(ElementType.METHOD) 038public @interface StringRange { 039 /** 040 * The minimal String length allowed (inclusive.) 041 * 042 * @return the minimal value allowed (inclusive.) 043 * @since 4.2.0 044 */ 045 int from(); 046 047 /** 048 * The maximal String length allowed (inclusive.) 049 * 050 * @return the maximal value allowed (inclusive.) 051 * @since 4.2.0 052 */ 053 int to(); 054 055}