001package co.codewizards.cloudstore.ls.core.invoke;
002
003import static java.util.Objects.*;
004
005import java.io.Serializable;
006import java.util.Set;
007
008import co.codewizards.cloudstore.core.ls.NoObjectRef;
009
010@NoObjectRef
011public class ClassInfo implements Serializable {
012
013        private static final long serialVersionUID = 1L;
014
015        private final int classId;
016
017        private final String className;
018
019        private final Set<String> interfaceNames;
020
021        private final boolean equalsOverridden;
022
023        public ClassInfo(final int classId, final String className, final Set<String> interfaceNames, final boolean equalsOverridden) {
024                this.classId = classId;
025                this.className = requireNonNull(className, "className");
026                this.interfaceNames = requireNonNull(interfaceNames, "interfaceNames");
027                this.equalsOverridden = equalsOverridden;
028        }
029
030        public int getClassId() {
031                return classId;
032        }
033
034        public String getClassName() {
035                return className;
036        }
037        public Set<String> getInterfaceNames() {
038                return interfaceNames;
039        }
040
041        /**
042         * Is the {@link #equals(Object) equals(...)} method overridden?
043         * <p>
044         * <b>Important:</b> {@link #hashCode()} must always be overridden, if {@code equals(...)} is overridden and vice-versa!
045         * In other words, either both methods or none of them must be overridden. The information provided by this method is
046         * thus used for both methods: {@code equals(...)} <b>and</b> {@code hashCode()}!
047         * <p>
048         * If {@code false}, it is assumed that {@code equals(...)} means object-identity. This can - and will - be checked
049         * locally by the proxy itself. Invocations of {@code equals(...)} and {@code hashCode()} are thus <i>not</i> delegated
050         * to the real object, providing significant performance benefit.
051         * <p>
052         * If {@code true}, it is assumed that invocations of {@code equals(...)} and {@code hashCode()} must be delegated to the
053         * real object.
054         * @return whether the {@link #equals(Object) equals(...)} method is overridden.
055         */
056        public boolean isEqualsOverridden() {
057                return equalsOverridden;
058        }
059}