Module datarush.analytics
Class ReplaceSpecification
- java.lang.Object
-
- com.pervasive.datarush.analytics.cleansing.ReplaceSpecification
-
- All Implemented Interfaces:
Serializable
public final class ReplaceSpecification extends Object implements Serializable
Specify per field or per group of fields how missing (null) values should be handled. An action must be specified that defines how missing values are handled. A field name can be specified or a group of fields by type. A replacement value can be given if the action is to replace missing values with a constant value.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReplaceSpecification.ActionThe action to take when a missing value is discovered within a field.
-
Constructor Summary
Constructors Constructor Description ReplaceSpecification()Default public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReplaceSpecificationconstant(ScalarTokenType type, String value)Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANTaction for fields with the specified type.static ReplaceSpecificationconstant(String fieldName, String value)Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANTaction for the specified field.static ReplaceSpecificationfreq(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQaction for fields with the specified type.static ReplaceSpecificationfreq(String fieldName)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQaction for the specified field.ReplaceSpecification.ActiongetAction()Get the replacement action value.StringgetFieldName()Get the field name.ScalarTokenTypegetFieldType()Get the field type.StringgetReplacementValue()Get the constant replacement value.static ReplaceSpecificationmax(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAXaction for fields with the specified type.static ReplaceSpecificationmax(String fieldName)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAXaction for the specified field.static ReplaceSpecificationmean(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEANaction for fields with the specified type.static ReplaceSpecificationmean(String fieldName)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEANaction for the specified field.static ReplaceSpecificationmedian(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIANaction for fields with the specified type.static ReplaceSpecificationmedian(String fieldName)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIANaction for the specified field.static ReplaceSpecificationmin(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MINaction for fields with the specified type.static ReplaceSpecificationmin(String fieldName)Create a replacement specification with theReplaceSpecification.Action.REPLACE_MINaction for the specified field.static ReplaceSpecificationnone(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.NONEaction for fields with the specified type.static ReplaceSpecificationnone(String fieldName)Create a replacement specification with theReplaceSpecification.Action.NONEaction for the specified field.voidsetAction(ReplaceSpecification.Action action)Set the replacementReplaceSpecification.Action.voidsetFieldName(String fieldName)Set the field name to apply the replacement action.voidsetFieldType(ScalarTokenType fieldType)Set the field (token) type.voidsetReplacementValue(String replacementValue)Set the replacement value.static ReplaceSpecificationskip(ScalarTokenType type)Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORDaction for fields with the specified type.static ReplaceSpecificationskip(String fieldName)Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORDaction for the specified field.
-
-
-
Method Detail
-
none
public static ReplaceSpecification none(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.NONEaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
NONEaction
-
none
public static ReplaceSpecification none(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.NONEaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
NONEaction
-
skip
public static ReplaceSpecification skip(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORDaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
SKIP_RECORDaction
-
skip
public static ReplaceSpecification skip(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.SKIP_RECORDaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
SKIP_RECORDaction
-
constant
public static ReplaceSpecification constant(String fieldName, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANTaction for the specified field.- Parameters:
fieldName- apply the action to this fieldvalue- replacement value- Returns:
- specification with the
REPLACE_CONSTANTaction
-
constant
public static ReplaceSpecification constant(ScalarTokenType type, String value)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_CONSTANTaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this typevalue- replacement value- Returns:
- specification with the
REPLACE_CONSTANTaction
-
min
public static ReplaceSpecification min(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MINaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
REPLACE_MINaction
-
min
public static ReplaceSpecification min(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MINaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MINaction
-
max
public static ReplaceSpecification max(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAXaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
REPLACE_MAXaction
-
max
public static ReplaceSpecification max(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MAXaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MAXaction
-
median
public static ReplaceSpecification median(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIANaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
REPLACE_MEDIANaction
-
median
public static ReplaceSpecification median(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEDIANaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MEDIANaction
-
mean
public static ReplaceSpecification mean(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEANaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
REPLACE_MEANaction
-
mean
public static ReplaceSpecification mean(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MEANaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MEANaction
-
freq
public static ReplaceSpecification freq(String fieldName)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQaction for the specified field.- Parameters:
fieldName- apply the action to this field- Returns:
- specification with the
REPLACE_MOST_FREQaction
-
freq
public static ReplaceSpecification freq(ScalarTokenType type)
Create a replacement specification with theReplaceSpecification.Action.REPLACE_MOST_FREQaction for fields with the specified type.- Parameters:
type- apply the action to all fields of this type- Returns:
- specification with the
REPLACE_MOST_FREQaction
-
getAction
public ReplaceSpecification.Action getAction()
Get the replacement action value.- Returns:
- the action
-
setAction
public void setAction(ReplaceSpecification.Action action)
Set the replacementReplaceSpecification.Action.- Parameters:
action- the action to set
-
getFieldName
public String getFieldName()
Get the field name.- Returns:
- the fieldName
-
setFieldName
public void setFieldName(String fieldName)
Set the field name to apply the replacement action.- Parameters:
fieldName- the fieldName to set
-
getFieldType
public ScalarTokenType getFieldType()
Get the field type.- Returns:
- the fieldType
-
setFieldType
public void setFieldType(ScalarTokenType fieldType)
Set the field (token) type. All fields of this type in the input will have this missing value replacement applied to them.- Parameters:
fieldType- the fieldType to set
-
getReplacementValue
public String getReplacementValue()
Get the constant replacement value.- Returns:
- the replacementValue
-
setReplacementValue
public void setReplacementValue(String replacementValue)
Set the replacement value. Only applicable if the action is set toReplaceSpecification.Action.REPLACE_CONSTANT, ignored otherwise.- Parameters:
replacementValue- the replacementValue to set
-
-