01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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: package org.apache.poi.hwpf.usermodel;
19:
20: import org.apache.poi.hwpf.model.types.SEPAbstractType;
21:
22: import java.lang.reflect.Field;
23: import java.lang.reflect.AccessibleObject;
24:
25: public class SectionProperties extends SEPAbstractType {
26: public SectionProperties() {
27: field_20_brcTop = new BorderCode();
28: field_21_brcLeft = new BorderCode();
29: field_22_brcBottom = new BorderCode();
30: field_23_brcRight = new BorderCode();
31: field_26_dttmPropRMark = new DateAndTime();
32: }
33:
34: public Object clone() throws CloneNotSupportedException {
35: SectionProperties copy = (SectionProperties) super .clone();
36: copy.field_20_brcTop = (BorderCode) field_20_brcTop.clone();
37: copy.field_21_brcLeft = (BorderCode) field_21_brcLeft.clone();
38: copy.field_22_brcBottom = (BorderCode) field_22_brcBottom
39: .clone();
40: copy.field_23_brcRight = (BorderCode) field_23_brcRight.clone();
41: copy.field_26_dttmPropRMark = (DateAndTime) field_26_dttmPropRMark
42: .clone();
43:
44: return copy;
45: }
46:
47: public boolean equals(Object obj) {
48: Field[] fields = SectionProperties.class.getSuperclass()
49: .getDeclaredFields();
50: AccessibleObject.setAccessible(fields, true);
51: try {
52: for (int x = 0; x < fields.length; x++) {
53: Object obj1 = fields[x].get(this );
54: Object obj2 = fields[x].get(obj);
55: if (obj1 == null && obj2 == null) {
56: continue;
57: }
58: if (!obj1.equals(obj2)) {
59: return false;
60: }
61: }
62: return true;
63: } catch (Exception e) {
64: return false;
65: }
66: }
67:
68: }
|