Class Feature
- java.lang.Object
-
- de.hybris.platform.classification.features.Feature
-
- Direct Known Subclasses:
LocalizedFeature,UnlocalizedFeature
public abstract class Feature extends java.lang.ObjectA product feature with itsFeatureValues and along with itsClassAttributeAssignmentModelif any. This class is the service representation ofFeature.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassAttributeAssignmentModelassignmentprotected java.lang.Stringcodeprotected java.lang.Stringname
-
Constructor Summary
Constructors Constructor Description Feature(ClassAttributeAssignmentModel assignment)Feature(java.lang.String code)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddValue(int index, FeatureValue fvalue)Inserts theFeatureValueat the specified index position in this list (optional operation).abstract voidaddValue(FeatureValue fvalue)Add to this feature aFeatureValueClassAttributeAssignmentModelgetClassAttributeAssignment()Returns the classification attribute assignment or null if untyped feature.java.lang.StringgetCode()Gets the code of the feature computed from assignment for typed feature or direct code for untyped feature.java.lang.StringgetName()Returns name of the feature.abstract FeatureValuegetValue()Convenience method to return a single value.abstract java.util.List<FeatureValue>getValues()Returns the list of feature values.abstract voidremoveAllValues()Remove 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(java.util.List<FeatureValue> fvalues)Clears always allFeatureValueof this Feature and add the given List with FeatureValues to this Feature.java.lang.StringtoString()Returns a human readable description.
-
-
-
Field Detail
-
code
protected java.lang.String code
-
name
protected java.lang.String name
-
assignment
protected final ClassAttributeAssignmentModel assignment
-
-
Constructor Detail
-
Feature
public Feature(java.lang.String code)
-
Feature
public Feature(ClassAttributeAssignmentModel assignment)
-
-
Method Detail
-
getCode
public java.lang.String getCode()
Gets the code of the feature computed from assignment for typed feature or direct code for untyped feature.- Returns:
- the code
- See Also:
ClassificationUtils.createFeatureQualifier(ClassAttributeAssignmentModel)
-
getValues
public abstract java.util.List<FeatureValue> getValues()
Returns the list of feature values. The list is unmodifiable.- Returns:
- the list of feature values
-
getValue
public abstract FeatureValue 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
public abstract void addValue(FeatureValue fvalue)
Add to this feature aFeatureValue- Parameters:
fvalue- the feature value
-
addValue
public abstract void addValue(int index, FeatureValue fvalue)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
public abstract boolean removeValue(FeatureValue fvalue)
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
public abstract void setValues(java.util.List<FeatureValue> fvalues)
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
public java.lang.String toString()
Returns a human readable description.- Overrides:
toStringin classjava.lang.Object
-
getClassAttributeAssignment
public ClassAttributeAssignmentModel getClassAttributeAssignment()
Returns the classification attribute assignment or null if untyped feature.- Returns:
- the classification attribute assignment or null if untyped feature
-
getName
public java.lang.String getName()
Returns name of the feature. If this feature has noClassAttributeAssignmentModelthe code is returned instead.- Returns:
- the localized name of the feature
-
-