55import java .util .*;
66import java .io .*;
77
8- // Immutable class that uses defensive copying
8+ // 방어적 복사를 사용하는 불변 클래스
99public final class Period implements Serializable {
1010 private final Date start ;
1111 private final Date end ;
1212
1313 /**
14- * @param start the beginning of the period
15- * @param end the end of the period; must not precede start
16- * @throws IllegalArgumentException if start is after end
17- * @throws NullPointerException if start or end is null
14+ * @param start 시작 시각
15+ * @param end 종료 시각; 시작 시각보다 뒤여야 한다.
16+ * @throws IllegalArgumentException 시작 시각이 종료 시각보다 늦을 때 발생한다.
17+ * @throws NullPointerException start나 end가 null이면 발행한다.
1818 */
1919 public Period (Date start , Date end ) {
2020 this .start = new Date (start .getTime ());
2121 this .end = new Date (end .getTime ());
2222 if (this .start .compareTo (this .end ) > 0 )
2323 throw new IllegalArgumentException (
24- start + " after " + end );
24+ start + "" 가 " + end + "보다 늦다." );
2525 }
2626
2727 public Date start () { return new Date (start .getTime ()); }
@@ -31,7 +31,7 @@ public Period(Date start, Date end) {
3131 public String toString () { return start + " - " + end ; }
3232
3333
34- // Serialization proxy for Period class
34+ // 코드 90-1 Period 클래스용 직렬화 프록시 (479쪽)
3535 private static class SerializationProxy implements Serializable {
3636 private final Date start ;
3737 private final Date end ;
@@ -42,17 +42,17 @@ private static class SerializationProxy implements Serializable {
4242 }
4343
4444 private static final long serialVersionUID =
45- 234098243823485285L ; // Any number will do (Item 87)
45+ 234098243823485285L ; // 아무 값이나 상관없다. (아이템 87)
4646 }
4747
48- // writeReplace method for the serialization proxy pattern
48+ // 직렬화 프록시 패턴용 writeReplace 메서드 (480쪽)
4949 private Object writeReplace () {
5050 return new SerializationProxy (this );
5151 }
5252
53- // readObject method for the serialization proxy pattern
53+ // 직렬화 프록시 패턴용 readObject 메서드 (480쪽)
5454 private void readObject (ObjectInputStream stream )
5555 throws InvalidObjectException {
56- throw new InvalidObjectException ("Proxy required " );
56+ throw new InvalidObjectException ("프록시가 필요합니다. " );
5757 }
58- }
58+ }
0 commit comments