Skip to content

Method: toString()

1: /**
2: * Copyright (C) 2019 Czech Technical University in Prague
3: * <p>
4: * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
5: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6: * version.
7: * <p>
8: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10: * details. You should have received a copy of the GNU General Public License along with this program. If not, see
11: * <http://www.gnu.org/licenses/>.
12: */
13: package cz.cvut.kbss.jopa.sessions.change;
14:
15: import cz.cvut.kbss.jopa.model.metamodel.FieldSpecification;
16: import cz.cvut.kbss.jopa.sessions.ChangeRecord;
17:
18: public class ChangeRecordImpl implements ChangeRecord {
19:
20: private final FieldSpecification<?, ?> attribute;
21:
22: private final Object newValue;
23:
24: private boolean preventsCaching;
25:
26: public ChangeRecordImpl(FieldSpecification<?, ?> att, Object value) {
27: assert att != null;
28: this.attribute = att;
29: this.newValue = value;
30: }
31:
32: @Override
33: public Object getNewValue() {
34: return newValue;
35: }
36:
37: @Override
38: public FieldSpecification<?, ?> getAttribute() {
39: return attribute;
40: }
41:
42: @Override
43: public void preventCaching() {
44: this.preventsCaching = true;
45: }
46:
47: @Override
48: public boolean doesPreventCaching() {
49: return preventsCaching;
50: }
51:
52: @Override
53: public String toString() {
54: return "ChangeRecordImpl{" +
55: "attribute='" + attribute.getName() + '\'' +
56: ", newValue=" + newValue +
57: ", preventsCaching=" + preventsCaching +
58: '}';
59: }
60: }