Class DefaultFieldModel

java.lang.Object
ch.tocco.nice2.model.entity.api.DefaultModelBase
ch.tocco.nice2.model.entity.api.DefaultFieldModel
All Implemented Interfaces:
FieldModel, ModelElement, ModuleTracker
Direct Known Subclasses:
FieldModelImpl

public abstract class DefaultFieldModel extends DefaultModelBase implements FieldModel
  • Constructor Details

    • DefaultFieldModel

      public DefaultFieldModel(boolean key)
    • DefaultFieldModel

      public DefaultFieldModel()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: FieldModel
      Returns the entity field name; the name attribute of the field tag in xml.
      Specified by:
      getName in interface FieldModel
      Overrides:
      getName in class DefaultModelBase
    • setName

      public void setName(String name)
      Specified by:
      setName in interface FieldModel
      Overrides:
      setName in class DefaultModelBase
      Parameters:
      name - the name, non-null
      See Also:
    • getTarget

      public String getTarget()
      Description copied from interface: FieldModel
      Returns the internal field name, eg db table field name; the target attribute of the field tag in xml.
      Specified by:
      getTarget in interface FieldModel
    • setTarget

      public void setTarget(String target)
      Specified by:
      setTarget in interface FieldModel
      Parameters:
      target - the target
      See Also:
    • isNullable

      public boolean isNullable()
      Description copied from interface: FieldModel
      Tells if the field accepts the null value to be stored in it. Key fields are never nullable.
      Specified by:
      isNullable in interface FieldModel
    • setNullable

      public void setNullable(boolean nullable)
      Specified by:
      setNullable in interface FieldModel
      Parameters:
      nullable - true/false
      See Also:
    • isUnique

      public boolean isUnique()
      Description copied from interface: FieldModel
      Tells if the field's values are unique (i.e. a value may only exists once)
      Specified by:
      isUnique in interface FieldModel
      Returns:
      true if the field's values are unique
    • setUnique

      public void setUnique(boolean unique)
      Specified by:
      setUnique in interface FieldModel
      Parameters:
      unique - true/false
    • isVirtual

      public boolean isVirtual()
      Specified by:
      isVirtual in interface FieldModel
    • setVirtual

      public void setVirtual(boolean virtual)
      Specified by:
      setVirtual in interface FieldModel
    • isSynthetic

      public boolean isSynthetic()
      Specified by:
      isSynthetic in interface FieldModel
    • setSynthetic

      public void setSynthetic(boolean synthetic)
      Specified by:
      setSynthetic in interface FieldModel
    • isKey

      public boolean isKey()
      Description copied from interface: FieldModel
      Tells if this field is the or part of the primary key.

      It has nothing to do with indexed fields, nor with foreign keys.

      Specified by:
      isKey in interface FieldModel
    • setKey

      public void setKey(boolean key)
    • getType

      public Type<?> getType()
      Specified by:
      getType in interface FieldModel
      Returns:
      Returns the nice Type object which for example represents a string.
    • getDefaultValue

      public Object getDefaultValue()
      Description copied from interface: FieldModel
      Returns the DefaultValueDescriptor. This is the dynamic default value that can be defined on the entity as well as on the form.

      The reason that this signature returns 'Object' is because the interface cannot be seen.

      Specified by:
      getDefaultValue in interface FieldModel
      Returns:
      instance of DefaultValueDescriptor
    • setDefaultValue

      public void setDefaultValue(Object defaultValue)
      Specified by:
      setDefaultValue in interface FieldModel
    • setType

      public void setType(Type type)
      Specified by:
      setType in interface FieldModel
      Parameters:
      type - the type
      See Also:
    • getAdditionalToStringInfo

      protected String getAdditionalToStringInfo()
      Overrides:
      getAdditionalToStringInfo in class DefaultModelBase
    • hasNonEmptyValidator

      public boolean hasNonEmptyValidator()
      Specified by:
      hasNonEmptyValidator in interface FieldModel
      Returns:
      Tells if this field model has a validator, a GroupValidator to be precise, which has at least one entry.
      See Also:
    • getValidator

      public GroupValidator getValidator()
      Specified by:
      getValidator in interface FieldModel
      Returns:
      Returns the outermost group validator which may be empty.
      See Also:
    • setValidator

      public void setValidator(AndGroupValidator validator)
      Description copied from interface: FieldModel
      Sets the primary validator which may contain real validation validators and other groups.

      Method for the startup process.

      Specified by:
      setValidator in interface FieldModel
      Parameters:
      validator - The group validator.