Package com.exedio.cope.pattern
Class MoneyField<C extends Money.Currency>
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.Pattern
-
- com.exedio.cope.pattern.MoneyField<C>
-
- All Implemented Interfaces:
CheckingSettable<Money<C>>
,Settable<Money<C>>
,Serializable
public final class MoneyField<C extends Money.Currency> extends Pattern implements Settable<Money<C>>, CheckingSettable<Money<C>>
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
check(Money<C> value, FieldValues fieldValues)
static <C extends Money.Currency>
MoneyField<C>exclusive(FunctionField<C> currency)
SetValue<?>[]
execute(Money<C> value, Item exceptionItem)
static <C extends Money.Currency>
MoneyField<C>fixed(C currency)
Money<C>
get(Item item)
PriceField
getAmount()
FunctionField<C>
getCurrency()
Deprecated.UsegetCurrencyField()
insteadClass<C>
getCurrencyClass()
FunctionField<C>
getCurrencyField()
BEWARE: This method returns null, if the currency is not stored in a field.C
getCurrencyValue()
BEWARE: This method returns null, if the currency is stored in a field.Set<Class<? extends Throwable>>
getInitialExceptions()
Returns the exceptions possibly thrown, when setting a value for this settable.Type
getInitialType()
CheckConstraint
getUnison()
boolean
isFinal()
Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.boolean
isInitial()
Returns true, if a value for the settable should be specified on the creation of an item.boolean
isMandatory()
IsNullCondition<?>
isNotNull()
IsNullCondition<?>
isNull()
MoneyField<C>
minZero()
protected void
onMount()
Here you can do additional initialization not yet done in the constructor.MoneyField<C>
optional()
void
set(Item item, Money<C> value)
static <C extends Money.Currency>
MoneyField<C>shared(FunctionField<C> currency)
MoneyField<C>
toFinal()
-
Methods inherited from class com.exedio.cope.Pattern
addSource, addSource, addSource, addSource, addSourceFeature, addSourceFeature, addSourceFeature, annotationField, equals, getGeneratedTypes, getSourceFeatures, getSourceFeaturesGather, getSourceFields, getSources, getSourceTypes, getType, hashCode, initialize, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newType, newType, registerSource
-
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
-
-
-
Method Detail
-
fixed
public static <C extends Money.Currency> MoneyField<C> fixed(C currency)
-
shared
public static <C extends Money.Currency> MoneyField<C> shared(FunctionField<C> currency)
-
exclusive
public static <C extends Money.Currency> MoneyField<C> exclusive(FunctionField<C> currency)
-
toFinal
public MoneyField<C> toFinal()
-
optional
public MoneyField<C> optional()
-
minZero
public MoneyField<C> minZero()
-
getAmount
public PriceField getAmount()
-
getCurrencyField
public FunctionField<C> getCurrencyField()
BEWARE: This method returns null, if the currency is not stored in a field.- See Also:
getCurrencyValue()
-
getCurrencyValue
public C getCurrencyValue()
BEWARE: This method returns null, if the currency is stored in a field.- See Also:
getCurrencyField()
-
getUnison
public CheckConstraint getUnison()
-
isInitial
public boolean isInitial()
Description copied from interface:Settable
Returns true, if a value for the settable should be specified on the creation of an item.- Specified by:
isInitial
in interfaceSettable<C extends Money.Currency>
-
isFinal
public boolean isFinal()
Description copied from interface:Settable
Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.- Specified by:
isFinal
in interfaceSettable<C extends Money.Currency>
-
isMandatory
public boolean isMandatory()
- Specified by:
isMandatory
in interfaceSettable<C extends Money.Currency>
-
getInitialType
public Type getInitialType()
- Specified by:
getInitialType
in interfaceSettable<C extends Money.Currency>
-
getInitialExceptions
public Set<Class<? extends Throwable>> getInitialExceptions()
Description copied from interface:Settable
Returns the exceptions possibly thrown, when setting a value for this settable.- Specified by:
getInitialExceptions
in interfaceSettable<C extends Money.Currency>
-
onMount
protected void onMount()
Description copied from class:Pattern
Here you can do additional initialization not yet done in the constructor. In this method you can call methodsPattern.getType()
andFeature.getName()
for the first time.
-
execute
public SetValue<?>[] execute(Money<C> value, Item exceptionItem)
- Specified by:
execute
in interfaceSettable<C extends Money.Currency>
-
check
public void check(Money<C> value, FieldValues fieldValues)
- Specified by:
check
in interfaceCheckingSettable<C extends Money.Currency>
-
isNull
public IsNullCondition<?> isNull()
-
isNotNull
public IsNullCondition<?> isNotNull()
-
getCurrency
@Deprecated public FunctionField<C> getCurrency()
Deprecated.UsegetCurrencyField()
instead
-
-