Package org.eclipse.birt.report.model.api.validators

# Class SimpleListValidator

java.lang.Object
org.eclipse.birt.report.model.validators.AbstractSemanticValidator
org.eclipse.birt.report.model.validators.AbstractPropertyValidator
org.eclipse.birt.report.model.api.validators.SimpleListValidator

public class SimpleListValidator extends org.eclipse.birt.report.model.validators.AbstractPropertyValidator
Validates one list property of element. The property type should be simple value list, not structure list.

### Rule

The rule is that

- all items in this list property should be valid.
- the value in this list should be unique.

### Applicability

This validator is only applied to the property whose type is list of one `DesignElement`.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`NAME`
Name of this validator.

### Fields inherited from class org.eclipse.birt.report.model.validators.AbstractSemanticValidator

`modules, name`

## Constructor Summary

Constructors
Constructor
Description
`SimpleListValidator()`

## Method Summary

Modifier and Type
Method
Description
`static SimpleListValidator`
`getInstance()`
Returns the singleton validator instance.
`List<SemanticException>`
`validate(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element, String propName)`
Validates whether the list property specified by `propName` is invalid.
`List<SemanticException>`
`validateForAdding(DesignElementHandle element, IPropertyDefn propDefn, List<Object> list, Object toAdd)`
Validates whether a new item can be added to the simple value list.

### Methods inherited from class org.eclipse.birt.report.model.validators.AbstractSemanticValidator

`canApplyToDesign, canApplyToLibrary, getName, isInTemplateParameterDefinitionSlot, setModules, setName`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### NAME

public static final String NAME
Name of this validator.

See Also:
  - Constant Field Values

## Constructor Details

### SimpleListValidator

public SimpleListValidator()

## Method Details

### getInstance

public static SimpleListValidator getInstance()
Returns the singleton validator instance.

Returns:
  the validator instance

### validateForAdding

public List<SemanticException> validateForAdding(DesignElementHandle element, IPropertyDefn propDefn, List<Object> list, Object toAdd)
Validates whether a new item can be added to the simple value list.

Parameters:
  `element` - the element holding the value list
  `propDefn` - definition of the list property
  `list` - the value list
  `toAdd` - the item to add
Returns:
  error list, each of which is the instance of `SemanticException`.

### validate

public List<SemanticException> validate(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element, String propName)
Validates whether the list property specified by `propName` is invalid.

Specified by:
  `validate` in class `org.eclipse.birt.report.model.validators.AbstractPropertyValidator`
Parameters:
  `module` - the module
  `element` - the element to validate
  `propName` - the name of the list property to validate
Returns:
  error list, each of which is the instance of `SemanticException`.