示例#1
0
        } // hashCode()

        // @Override
        public bool equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }

            SimpleDataSetHeader other = (SimpleDataSetHeader)obj;

            if (_items == null)
            {
                if (other._items != null)
                {
                    return(false);
                }
            }
            else if (!_items.Equals(other._items))
            {
                return(false);
            }
            return(true);
        } // equals()
示例#2
0
        /**
         * Method invoked by the Java serialization framework while deserializing
         * Row instances. Since previous versions of MetaModel did not use a
         * DataSetHeader, but had a reference to a List<SelectItem>, this
         * deserialization is particularly tricky. We check if the items variable is
         * there, and if it is, we convert it to a header instead.
         *
         * @param stream
         * @throws Exception
         */
        private void readObject(Object o, NInputStream stream) // throws Exception
        {
            XmlSerializer serializer = new XmlSerializer(o.GetType());
            object        read_data  = serializer.Deserialize(stream);  //.readFields();

            FieldInfo[] fields      = read_data.GetType().GetFields();
            FieldInfo   items_field = NTypeUtils.getField(read_data.GetType(), "_items");

            NGetField get_field = new NGetField(read_data, fields);

            try
            {
                // backwards compatible deserialization, convert items to header
                Object items = items_field.GetValue(read_data);
                //@SuppressWarnings("unchecked")
                List <SelectItem>   itemsList = (List <SelectItem>)items;
                SimpleDataSetHeader header    = new SimpleDataSetHeader(itemsList);
                FieldInfo           field     = NTypeUtils.getField(GetType(), "_header");
                // field.setAccessible(true);
                field.SetValue(this, header);
            }
            catch (ArgumentException e)
            {
                // no backwards compatible deserialization needed.
                setWhileDeserializing(get_field, "_header");
            }
            setWhileDeserializing(get_field, "_values");
            setWhileDeserializing(get_field, "_styles");
        } // readObject()
        } // indexOf()

        // @Override
        public Row getSubSelection(SelectItem[] selectItems)
        {
            DataSetHeader header = new SimpleDataSetHeader(selectItems);

            return(getSubSelection(header));
        }