/* * Copyright (c) 2010-2014 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.evolveum.midpoint.prism.foo; import com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy; import com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy; import org.jvnet.jaxb2_commons.lang.Equals; import org.jvnet.jaxb2_commons.lang.EqualsStrategy; import org.jvnet.jaxb2_commons.lang.HashCode; import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; import org.jvnet.jaxb2_commons.locator.ObjectLocator; import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EventCategoryFilterType", propOrder = { "category" }) public class EventCategoryFilterType extends EventHandlerType implements Serializable, Cloneable, Equals, HashCode { private final static long serialVersionUID = 201105211233L; protected List<String> category; /** * Creates a new {@code EventCategoryFilterType} instance. * */ public EventCategoryFilterType() { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); } /** * Creates a new {@code EventCategoryFilterType} instance by deeply copying a given {@code EventCategoryFilterType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public EventCategoryFilterType(final EventCategoryFilterType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(o); if (o == null) { throw new NullPointerException("Cannot create a copy of 'EventCategoryFilterType' from 'null'."); } // 'Category' collection. if (o.category!= null) { copyCategory(o.getCategory(), this.getCategory()); } } /** * Gets the value of the category property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the category property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCategory().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getCategory() { if (category == null) { category = new ArrayList<String>(); } return this.category; } /** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * */ public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = super.hashCode(locator, strategy); { List<String> theCategory; theCategory = (((this.category!= null)&&(!this.category.isEmpty()))?this.getCategory():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "category", theCategory), currentHashCode, theCategory); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = DomAwareHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof EventCategoryFilterType)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final EventCategoryFilterType that = ((EventCategoryFilterType) object); { List<String> lhsCategory; lhsCategory = (((this.category!= null)&&(!this.category.isEmpty()))?this.getCategory():null); List<String> rhsCategory; rhsCategory = (((that.category!= null)&&(!that.category.isEmpty()))?that.getCategory():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "category", lhsCategory), LocatorUtils.property(thatLocator, "category", rhsCategory), lhsCategory, rhsCategory)) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy strategy = DomAwareEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } /** * Copies all values of property {@code Category} deeply. * * @param source * The source to copy from. * @param target * The target to copy {@code source} to. * @throws NullPointerException * if {@code target} is {@code null}. */ @SuppressWarnings("unchecked") private static void copyCategory(final List<String> source, final List<String> target) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 if ((source!= null)&&(!source.isEmpty())) { for (final Iterator<?> it = source.iterator(); it.hasNext(); ) { final Object next = it.next(); if (next instanceof String) { // CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.String target.add(((String) next)); continue; } // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Category' of class 'com.evolveum.midpoint.xml.ns._public.common.common_3.EventCategoryFilterType'.")); } } } /** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public EventCategoryFilterType clone() { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final EventCategoryFilterType clone = ((EventCategoryFilterType) super.clone()); // 'Category' collection. if (this.category!= null) { clone.category = null; copyCategory(this.getCategory(), clone.getCategory()); } return clone; } } @Override public String toString() { return "EventCategoryFilterType{" + "category=" + category + '}'; } }