de.hybris.platform.classification.features.Feature instead.@Deprecated public abstract class Feature<T> extends Object implements Cloneable, Serializable
values belonging to one
product feature. This may be prepresented by a
ClassAttributeAssignment or simply a unique qualifier.
To add new values use the creation methods like this:
Feature<String> f = ...;
FeatureValue<String> newOne = f.createValue( "Blah" );
newOne.setDescription("This is just a test");
// another way
List<FeatureValue> newOnes = f.createValues( "foo", "bar" );
// to fetch all value objects
List<FeatureValue> fValues = f.getValues();
// to fetch just plain values directly (without value object)
List<String> stringValues = f.getValuesDirect();
Please note that any changes made to one instance are not automatically persistet (contrary to normal Item behaviour)
- see FeatureContainer for how to store and load feature
values.
There are some shortcut methods for single-feature management as well:
Product p = // my product
ClassAttributeAssignment asgnmt = // my assigned attribute
// assuming that we've got a number attribute:
TypedFeature<Number> feat = Feature.loadTyped( p, asgnmt );
// delete existing values
feat.clearAll();
// add some new values
feat.createValues( 123.45, 0.815, 555 );
// now store it by using automatically created container
feat.getParent().store();
FeatureContainer,
FeatureValue,
Serialized Form| Modifier | Constructor and Description |
|---|---|
protected |
Feature(Feature<T> src)
Deprecated.
Clone constructor.
|
protected |
Feature(FeatureContainer parent,
boolean localized)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(SessionContext ctx,
int index,
FeatureValue<T> featureValue)
Deprecated.
|
protected void |
assureOwnValue(FeatureValue<T> value)
Deprecated.
|
void |
clear()
Deprecated.
Clears all values (for the current session languge if localized).
|
void |
clear(SessionContext ctx)
Deprecated.
Clears all values (for the specified session languge if localized).
|
void |
clearAll()
Deprecated.
Clears all values of this feature regardless of the session language.
|
abstract Feature |
clone()
Deprecated.
|
FeatureValue<T> |
createValue(int index,
T value)
Deprecated.
Creates a new value for this feature.
|
abstract FeatureValue<T> |
createValue(SessionContext ctx,
int index,
T value)
Deprecated.
Creates a new value for this feature.
|
FeatureValue<T> |
createValue(SessionContext ctx,
T value)
Deprecated.
Creates a new value for this feature.
|
FeatureValue<T> |
createValue(T value)
Deprecated.
Creates a new value for this feature.
|
List<FeatureValue<T>> |
createValues(Collection<T> values)
Deprecated.
Creates a list of new values for this feature.
|
List<FeatureValue<T>> |
createValues(SessionContext ctx,
Collection<T> values)
Deprecated.
Creates a list of new values for this feature.
|
List<FeatureValue<T>> |
createValues(SessionContext ctx,
T... values)
Deprecated.
Creates a list of new values for this feature.
|
List<FeatureValue<T>> |
createValues(T... values)
Deprecated.
Creates a list of new values for this feature.
|
boolean |
equals(Object obj)
Deprecated.
|
protected Language |
extractLanguage(SessionContext ctx)
Deprecated.
|
String |
getAllDescriptions()
Deprecated.
Convenience method to gather all (different) value desciptions into one string.
|
String |
getAllDescriptions(SessionContext ctx)
Deprecated.
Convenience method to gather all (different) value desciptions into one string.
|
DateFormat |
getDateFormat(SessionContext ctx)
Deprecated.
Provides a date format for displaying date values according to the current locale.
|
protected List<FeatureValue<T>> |
getLanguageValues(SessionContext ctx,
Language language,
boolean create)
Deprecated.
|
String |
getName()
Deprecated.
Returns the name of this feature localized for the current session language.
|
abstract String |
getName(SessionContext ctx)
Deprecated.
Returns the name of this feature localized for the specified session language.
|
NumberFormat |
getNumberFormat(SessionContext ctx)
Deprecated.
Provides a number format for displaying number values according to the current locale.
|
FeatureContainer |
getParent()
Deprecated.
Returns the containing feature container.
|
protected abstract String |
getUniqueKey()
Deprecated.
|
FeatureValue<T> |
getValue(int index)
Deprecated.
Returns the value at a given position for the current session language.
|
FeatureValue<T> |
getValue(SessionContext ctx,
int index)
Deprecated.
Returns the value at a given position for the specified session language.
|
List<FeatureValue<T>> |
getValues()
Deprecated.
Returns all values for the specified language.
|
List<FeatureValue<T>> |
getValues(SessionContext ctx)
Deprecated.
Returns all values for the specified language.
|
List<T> |
getValuesDirect()
Deprecated.
Returns directly the content value of each
FeatureValue within this feature according to the current
session language (if localized). |
List<T> |
getValuesDirect(SessionContext ctx)
Deprecated.
Returns directly the content value of each
FeatureValue within this feature according to specified context
language (if localized). |
String |
getValuesFormatted()
Deprecated.
Creates a string representation of the feature values of this feature.
|
String |
getValuesFormatted(SessionContext ctx)
Deprecated.
Creates a string representation of the feature values of this feature.
|
int |
hashCode()
Deprecated.
|
boolean |
isEmpty()
Deprecated.
Tells whether or not the feature holds values.
|
boolean |
isEmpty(SessionContext ctx)
Deprecated.
Tells whether or not the feature holds values.
|
boolean |
isEmptyIgnoringLanguage()
Deprecated.
Tells whether or not the feature holds any value at all, regardless of any localization settings.
|
protected boolean |
isFallbackEnabled(SessionContext ctx)
Deprecated.
|
boolean |
isLocalized()
Deprecated.
Tells whether or not the feature is able to hold different values per session language.
|
static <X> TypedFeature<X> |
loadTyped(Product product,
ClassAttributeAssignment assignment)
Deprecated.
Shortcut to manage just a single typed feature.
|
static <X> TypedFeature<X> |
loadTyped(Product product,
ClassificationAttribute attr)
Deprecated.
Shortcut to manage just a single typed feature.
|
protected FeatureValue<T> |
loadValue(SessionContext ctx,
ProductFeature datbaseItem)
Deprecated.
|
void |
moveValue(int index,
FeatureValue<T> featureValue)
Deprecated.
Moves a value to a given position within the current session language.
|
void |
moveValue(SessionContext ctx,
int index,
FeatureValue<T> featureValue)
Deprecated.
Moves a value to a given position within the specified session language.
|
FeatureValue<T> |
remove(int index)
Deprecated.
Removes the value at a given position from the values of the current session language.
|
boolean |
remove(SessionContext ctx,
FeatureValue<T> featureValue)
Deprecated.
Removes a given value from the values of the given session language.
|
FeatureValue<T> |
remove(SessionContext ctx,
int index)
Deprecated.
Removes the value at a given position from the values of the given session language.
|
boolean |
removeValue(FeatureValue<T> featureValue)
Deprecated.
Removes a given value from the values of the current session language.
|
void |
setLocalized(boolean isLocalized)
Deprecated.
Changes localization statuc of this feature.
|
FeatureValue<T> |
setValue(SessionContext ctx,
T value)
Deprecated.
Replaces all current feature values by a single newly create one for the given value object.
|
FeatureValue<T> |
setValue(T value)
Deprecated.
Replaces all current feature values by a single newly create one for the given value object.
|
List<FeatureValue<T>> |
setValues(List<T> values)
Deprecated.
Replaces all current feature values by newly create ones for the given list of value objects.
|
List<FeatureValue<T>> |
setValues(SessionContext ctx,
List<T> values)
Deprecated.
Replaces all current feature values by newly create ones for the given list of value objects.
|
List<FeatureValue<T>> |
setValues(SessionContext ctx,
T... values)
Deprecated.
Replaces all current feature values by newly create ones for the given list of value objects.
|
List<FeatureValue<T>> |
setValues(T... values)
Deprecated.
Replaces all current feature values by newly create ones for the given list of value objects.
|
int |
size()
Deprecated.
Returns the amount of values stored inside this feature (for the current session language if localized).
|
int |
size(SessionContext ctx)
Deprecated.
Returns the amount of values stored inside this feature (for the specified session language if localized).
|
String |
toString()
Deprecated.
|
protected Collection<PK> |
writeToDatabase(int featurePosition)
Deprecated.
Stores all values of this feature into the database.
|
protected Feature(FeatureContainer parent, boolean localized)
protected Feature(Feature<T> src) throws CloneNotSupportedException
CloneNotSupportedExceptionpublic static <X> TypedFeature<X> loadTyped(Product product, ClassAttributeAssignment assignment)
FeatureContainer which is
limited to this class-attribute assignment only.product - the product to manage the feature (-values) forassignment - the class-attribute assignment to managepublic static <X> TypedFeature<X> loadTyped(Product product, ClassificationAttribute attr) throws JaloInvalidParameterException
FeatureContainer which is
limited to this attribute only.product - the product to manage the feature (-values) forattr - the attribute to manageJaloInvalidParameterException - if the attribute is actually not assigned to any of the product's classes or if the attribute is
ambiguous since there are multiple assignmentspublic FeatureContainer getParent()
public void setLocalized(boolean isLocalized)
Please note that this will modify the contained values: if the feature is made unlocalized all language dependent values are merged together into one value list. So eetting the feature localized again wont restore the original language-value mappings!
isLocalized - switches localization on or offpublic boolean isLocalized()
This means all value getter and setter methods ( e.g. getValues(SessionContext)) work upon different
value lists according to the session language specified within the session context or current session language
where no context is specified.
public boolean isEmpty()
Please note that this method respects the localization status. So for localized features it will only tell if there are no values within the value list belonging to the current session language!
isEmptyIgnoringLanguage()public boolean isEmpty(SessionContext ctx)
Please note that this method respects the localization status. So for localized features it will only tell if there are no values within the value list belonging to the specified session language!
ctx - the session context defining the value list session languageisEmptyIgnoringLanguage()public boolean isEmptyIgnoringLanguage()
true.public abstract Feature clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic FeatureValue<T> createValue(T value)
value - the new valuepublic FeatureValue<T> createValue(SessionContext ctx, T value)
value - the new valuectx - the context specifying the session languagepublic List<FeatureValue<T>> createValues(Collection<T> values)
values - the new valuespublic List<FeatureValue<T>> createValues(SessionContext ctx, Collection<T> values)
values - the new valuesctx - the context specifying the session languagepublic List<FeatureValue<T>> createValues(T... values)
values - the new valuespublic List<FeatureValue<T>> createValues(SessionContext ctx, T... values)
values - the new valuesctx - the context specifying the session languagepublic FeatureValue<T> createValue(int index, T value)
value - the new valueindex - the position to insert the new value atpublic abstract FeatureValue<T> createValue(SessionContext ctx, int index, T value)
value - the new valuectx - the context specifying the session languageindex - the position to insert the new value atpublic List<FeatureValue<T>> setValues(T... values)
values - the raw value objects to wrap inside FeatureValue instancesFeatureValue instancespublic List<FeatureValue<T>> setValues(SessionContext ctx, T... values)
ctx - the session context to specify the session language ( for localized features only)values - the raw value objects to wrap inside FeatureValue instancesFeatureValue instancespublic List<FeatureValue<T>> setValues(List<T> values)
values - the raw value objects to wrap inside FeatureValue instancesFeatureValue instancespublic List<FeatureValue<T>> setValues(SessionContext ctx, List<T> values)
ctx - specifies the session language (for localized features only)values - the raw value objects to wrap inside FeatureValue instancesFeatureValue instancespublic FeatureValue<T> setValue(T value)
value - the raw value object to wrap inside a new FeatureValueFeatureValue instancepublic FeatureValue<T> setValue(SessionContext ctx, T value)
ctx - specifies the session language (for localized features only)value - the raw value object to wrap inside a new FeatureValueFeatureValue instancepublic void clearAll()
public void clear()
public void clear(SessionContext ctx)
ctx - the session context defining the session languagepublic FeatureValue<T> getValue(int index) throws IndexOutOfBoundsException
index - IndexOutOfBoundsException - if the index exceeds the current value list dimensionspublic FeatureValue<T> getValue(SessionContext ctx, int index) throws IndexOutOfBoundsException
index - ctx - the session context defining the language to get values forIndexOutOfBoundsException - if the index exceeds the current value list dimensionsprotected boolean isFallbackEnabled(SessionContext ctx)
public void moveValue(int index,
FeatureValue<T> featureValue)
throws IndexOutOfBoundsException
index - featureValue - the new value to setIndexOutOfBoundsException - if the index exceeds the current value list dimensionspublic void moveValue(SessionContext ctx, int index, FeatureValue<T> featureValue) throws IndexOutOfBoundsException, JaloInvalidParameterException
index - ctx - the session context defining the language to set values forfeatureValue - the new value to setIndexOutOfBoundsException - if the index exceeds the current value list dimensionsJaloInvalidParameterException - if the feature value doesnt belong to this featurepublic boolean removeValue(FeatureValue<T> featureValue)
featureValue - the value to removepublic boolean remove(SessionContext ctx, FeatureValue<T> featureValue) throws IndexOutOfBoundsException
ctx - the session context defining the language to remove values forfeatureValue - the value to removeIndexOutOfBoundsExceptionpublic FeatureValue<T> remove(int index) throws IndexOutOfBoundsException
index - the value positionIndexOutOfBoundsException - if the index exceeds the current value list dimensionspublic FeatureValue<T> remove(SessionContext ctx, int index) throws IndexOutOfBoundsException
ctx - the session context defining the language to remove values forindex - the value positionIndexOutOfBoundsException - if the index exceeds the current value list dimensionspublic int size()
public int size(SessionContext ctx)
ctx - the session context specifiying the session language to count values forpublic List<FeatureValue<T>> getValues()
public List<FeatureValue<T>> getValues(SessionContext ctx)
ctx - the session context defining the language to change values forpublic List<T> getValuesDirect()
FeatureValue within this feature according to the current
session language (if localized).public List<T> getValuesDirect(SessionContext ctx)
FeatureValue within this feature according to specified context
language (if localized).ctx - the session context defining the language to get values forpublic String getAllDescriptions()
public String getAllDescriptions(SessionContext ctx)
ctx - the session context defining which langauge should be used for localized valuespublic String getName()
public abstract String getName(SessionContext ctx)
public NumberFormat getNumberFormat(SessionContext ctx)
public DateFormat getDateFormat(SessionContext ctx)
public String getValuesFormatted()
,.public String getValuesFormatted(SessionContext ctx)
,.ctx - the session context which defines the language to choose the value forprotected FeatureValue<T> loadValue(SessionContext ctx, ProductFeature datbaseItem)
protected List<FeatureValue<T>> getLanguageValues(SessionContext ctx, Language language, boolean create)
protected Language extractLanguage(SessionContext ctx)
protected Collection<PK> writeToDatabase(int featurePosition)
featurePosition - the feature position - specified by the enclosing containerProductFeature items holding these valuesprotected abstract String getUniqueKey()
protected void assureOwnValue(FeatureValue<T> value) throws JaloInvalidParameterException
JaloInvalidParameterExceptionprotected void add(SessionContext ctx, int index, FeatureValue<T> featureValue) throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionCopyright © 2017 SAP SE. All Rights Reserved.