Class Feature
java.lang.Object
de.hybris.platform.classification.features.Feature
- Direct Known Subclasses:
LocalizedFeature,UnlocalizedFeature
A product feature with its
FeatureValues and along with its ClassAttributeAssignmentModel if any.
This class is the service representation of Feature.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClassAttributeAssignmentModelprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddValue(int index, FeatureValue fvalue) Inserts theFeatureValueat the specified index position in this list (optional operation).abstract voidaddValue(FeatureValue fvalue) Add to this feature aFeatureValueReturns the classification attribute assignment or null if untyped feature.getCode()Gets the code of the feature computed from assignment for typed feature or direct code for untyped feature.getName()Returns name of the feature.abstract FeatureValuegetValue()Convenience method to return a single value.abstract List<FeatureValue>Returns the list of feature values.abstract voidRemove all containingFeatureValues from the current feature.abstract booleanremoveValue(FeatureValue fvalue) Removes the first occurrence of the givenFeatureValuefrom the feature, if it is present (optional operation).abstract voidsetValues(List<FeatureValue> fvalues) Clears always allFeatureValueof this Feature and add the given List with FeatureValues to this Feature.toString()Returns a human readable description.
-
Field Details
-
code
-
name
-
assignment
-
-
Constructor Details
-
Feature
-
Feature
-
-
Method Details
-
getCode
Gets the code of the feature computed from assignment for typed feature or direct code for untyped feature.- Returns:
- the code
- See Also:
-
getValues
Returns the list of feature values. The list is unmodifiable.- Returns:
- the list of feature values
-
getValue
Convenience method to return a single value. If the value list is empty this method will return null. If the list's size is greater that one it will return the first element.- Returns:
- method to return a single value
-
addValue
Add to this feature aFeatureValue- Parameters:
fvalue- the feature value
-
addValue
Inserts theFeatureValueat the specified index position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Parameters:
index- the index valuefvalue- the feature value
-
removeValue
Removes the first occurrence of the givenFeatureValuefrom the feature, if it is present (optional operation). If thisUnlocalizedFeaturedoes not contain thisFeatureValue, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists). Returns true if the feature contained the specified feature value.- Parameters:
fvalue- the FeatureValue to be removed- Returns:
- true if the feature value was removed successfully
-
removeAllValues
public abstract void removeAllValues()Remove all containingFeatureValues from the current feature. -
setValues
Clears always allFeatureValueof this Feature and add the given List with FeatureValues to this Feature. If the parameter is null the internal FeatureValue List will only be cleared (same behaviour asremoveAllValues()- Parameters:
fvalues- the list with feature values or null
-
toString
Returns a human readable description. -
getClassAttributeAssignment
Returns the classification attribute assignment or null if untyped feature.- Returns:
- the classification attribute assignment or null if untyped feature
-
getName
Returns name of the feature. If this feature has noClassAttributeAssignmentModelthe code is returned instead.- Returns:
- the localized name of the feature
-