Java Code Examples for org.springframework.util.CollectionUtils#contains()

The following examples show how to use org.springframework.util.CollectionUtils#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockPortletURL.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
	if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) {
		throw new WindowStateException("WindowState not supported", windowState);
	}
	this.windowState = windowState;
}
 
Example 2
Source File: MockPortletURL.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
	if (!CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode)) {
		throw new PortletModeException("PortletMode not supported", portletMode);
	}
	this.portletMode = portletMode;
}
 
Example 3
Source File: MockStateAwareResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
	if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) {
		throw new WindowStateException("WindowState not supported", windowState);
	}
	this.windowState = windowState;
}
 
Example 4
Source File: MockStateAwareResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
	if (!CollectionUtils.contains(getPortalContext().getSupportedPortletModes(), portletMode)) {
		throw new PortletModeException("PortletMode not supported", portletMode);
	}
	this.portletMode = portletMode;
}
 
Example 5
Source File: MockMimeResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setContentType(String contentType) {
	if (this.request != null) {
		Enumeration<String> supportedTypes = this.request.getResponseContentTypes();
		if (!CollectionUtils.contains(supportedTypes, contentType)) {
			throw new IllegalArgumentException("Content type [" + contentType + "] not in supported list: " +
					Collections.list(supportedTypes));
		}
	}
	this.contentType = contentType;
}
 
Example 6
Source File: MockPortletURL.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
	if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) {
		throw new WindowStateException("WindowState not supported", windowState);
	}
	this.windowState = windowState;
}
 
Example 7
Source File: MockPortletURL.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
	if (!CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode)) {
		throw new PortletModeException("PortletMode not supported", portletMode);
	}
	this.portletMode = portletMode;
}
 
Example 8
Source File: MockStateAwareResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setWindowState(WindowState windowState) throws WindowStateException {
	if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) {
		throw new WindowStateException("WindowState not supported", windowState);
	}
	this.windowState = windowState;
}
 
Example 9
Source File: MockStateAwareResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
	if (!CollectionUtils.contains(getPortalContext().getSupportedPortletModes(), portletMode)) {
		throw new PortletModeException("PortletMode not supported", portletMode);
	}
	this.portletMode = portletMode;
}
 
Example 10
Source File: MockMimeResponse.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setContentType(String contentType) {
	if (this.request != null) {
		Enumeration<String> supportedTypes = this.request.getResponseContentTypes();
		if (!CollectionUtils.contains(supportedTypes, contentType)) {
			throw new IllegalArgumentException("Content type [" + contentType + "] not in supported list: " +
					Collections.list(supportedTypes));
		}
	}
	this.contentType = contentType;
}
 
Example 11
Source File: MockPortletRequest.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isWindowStateAllowed(WindowState windowState) {
	return CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState);
}
 
Example 12
Source File: MockPortletRequest.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isPortletModeAllowed(PortletMode portletMode) {
	return CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode);
}
 
Example 13
Source File: MockPortletRequest.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isWindowStateAllowed(WindowState windowState) {
	return CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState);
}
 
Example 14
Source File: MockPortletRequest.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isPortletModeAllowed(PortletMode portletMode) {
	return CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode);
}
 
Example 15
Source File: NameAwareAttribute.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    NameAwareAttribute that = (NameAwareAttribute) o;

    if (id != null ? !id.equals(that.id) : that.id != null) return false;
    if(this.values.size() != that.values.size()) {
        return false;
    }

    if(this.orderMatters != that.orderMatters || this.size() != that.size()) {
        return false;
    }

    if(this.hasValuesAsNames() != that.hasValuesAsNames()) {
        return false;
    }

    Set<?> myValues = this.values;
    Set<?> theirValues = that.values;
    if(this.hasValuesAsNames()) {
        // We have Name values - compare these to get
        // syntactically correct comparison of the values

        myValues = this.valuesAsNames.keySet();
        theirValues = that.valuesAsNames.keySet();
    }

    if(orderMatters) {
        Iterator<?> thisIterator = myValues.iterator();
        Iterator<?> thatIterator = theirValues.iterator();
        while(thisIterator.hasNext()) {
            if(!ObjectUtils.nullSafeEquals(thisIterator.next(), thatIterator.next())) {
                return false;
            }
        }

        return true;
    } else {
        for (Object value : myValues) {
            if(!CollectionUtils.contains(theirValues.iterator(), value)) {
                return false;
            }
        }

        return true;
    }
}