001: /*
002: * $Header: /cvsroot/jvalidate/jvalidate-framework/jvalidate/src/main/java/nl/knowlogy/validation/metadata/PropertyMetadata.java,v 1.5 2007/04/01 12:59:51 roberthofstra Exp $
003: * $Revision: 1.5 $
004: * $Date: 2007/04/01 12:59:51 $
005: *
006: *
007: * Copyright 2004 - 2005 Knowlogy, the Netherlands, www.knowlogy.nl
008: *
009: * Licensed under the Apache License, Version 2.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.apache.org/licenses/LICENSE-2.0
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: */
021:
022: package nl.knowlogy.validation.metadata;
023:
024: import java.util.Map;
025:
026: /**
027: * <code>PropertyMetadata</code> is a interface for retrieving metadata from a property.
028: *
029: * @see nl.knowlogy.validation.metadata.StringMetadata
030: * @see nl.knowlogy.validation.metadata.IntegerMetadata
031: * @author Robert
032: */
033:
034: public interface PropertyMetadata {
035:
036: String MAX_SIZE = "maxSize";
037:
038: String MIN_SIZE = "minSize";
039:
040: String REQUIRED = "required";
041:
042: String MIN_LENGTH = "minlength";
043:
044: String MAX_LENGTH = "maxlenght";
045:
046: String PATTERN = "pattern";
047:
048: String ALLOWED_VALUES = "allowed-values";
049:
050: /**
051: * Returns the propertyName from the property to which this propertyMetadata
052: * belongs.
053: *
054: * @return the propertyName from the property to which this propertyMetadata
055: * belongs.
056: */
057: String getPropertyName();
058:
059: /**
060: * Return true if a value for this property is required.
061: *
062: * @return Returns the isRequired.
063: */
064: Boolean isRequired();
065:
066: /**
067: *
068: * @param value
069: */
070: void setRequired(Boolean value);
071:
072: /**
073: * Return a maxsize of a number value
074: * @return
075: */
076: Long getMaxSize();
077:
078: void setMaxSize(Long value);
079:
080: /**
081: * Returns a minsize of a number value.
082: *
083: * @return minsize of a number value
084: */
085: Long getMinSize();
086:
087: void setMinSize(Long value);
088:
089: /**
090: * @return Returns the regEx.
091: */
092: String getPattern();
093:
094: void setPattern(String pattern);
095:
096: /**
097: * Returns a string with the allowed values. Values
098: * a separeted with ','
099: *
100: * @return
101: */
102: String getAllowedValues();
103:
104: void setAllowedValues(String value);
105:
106: void setMaxLength(Long value);
107:
108: /**
109: * @return Returns the maxLength.
110: */
111: Long getMaxLength();
112:
113: void setMinLength(Long value);
114:
115: /**
116: * @return Returns the minLength.
117: */
118: Long getMinLength();
119:
120: /**
121: * Retuns a map with metadata. Standard keys ared
122: * maxSize, minSize, required,minlength, maxlenght, pattern
123: *
124: * @return a map with metadata. Standard keys ared
125: * maxSize, minSize, required,minlength, maxlenght, pattern .
126: */
127: Map getMetadata();
128:
129: }
|