domain-value
Maven Dependency
<dependency>
<groupId>com.qoomon</groupId>
<artifactId>domainvalue</artifactId>
<version>LATEST</version>
</dependency>
Example: BankAccountNumber
import com.qoomon.domainvalue.type.LongDV;
public class BankAccount extends LongDV {
protected BankAccount(Long value) {
super(value);
}
@FactoryMethod
public static BankAccount of(Long value) {
return new BankAccount(value);
}
/**
* rember to call the super validation method first
*/
@ValidationMethod
public static boolean isValid(Long value) {
return LongDV.isValid(value)
&& value > 1000000;
}
}