public class

ConstraintItem

extends Object
java.lang.Object
   ↳ org.apache.helix.model.ConstraintItem

Class Overview

A single constraint and its associated attributes

Summary

Public Constructors
ConstraintItem(Map<StringString> attributes)
Initialize a constraint with attributes
ConstraintItem(Map<ClusterConstraints.ConstraintAttributeString> attributes, String constraintValue)
Initialize a constraint with ClusterConstraints.ConstraintAttributes and a custom constraint value
Public Methods
Map<ClusterConstraints.ConstraintAttributeString> filter(Map<ClusterConstraints.ConstraintAttributeString> attributes)
filter out attributes that are not specified by this constraint
String getAttributeValue(ClusterConstraints.ConstraintAttribute attr)
Get the value of a specific attribute in this cluster
Map<ClusterConstraints.ConstraintAttributeString> getAttributes()
Get all the attributes of the constraint
String getConstraintValue()
Get the actual entities that the constraint operates on
boolean match(Map<ClusterConstraints.ConstraintAttributeString> attributes)
Check if this constraint follows these attributes.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ConstraintItem (Map<StringString> attributes)

Initialize a constraint with attributes

Parameters
attributes the attributes that define the constraint, including the constraint value

public ConstraintItem (Map<ClusterConstraints.ConstraintAttributeString> attributes, String constraintValue)

Initialize a constraint with ClusterConstraints.ConstraintAttributes and a custom constraint value

Parameters
attributes constraint attribute scope-value pairs
constraintValue the specific entity(ies) affected by the constraint

Public Methods

public Map<ClusterConstraints.ConstraintAttributeString> filter (Map<ClusterConstraints.ConstraintAttributeString> attributes)

filter out attributes that are not specified by this constraint

Parameters
attributes attributes to filter
Returns
  • attributes of this constraint that are in the provided attributes

public String getAttributeValue (ClusterConstraints.ConstraintAttribute attr)

Get the value of a specific attribute in this cluster

Parameters
attr the attribute to look up
Returns
  • the attribute value, or null if the attribute is not present

public Map<ClusterConstraints.ConstraintAttributeString> getAttributes ()

Get all the attributes of the constraint

Returns
  • scope-value pairs of attributes

public String getConstraintValue ()

Get the actual entities that the constraint operates on

Returns
  • the constraint value

public boolean match (Map<ClusterConstraints.ConstraintAttributeString> attributes)

Check if this constraint follows these attributes. Note that it is possible that this constraint could consist of attributes in addition to those that are specified.

Parameters
attributes attributes to check
Returns
  • true if the constraint follows every attribute, false otherwise

public String toString ()