How to get the field settings values in filed constraint validator I have created custom type field with custom field settings, attached custom constraint successfully called its validator.

The question how to get the field settings values in the validate function, below code sample may explain 

/**
 * Validates the CustomCheckConstraint.
*/
class CustomCheckConstraintValidator extends ConstraintValidator {
 protected $context;
 public function validate($data, Constraint $constraint) {
   //$data parameter holds the field value 
   //how could I get the field settings here and validate the value based on
}
}

//attached constraint here 
public static function    propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('integer')
  -&gt;setLabel(t('type'))
  -&gt;addConstraint('CustomCheck')
  -&gt;setRequired(TRUE);
return $properties;


}


  Edit: After berdir answer


now the $data variable is an object holds the whole filedType object value and settings.

The problem is I couldn't get the field settings from getSettings() function returns 


  Error: Call to protected method


The same error occurs when I tried to send field settings value from propertyDefinitions function
If they are field storage settings, then you could pass them along as arguments to the constraint.

If not, then add the constraint on the field type, not on the property. You can do that directly in the annotation, see \Drupal\file\Plugin\Field\FieldType\FileItem as an exampe. Then you get the whole field item in your validator and you can access the values and the definition/settings.