List of usage examples for org.apache.commons.lang ArrayUtils contains
public static boolean contains(boolean[] array, boolean valueToFind)
Checks if the value is in the given array.
From source file:gda.device.enumpositioner.EpicsSimpleBinary.java
@Override public void rawAsynchronousMoveTo(Object position) throws DeviceException { String positionString = position.toString(); checkConfigured();/*from ww w .j ava2 s. co m*/ if (readonly) { throw new DeviceException("trying to move readonly epics object" + getName()); } throwExceptionIfInvalidTarget(positionString); try { if (ArrayUtils.contains(positions, positionString)) { controller.caput(controlChnl, positionString, pcbl); } } catch (Exception e) { throw new DeviceException(getName() + " exception in rawAsynchronousMoveTo", e); } }
From source file:filters.NamedEntityFilter.java
private boolean isPotentialNamedEntityGlue(Token token) { // A non-capitalized word could be part of a named entity iff it is 4 characters long or // less and is carries one of the following POS-tags: CC, DT, IN, TO // For explanation, see http://grammartips.homestead.com/caps.html return token.term.length() <= 4 && ArrayUtils.contains(glueTypes, token.type); }
From source file:de.codesourcery.eve.skills.ui.Main.java
@Override public void appConfigChanged(AppConfig config, String... properties) { log.info("appConfigChanged(): Config changed."); if (ArrayUtils.contains(properties, AppConfig.PROP_CLIENT_RETRIEVAL_STRATEGY)) { log.info("appConfigChanged(): Config changed , updating API client retrieval strategy."); this.apiClient.setDefaultRetrievalStrategy(config.getClientRetrievalStrategy()); }/*ww w. j a v a 2s. c om*/ }
From source file:com.flexive.core.security.UserTicketImpl.java
/** * {@inheritDoc}// w w w . java 2 s . c o m */ @Override public final boolean isInRole(Role role) { return isGlobalSupervisor() || roles != null && ArrayUtils.contains(roles, role); }
From source file:com.googlecode.gmaps4jsf.jsfplugin.mojo.TagMojo.java
private boolean isIgnored(Attribute attribute, String[] attributes) { return ArrayUtils.contains(attributes, attribute.getName()); }
From source file:com.adobe.acs.commons.contentfinder.querybuilder.impl.viewhandler.GQLToQueryBuilderConverter.java
public static boolean isValidProperty(final String key) { return (!ArrayUtils.contains(ContentFinderConstants.PROPERTY_BLACKLIST, key)); }
From source file:com.excilys.soja.server.handler.ServerHandler.java
/** * Handle CONNECT command/*w w w. j a va2 s. c o m*/ * * @param frame * @throws SocketException */ public void handleConnect(final Channel channel, Frame frame) throws LoginException, UnsupportedVersionException, AlreadyConnectedException, SocketException { // Retrieve the session for this client if (clientsSessionToken.containsKey(channel)) { throw new AlreadyConnectedException("User try to connect but it seems to be already connected"); } String[] acceptedVersions = frame.getHeader().get(HEADER_ACCEPT_VERSION, "").split(","); // Check the compatibility of the client and server STOMP version if (!ArrayUtils.contains(acceptedVersions, STOMP_VERSION)) { sendError(channel, "Supported version doesn't match", "Supported protocol version is " + STOMP_VERSION); throw new UnsupportedVersionException( "The server doesn't support the same STOMP version as the client : server=" + STOMP_VERSION + ", client=" + acceptedVersions); } String login = frame.getHeaderValue(HEADER_LOGIN); String password = frame.getHeaderValue(HEADER_PASSCODE); try { LOGGER.trace("Check credentials for {}", login); // Check the credentials of the user String clientSessionToken = authentication.connect(login, password); clientsSessionToken.put(channel, clientSessionToken); // Create the frame to send ConnectedFrame connectedFrame = new ConnectedFrame(STOMP_VERSION); connectedFrame.setSession(clientSessionToken); connectedFrame.setServerName(StompServer.SERVER_HEADER_VALUE); // Start the heart-beat scheduler if needed if (startLocalHeartBeat(channel, frame)) { connectedFrame.setHeartBeat(getLocalGuaranteedHeartBeat(), getLocalExpectedHeartBeat()); } sendFrame(channel, connectedFrame); fireConnectedListeners(channel); } catch (LoginException e) { sendError(channel, "Bad credentials", "Username or passcode incorrect"); throw e; } }
From source file:jp.primecloud.auto.nifty.process.NiftyProcessClient.java
public InstanceDto waitInstance(String instanceId) { // ???/*w w w. j a v a 2 s.co m*/ String[] stableStatus = new String[] { "running", "stopped" }; // TODO: API??? warning ?API?????? String[] unstableStatus = new String[] { "pending", "warning" };// InstanceDto instance; while (true) { instance = describeInstance(instanceId); String status = instance.getState().getName(); if (ArrayUtils.contains(stableStatus, status)) { break; } if (!ArrayUtils.contains(unstableStatus, status)) { // ??? AutoException exception = new AutoException("EPROCESS-000604", instanceId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance)); throw exception; } } return instance; }
From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java
/** * Returns true if the parameter char is part of the parameter character set *///from w w w. j a v a2s.c o m static private boolean is(final char c, final char[] charset) { return ArrayUtils.contains(charset, c); }
From source file:com.adobe.acs.commons.rewriter.impl.StaticReferenceRewriteTransformerFactory.java
@SuppressWarnings("squid:S3776") private Attributes rebuildAttributes(String elementName, Attributes attrs, String[] modifyableAttributes) { // clone the attributes final AttributesImpl newAttrs = new AttributesImpl(attrs); for (int i = 0; i < newAttrs.getLength(); i++) { final String attrName = newAttrs.getLocalName(i); if (ArrayUtils.contains(modifyableAttributes, attrName)) { final String attrValue = newAttrs.getValue(i); String key = elementName + ":" + attrName; if (matchingPatterns.containsKey(key)) { // Find value based on matching pattern Pattern matchingPattern = matchingPatterns.get(key); try { newAttrs.setValue(i, handleMatchingPatternAttribute(matchingPattern, attrValue)); } catch (Exception e) { log.error("Could not perform replacement based on matching pattern", e); }/*from w w w . ja v a 2 s . c o m*/ } else { for (String prefix : prefixes) { if (attrValue.startsWith(prefix)) { newAttrs.setValue(i, prependHostName(attrValue)); } } } } } return newAttrs; }