public class

HelixProperty

extends Object
java.lang.Object
   ↳ org.apache.helix.HelixProperty
Known Direct Subclasses

Class Overview

A wrapper class for ZNRecord. Used as a base class for IdealState, CurrentState, etc.

Summary

Nested Classes
enum HelixProperty.HelixPropertyAttribute  
Fields
protected final ZNRecord _record
Public Constructors
HelixProperty(String id)
Initialize the property with an identifier
HelixProperty(ZNRecord record)
Initialize the property with an existing ZNRecord
HelixProperty(HelixProperty property)
Initialize the property by copying from another property
Public Methods
void addNamespacedConfig(NamespacedConfig namespacedConfig)
Add namespaced configuration properties to this property
static <T extends HelixProperty> Map<String, T> convertListToMap(List<T> records)
Converts a list of records to a map of the record identifier to typed properties
static <T extends HelixProperty> List<ZNRecord> convertToList(List<T> typedInstances)
Convert typed properties to a list of records
static <T extends HelixProperty> T convertToTypedInstance(Class<T> clazz, ZNRecord record)
static method that converts ZNRecord to an instance that subclasses HelixProperty
static <T extends HelixProperty> List<T> convertToTypedList(Class<T> clazz, Collection<ZNRecord> records)
Convert a collection of records to typed properties
boolean equals(Object obj)
boolean getBatchMessageMode()
Get the state of batch messaging
int getBucketSize()
Get the size of buckets defined
final String getId()
Get the property identifier
final ZNRecord getRecord()
Get the backing ZNRecord
boolean isValid()
Get property validity
void setBatchMessageMode(boolean enable)
Change the state of batch messaging
void setBucketSize(int bucketSize)
Set the size of buckets defined
final void setDeltaList(List<ZNRecordDelta> deltaList)
Set the changes to the backing ZNRecord
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final ZNRecord _record

Public Constructors

public HelixProperty (String id)

Initialize the property with an identifier

public HelixProperty (ZNRecord record)

Initialize the property with an existing ZNRecord

public HelixProperty (HelixProperty property)

Initialize the property by copying from another property

Public Methods

public void addNamespacedConfig (NamespacedConfig namespacedConfig)

Add namespaced configuration properties to this property

Parameters
namespacedConfig namespaced properties

public static Map<String, T> convertListToMap (List<T> records)

Converts a list of records to a map of the record identifier to typed properties

Parameters
records the ZNRecords to convert
Returns
  • id --> HelixProperty subclass map

public static List<ZNRecord> convertToList (List<T> typedInstances)

Convert typed properties to a list of records

Parameters
typedInstances objects subclassing HelixProperty
Returns
  • a list of ZNRecord objects

public static T convertToTypedInstance (Class<T> clazz, ZNRecord record)

static method that converts ZNRecord to an instance that subclasses HelixProperty

Parameters
clazz subclass of HelixProperty
record the ZNRecord describing the property
Returns
  • typed instance corresponding to the record, or null if conversion fails

public static List<T> convertToTypedList (Class<T> clazz, Collection<ZNRecord> records)

Convert a collection of records to typed properties

Parameters
clazz Subclass of HelixProperty
records the ZNRecords describing the property
Returns
  • list of typed instances for which the conversion succeeded, or null if records is null

public boolean equals (Object obj)

public boolean getBatchMessageMode ()

Get the state of batch messaging

Returns
  • true if enabled, false if disabled

public int getBucketSize ()

Get the size of buckets defined

Returns
  • the bucket size, or 0 if not defined

public final String getId ()

Get the property identifier

Returns
  • the property id

public final ZNRecord getRecord ()

Get the backing ZNRecord

Returns
  • ZNRecord object associated with this property

public boolean isValid ()

Get property validity

Returns
  • true if valid, false if invalid

public void setBatchMessageMode (boolean enable)

Change the state of batch messaging

Parameters
enable true to enable, false to disable

public void setBucketSize (int bucketSize)

Set the size of buckets defined

Parameters
bucketSize the bucket size (will default to 0 if negative)

public final void setDeltaList (List<ZNRecordDelta> deltaList)

Set the changes to the backing ZNRecord

Parameters
deltaList list of ZNRecord updates to be made

public String toString ()