Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.regauto.dto;
- public class Plate {
- private final String value;
- public Plate(String value) {
- validate(value);
- this.value = value;
- }
- public String get() {
- return this.value;
- }
- void validate(String value) {
- if(value == null) {
- throw new RuntimeException();
- }
- for(int i=0; i < value.length(); i++) {
- char c = value.charAt(i);
- if(Character.isLetterOrDigit(c)) {
- continue;
- }
- throw new RuntimeException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment