Package com.easydesk.attribute
Class CurrencyAttribute
- All Implemented Interfaces:
Viewable,Cacheable,Observed,Retrievable,Serializable,ColumnAccessByName,ObjectModel,Persistent
- Direct Known Subclasses:
PersonalCurrencyAttribute
가격을 기술한다. 화폐는 어느 국가의 화폐인지 그리고 소숫점 처리가 모두 지원 되어야 한다. 화폐의 단위가 아이템의 locale 과 다를 경우 저장시 그 내용을 attachment 에 저장한다.
Locale locale = new Locale("en", "UK");
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
System.out.println(fmt.format(120.00));
통화는 ISO 4217 currency code (예: "USD" 와 같은 세 글자) 로 나타낸다.
value 에 통화 정보와 같이 저장한다. 예) $2.00 or USD2.00
- WON SIGN U+20A9 : ₩
- FULLWIDTH WON SIGN U+FFE6 : ₩
- CLDR (South Korea) : KRW-symbol-narrow = ₩, KRW-symbol = ₩ (CLDR ko summary)
- Version:
- $Revision: 1.15 $ $Date: 2008/12/25 04:03:44 $
- Author:
- Youngho Cho
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.easydesk.om.AttributeValue
AttributeValue.AccessEnum -
Field Summary
Fields inherited from class com.easydesk.om.AttributeValue
activitySet, chainedFields inherited from interface com.easydesk.validator.Retrievable
KEY_SEPERATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCurrency(Locale locale) locale 에 해당하는 통화를 구한다.getFormatter(Locale locale) locale 에 해당하는 통화 formatter 를 구한다.getPrice()가격을 구한다.booleanisFree()가격이 0 인지 확인한다.booleanisLarge(CurrencyAttribute attr) 이 가격이 주어진 속성의 가격보다 큰지 비교한다.주어진 locale 의 통화 형식으로 값을 해석한다.void문자열로 주어진 숫자 값을 설정한다.voidsetPrice(long price) 가격을 설정한다.void가격을 설정한다.void문자열로 주어진 가격을 설정한다.Methods inherited from class com.easydesk.attribute.FloatAttribute
add, floatValue, floatValue, getFloat, getLowerBound, getSortableString, getUpperBound, setNumericValue, setNumericValue, setPropertiesMethods inherited from class com.easydesk.attribute.NumericAttribute
getLowerValue, getRangePattern, getUpperValue, hasValueMethods inherited from class com.easydesk.attribute.StringAttribute
getLocalizedValue, getLocalizedValueMethods inherited from class com.easydesk.attribute.FreeFormAttribute
getDisplayedValue, getDisplayedValue, init, loadResources, setResourcesMethods inherited from class com.easydesk.om.AttributeValue
alwaysNeedActivity, clear, copy, copy, endActivitySet, getActivity, getActivityDescription, getAttachment, getChainedValue, getChainedValue, getChainedValue, getInputValue, getLocalizedValue, getLocalizedValue, getLocalizedValue, getLocalizedValues, getLocalizedValues, getMethodCache, getModuleAttribute, getNewInstance, getNewInstance, getNumericValues, getNumericValues, getNumericValuesAsString, getNumericValuesAsString, getObserverOption, getOptionIdAsString, getOptionIds, getOptionIds, getOptionIdsAsString, getOptionIdsAsString, getOptionValues, getPossibleTransitionCount, getPossibleTransitionCount, getPrimitiveOptionIds, getPrimitiveUserIds, getQueryKey, getRelativePath, getRelativePath, getRepository, getResource, getTransactionId, getUser, getUserIds, getValueList, getValueList, getValues, getValues, getValuesAsString, getValuesAsString, hasAlreadyChained, isModified, isQuickSearchAttribute, isSet, isSetOnly, needActivity, performAfter, performBefore, register, save, setActivity, setActivityDescription, setAttachment, setChainedValue, setInputValue, setNumericValueOnly, setNumericValues, setOptionId, setOptionIdOnly, setOptionIds, setOptionValues, setPrimitiveOptionIds, setPrimitiveUserIds, setTransactionId, setUser, setUserId, setUserIdOnly, setUserIds, setValue, setValueOnly, setValues, startActivitySet, toStringMethods inherited from class com.easydesk.om.BaseAttributeValue
copy, copy, copyInto, copyInto, copyInto, copyInto, equals, getAttribute, getAttribute, getAttributeId, getAttributeOption, getAttributeOption, getByName, getByPeerName, getByPosition, getDepend, getDepend, getDependId, getEasyDeskUserImpl, getEasyDeskUserImpl, getFieldNames, getForeignKeyForAttribute, getForeignKeyForAttributeOption, getForeignKeyForDepend, getForeignKeyForEasyDeskUserImpl, getForeignKeyForItem, getItem, getItem, getItemId, getNumericValue, getOptionId, getPeer, getPrimaryKey, getTableMap, getUserId, getValue, getValueId, hashCode, isCacheOnSave, isDeleted, isLoading, isModified, isNew, isRemoved, isSaving, resetModified, save, save, setAttribute, setAttributeId, setAttributeKey, setAttributeOption, setAttributeOptionKey, setByName, setByPeerName, setByPosition, setDeleted, setDepend, setDependId, setDependKey, setEasyDeskUserImpl, setEasyDeskUserImplKey, setItem, setItemId, setItemKey, setLoading, setModified, setNew, setPrimaryKey, setPrimaryKey, setRemoved, setSaving, setValueId, valueEqualsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.easydesk.attribute.Viewable
getComponentName
-
Constructor Details
-
CurrencyAttribute
public CurrencyAttribute()새로운CurrencyAttribute인스턴스를 생성한다.
-
-
Method Details
-
setPrice
가격을 설정한다.- Parameters:
price- 가격
-
setPrice
public void setPrice(long price) 가격을 설정한다.- Parameters:
price- 가격
-
setPrice
문자열로 주어진 가격을 설정한다.- Parameters:
price- 숫자로 변환 가능한 가격 문자열
-
isLarge
이 가격이 주어진 속성의 가격보다 큰지 비교한다.- Parameters:
attr- 비교할 가격 속성- Returns:
- 이 가격이 더 크면
true
-
isFree
public boolean isFree()가격이 0 인지 확인한다.- Returns:
- 가격이 0 이면
true
-
getPrice
가격을 구한다. 현재는 구현되어 있지 않다.- Returns:
- 가격
- Throws:
UnsupportedOperationException- 항상 발생 (미구현)
-
setNumericValue
Description copied from class:NumericAttribute문자열로 주어진 숫자 값을 설정한다.- Overrides:
setNumericValuein classFloatAttribute- Parameters:
v- number String may be have ',' and '.' for example 12,000 or 12,000.00 will be valid.
-
parse
주어진 locale 의 통화 형식으로 값을 해석한다.- Parameters:
value- 해석할 통화 문자열locale- 통화 형식을 결정할 locale- Returns:
- 해석된 숫자
- Throws:
Exception- 값을 해석할 수 없는 경우
-
getCurrency
locale 에 해당하는 통화를 구한다.- Parameters:
locale- 통화를 결정할 locale- Returns:
- currency
- Throws:
Exception- formatter 를 구하는 중 오류가 발생한 경우
-
getFormatter
locale 에 해당하는 통화 formatter 를 구한다.- Overrides:
getFormatterin classFreeFormAttribute- Parameters:
locale- 통화를 결정할 locale- Returns:
NumberFormatcurrency formatter- Throws:
Exception- 값을 구하는 중 오류가 발생한 경우
-