public class StringToSizeTransformer extends Object implements org.apache.commons.collections.Transformer
Size
object.
Size
object requires Product
to be set however, when we do Product#setSize(Size)
; the code automatically updates
the size objects related Product related fields also internally so we don't have to worry about the Product
while creating the Size
object.Modifier and Type | Field and Description |
---|---|
static String |
DIMENSION_PATTERN |
static String |
FIT_PATTERN |
static String |
NUMBER |
Constructor and Description |
---|
StringToSizeTransformer() |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultUnit()
If no dimensions are available and this is not null then this will be set as the default unit
|
List<String> |
getLbhOrder()
List of Name of property in
SizeDimensions . |
Class<? extends Size> |
getType()
The Type to return, incase we want to define a Custom extension of one of the types.
The custom type must support a default constructor if its SizeDimensions type or a Constructor that accepts a String if its unlreated to any
existing Size type. |
boolean |
isAcceptRawNonMatchingStrings()
If true will accept any input as
SizeString else throw an exception if it cannot categorize it as SizeFit or SizeDimensions |
boolean |
isSpecifyDims()
If true, will need the dimensions to be specified within the input
|
void |
setAcceptRawNonMatchingStrings(boolean acceptRawNonMatchingStrings)
If true will accept any input as
SizeString else throw an exception if it cannot categorize it as SizeFit or SizeDimensions |
void |
setDefaultUnit(String defaultUnit)
If no dimensions are available and this is not null then this will be set as the default unit
|
void |
setLbhOrder(List<String> lbhOrder)
List of Name of property in
SizeDimensions . |
void |
setSpecifyDims(boolean specifyDims)
If true, will need the dimensions to be specified within the input
|
void |
setType(Class<? extends Size> type)
The Type to return, incase we want to define a Custom extension of one of the types.
The custom type must support a default constructor if its SizeDimensions type or a Constructor that accepts a String if its unlreated to any
existing Size type. |
Object |
transform(Object input) |
public static final String NUMBER
public static final String DIMENSION_PATTERN
public static final String FIT_PATTERN
public Object transform(Object input)
transform
in interface org.apache.commons.collections.Transformer
public boolean isSpecifyDims()
public void setSpecifyDims(boolean specifyDims)
public String getDefaultUnit()
public void setDefaultUnit(String defaultUnit)
public List<String> getLbhOrder()
SizeDimensions
. Example {"length", "width", "height"}
(L)ength x (W)idth x (H)eight order
Positions are from 0 to 2. (Size will be 3)
public void setLbhOrder(List<String> lbhOrder)
SizeDimensions
. Example {"length", "width", "height"}
(L)ength x (W)idth x (H)eight order
Positions are from 0 to 2. (Size will be 3)
public boolean isAcceptRawNonMatchingStrings()
SizeString
else throw an exception if it cannot categorize it as SizeFit
or SizeDimensions
public void setAcceptRawNonMatchingStrings(boolean acceptRawNonMatchingStrings)
SizeString
else throw an exception if it cannot categorize it as SizeFit
or SizeDimensions
public Class<? extends Size> getType()
SizeDimensions
type or a Constructor that accepts a String if its unlreated to any
existing Size
type.public void setType(Class<? extends Size> type)
SizeDimensions
type or a Constructor that accepts a String if its unlreated to any
existing Size
type.Copyright © 2018. All rights reserved.