public class TypedFeature<T> extends Feature<T>
ClassAttributeAssignment. This way the feature type, its
localization status and its number format is configured automatically.| Modifier and Type | Class and Description |
|---|---|
static class |
TypedFeature.FeatureType
The enum for easier feature type handling.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONVERT_TO_FEATUREUNIT
Session context option to switch off automatic number conversion when calling
getValuesDirect(SessionContext). |
| Modifier | Constructor and Description |
|---|---|
protected |
TypedFeature(FeatureContainer parent,
ClassAttributeAssignment assignment)
Creates a new typed feature object.
|
protected |
TypedFeature(TypedFeature<T> src)
Clone constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assureSelectableValue(ClassificationAttributeValue value) |
TypedFeature<T> |
clone() |
FeatureValue<T> |
createValue(SessionContext ctx,
int index,
Object value)
Overridden to create a new value for this feature according to the configured value type.
|
FeatureValue<T> |
createValue(SessionContext ctx,
int index,
Object value,
boolean typeSafe)
Overridden to create a new value for this feature according to the configured value type.
|
ClassAttributeAssignment |
getClassAttributeAssignment()
Returns the assignment which backs this feature.
|
ClassificationAttribute |
getClassificationAttribute()
Returns the classification attribute of the assignment which backs this feature.
|
ClassificationClass |
getClassificationClass()
Returns the classification class of the assignment which backs this feature.
|
String |
getCode()
Returns the classification attribute code of the associated
ClassificationAttribute. |
DateFormat |
getDateFormat(SessionContext ctx)
Overridden to provide the date format defined by
ClassAttributeAssignment.getDateFormat(SessionContext). |
TypedFeature.FeatureType |
getFeatureType()
Returns the feature type enum instead of the actual
EnumerationValue returned by
GeneratedClassAttributeAssignment.getAttributeType(SessionContext). |
String |
getName(SessionContext ctx)
Overrides
Feature.getName(SessionContext) to return the localized attribute name. |
NumberFormat |
getNumberFormat(SessionContext ctx)
Overridden to provide the number format defined by
ClassAttributeAssignment.getNumberFormat(SessionContext). |
ClassificationAttributeValue |
getSelectableValue(String code)
Convenience method to pick one selectable value for this feature using its code.
|
Collection<ClassificationAttributeValue> |
getSelectableValues()
Returns all assignable values for this feature.
|
protected String |
getUniqueKey() |
ClassificationAttributeUnit |
getUnit()
Returns the configured classification attribute unit of the assignment which backs this feature.
|
List<T> |
getValuesDirect(SessionContext ctx)
Overrides
Feature.getValuesDirect(SessionContext) by converting all number values into the feature's
ClassificationAttributeUnit. |
String |
getValuesFormatted(SessionContext ctx)
Overridden to format range features specially.
|
FeatureValue<T> |
setSelectableValue(SessionContext ctx,
String code)
Convenience method for setting enumeration values without fetching them via
getSelectableValue(String). |
FeatureValue<T> |
setSelectableValue(String code)
Convenience method for setting enumeration values without fetching them via
getSelectableValue(String). |
List<FeatureValue<T>> |
setSelectableValues(List<String> codes)
Stores a list of
classification enum values by specifying their code. |
List<FeatureValue<T>> |
setSelectableValues(SessionContext ctx,
List<String> codes)
Stores a list of
classification enum values by specifying their code. |
List<FeatureValue<T>> |
setSelectableValues(SessionContext ctx,
String... codes)
Stores a list of
classification enum values by specifying their code. |
List<FeatureValue<T>> |
setSelectableValues(String... codes)
Stores a list of
classification enum values by specifying their code. |
add, assureOwnValue, clear, clear, clearAll, createValue, createValue, createValue, createValues, createValues, createValues, createValues, equals, extractLanguage, getAllDescriptions, getAllDescriptions, getLanguageValues, getName, getParent, getValue, getValue, getValues, getValues, getValuesDirect, getValuesFormatted, hashCode, isEmpty, isEmpty, isEmptyIgnoringLanguage, isFallbackEnabled, isLocalized, loadTyped, loadTyped, loadValue, moveValue, moveValue, remove, remove, remove, removeValue, setLocalized, setValue, setValue, setValues, setValues, setValues, setValues, size, size, toString, writeToDatabasepublic static final String CONVERT_TO_FEATUREUNIT
getValuesDirect(SessionContext).
SessionContext ctx = jaloSession.createSessionContext(); ctx.setAttribute(TypedFeature.CONVERT_TO_FEATUREUNIT, false); List<Number> numbersNotConverted = feat.getValuesDirect(ctx);
protected TypedFeature(FeatureContainer parent, ClassAttributeAssignment assignment)
parent - the container which this feature belongs toassignment - the assignment which backs this featureprotected TypedFeature(TypedFeature<T> src) throws CloneNotSupportedException
src - the source featureCloneNotSupportedExceptionpublic TypedFeature<T> clone() throws CloneNotSupportedException
clone in class Feature<T>CloneNotSupportedExceptionpublic String getName(SessionContext ctx)
Feature.getName(SessionContext) to return the localized attribute name.public String getCode()
ClassificationAttribute.public ClassAttributeAssignment getClassAttributeAssignment()
public ClassificationAttribute getClassificationAttribute()
public ClassificationClass getClassificationClass()
public ClassificationAttributeUnit getUnit()
public ClassificationAttributeValue getSelectableValue(String code)
code - the code of the ClassificationAttributeValue to pickpublic Collection<ClassificationAttributeValue> getSelectableValues()
public FeatureValue<T> setSelectableValue(String code)
getSelectableValue(String).code - the code of the classification enumeration value to set as valueJaloInvalidParameterException - if no such value exists for the underlying class attribute assignmentpublic FeatureValue<T> setSelectableValue(SessionContext ctx, String code)
getSelectableValue(String).ctx - the session context to perform this operation withincode - the code of the classification enumeration value to set as valueJaloInvalidParameterException - if no such value exists for the underlying class attribute assignmentpublic List<FeatureValue<T>> setSelectableValues(String... codes)
classification enum values by specifying their code. This is
a convenience method to avoid fetching all enum values via getSelectableValue(String) first.codes - the list of enumeration value codesJaloInvalidParameterException - if at least one value does not exists for the underlying class attribute assignmentpublic List<FeatureValue<T>> setSelectableValues(List<String> codes)
classification enum values by specifying their code. This is
a convenience method to avoid fetching all enum values via getSelectableValue(String) first.codes - the list of enumeration value codesJaloInvalidParameterException - if at least one value does not exists for the underlying class attribute assignmentpublic List<FeatureValue<T>> setSelectableValues(SessionContext ctx, String... codes)
classification enum values by specifying their code. This is
a convenience method to avoid fetching all enum values via getSelectableValue(String) first.ctx - the session context to perform this operation withincodes - the list of enumeration value codesJaloInvalidParameterException - if at least one value does not exists for the underlying class attribute assignmentpublic List<FeatureValue<T>> setSelectableValues(SessionContext ctx, List<String> codes)
classification enum values by specifying their code. This is
a convenience method to avoid fetching all enum values via getSelectableValue(String) first.ctx - the session context to perform this operation withincodes - the list of enumeration value codesJaloInvalidParameterException - if at least one value does not exists for the underlying class attribute assignmentpublic TypedFeature.FeatureType getFeatureType()
EnumerationValue returned by
GeneratedClassAttributeAssignment.getAttributeType(SessionContext).protected String getUniqueKey()
getUniqueKey in class Feature<T>public FeatureValue<T> createValue(SessionContext ctx, int index, Object value)
createValue in class Feature<T>ctx - the session context to define session language ( if feature is localized )index - the value index to insert new value at; -1 to append at the endvalue - the actual value to wrap inside the feature value objectpublic FeatureValue<T> createValue(SessionContext ctx, int index, Object value, boolean typeSafe)
ctx - the session context to define session language ( if feature is localized )index - the value index to insert new value at; -1 to append at the endvalue - the actual value to wrap inside the feature value objecttypeSafe - if true throws an error if given Object is not of correct type, else creates an feature value of type
Stringpublic String getValuesFormatted(SessionContext ctx)
getValuesFormatted in class Feature<T>ctx - the session context which defines the language to choose the value forpublic List<T> getValuesDirect(SessionContext ctx)
Feature.getValuesDirect(SessionContext) by converting all number values into the feature's
ClassificationAttributeUnit.
This can be controlled by using the CONVERT_TO_FEATUREUNIT session context attriute:
SessionContext myCtx = jaloSession.createSessionContext(); // to switch off automatic conversion: myCtx.setAttribute(TypedFeature.CONVERT_TO_FEATUREUNIT, Boolean.FALSE); List<Number> numbers = typedfeature.getValuesDirect(myCtx);
getValuesDirect in class Feature<T>ctx - the session context defining the language to get values forpublic NumberFormat getNumberFormat(SessionContext ctx)
ClassAttributeAssignment.getNumberFormat(SessionContext).
If no number format is stored there just Feature.getNumberFormat(SessionContext) is called.
getNumberFormat in class Feature<T>public DateFormat getDateFormat(SessionContext ctx)
ClassAttributeAssignment.getDateFormat(SessionContext).
If no number format is stored there just Feature.getDateFormat(SessionContext) is called.
getDateFormat in class Feature<T>protected void assureSelectableValue(ClassificationAttributeValue value) throws JaloInvalidParameterException
JaloInvalidParameterExceptionCopyright © 2017 SAP SE. All Rights Reserved.