Class DefaultInitializedConstraint

    • Constructor Detail

      • DefaultInitializedConstraint

        public DefaultInitializedConstraint()
    • Method Detail

      • getDefaultValueForField

        public <T> T getDefaultValueForField​(Field field)
        Get default value of given clazz
        Type Parameters:
        T - type of clazz
        Parameters:
        field - field to be checked if there is a user defined default value
        Returns:
        default value of field; if no user defined value was set returns default value of clazz
      • addUserdefinedDefaultValue

        public <T> void addUserdefinedDefaultValue​(Field field,
                                                   T defaultValue)
        Method for adding user defined default values for specific fields of a given class
        Type Parameters:
        T - Generic type of the default value
        Parameters:
        field - field for which the default value should be defined
        defaultValue - the new default value
      • addUserdefinedDefaultValue

        public <T> void addUserdefinedDefaultValue​(Class<?> clazz,
                                                   String fieldName,
                                                   T defaultValue)
        Method for adding user defined default values for specific fields of a given class
        Type Parameters:
        T - Generic type of the default value
        Parameters:
        clazz - clazz containing the field
        fieldName - name of the field for which the default value should be defined
        defaultValue - the new default value
      • getType

        public Class<Object> getType()
        Specified by:
        getType in interface Constraint<Object>
        Returns:
        method which returns the type for which the constraint is applied
      • isBreakingConstraint

        public boolean isBreakingConstraint()
        Specified by:
        isBreakingConstraint in interface Constraint<Object>
        Returns:
        a flag if constraint is breaking and if violated no further constraints should be checked (e.q. because of a NullPointer)