KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hwpf > usermodel > SectionProperties


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.hwpf.usermodel;
20
21 import org.apache.poi.hwpf.model.types.SEPAbstractType;
22
23 import java.lang.reflect.Field JavaDoc;
24 import java.lang.reflect.AccessibleObject JavaDoc;
25 import java.lang.reflect.Array JavaDoc;
26
27 public class SectionProperties
28   extends SEPAbstractType
29 {
30   public SectionProperties()
31   {
32     field_20_brcTop = new BorderCode();
33     field_21_brcLeft = new BorderCode();
34     field_22_brcBottom = new BorderCode();
35     field_23_brcRight = new BorderCode();
36     field_26_dttmPropRMark = new DateAndTime();
37   }
38
39   public Object JavaDoc clone()
40     throws CloneNotSupportedException JavaDoc
41   {
42     SectionProperties copy = (SectionProperties)super.clone();
43     copy.field_20_brcTop = (BorderCode)field_20_brcTop.clone();
44     copy.field_21_brcLeft = (BorderCode)field_21_brcLeft.clone();
45     copy.field_22_brcBottom = (BorderCode)field_22_brcBottom.clone();
46     copy.field_23_brcRight = (BorderCode)field_23_brcRight.clone();
47     copy.field_26_dttmPropRMark = (DateAndTime)field_26_dttmPropRMark.clone();
48
49     return copy;
50   }
51
52   public boolean equals(Object JavaDoc obj)
53   {
54     Field JavaDoc[] fields = SectionProperties.class.getSuperclass().getDeclaredFields();
55     AccessibleObject.setAccessible(fields, true);
56     try
57     {
58       for (int x = 0; x < fields.length; x++)
59       {
60         Object JavaDoc obj1 = fields[x].get(this);
61         Object JavaDoc obj2 = fields[x].get(obj);
62         if (obj1 == null && obj2 == null)
63         {
64           continue;
65         }
66         if (!obj1.equals(obj2))
67         {
68           return false;
69         }
70       }
71       return true;
72     }
73     catch (Exception JavaDoc e)
74     {
75       return false;
76     }
77   }
78
79 }
80
Popular Tags