Update of /var/cvs/src/org/mmbase/datatypes In directory james.mmbase.org:/tmp/cvs-serv32515
Modified Files: Tag: MMBase-1_8 DataType.java BasicDataType.java Log Message: MMB-1794 (ported getEnforceStrenght, because needed to fix that) See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/datatypes See also: http://www.mmbase.org/jira/browse/MMB-1794 Index: DataType.java =================================================================== RCS file: /var/cvs/src/org/mmbase/datatypes/DataType.java,v retrieving revision 1.54.2.2 retrieving revision 1.54.2.3 diff -u -b -r1.54.2.2 -r1.54.2.3 --- DataType.java 17 Mar 2009 14:45:55 -0000 1.54.2.2 +++ DataType.java 23 Mar 2009 16:00:03 -0000 1.54.2.3 @@ -38,7 +38,7 @@ * @author Pierre van Rooden * @author Michiel Meeuwissen * @since MMBase-1.8 - * @version $Id: DataType.java,v 1.54.2.2 2009/03/17 14:45:55 michiel Exp $ + * @version $Id: DataType.java,v 1.54.2.3 2009/03/23 16:00:03 michiel Exp $ */ public interface DataType extends Descriptor, Cloneable, Comparable, Serializable { @@ -191,6 +191,13 @@ */ public void finish(Object owner); + /** + * The maximum enforce strength of all restrictions on this datatype. + * See {...@link DataType#ENFORCE_ALWAYS}, {...@link DataType#ENFORCE_ONCHANGE}, {...@link DataType#ENFORCE_NEVER}. + * @return maximum enforce strength + */ + public int getEnforceStrength(); + /** * @see #validate(Object, Node, Field) Index: BasicDataType.java =================================================================== RCS file: /var/cvs/src/org/mmbase/datatypes/BasicDataType.java,v retrieving revision 1.61.2.11 retrieving revision 1.61.2.12 diff -u -b -r1.61.2.11 -r1.61.2.12 --- BasicDataType.java 17 Mar 2009 14:45:55 -0000 1.61.2.11 +++ BasicDataType.java 23 Mar 2009 16:00:03 -0000 1.61.2.12 @@ -38,7 +38,7 @@ * @author Pierre van Rooden * @author Michiel Meeuwissen * @since MMBase-1.8 - * @version $Id: BasicDataType.java,v 1.61.2.11 2009/03/17 14:45:55 michiel Exp $ + * @version $Id: BasicDataType.java,v 1.61.2.12 2009/03/23 16:00:03 michiel Exp $ */ public class BasicDataType extends AbstractDescriptor implements DataType, Cloneable, Comparable, Descriptor { @@ -567,6 +567,12 @@ return errors; } + public int getEnforceStrength() { + int enforceStrength = Math.max(typeRestriction.getEnforceStrength(), requiredRestriction.getEnforceStrength()); + enforceStrength = Math.max(enforceStrength, enumerationRestriction.getEnforceStrength()); + return Math.max(enforceStrength, uniqueRestriction.getEnforceStrength()); + } + protected Collection validateCastValue(Collection errors, Object castValue, Object value, Node node, Field field) { return errors; } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs