List of usage examples for org.apache.commons.lang Validate notEmpty
public static void notEmpty(String string)
Validate an argument, throwing IllegalArgumentException
if the argument String is empty (null
or zero length).
Validate.notEmpty(myString);
The message in the exception is 'The validated string is empty'.
From source file:demo.service.CustomerService.java
@GET @Path("/{id}/") @Produces("application/json") public Customer getCustomer(@PathParam("id") final String id) { Validate.notNull(id);/*from w ww.jav a 2s . c o m*/ Validate.notEmpty(id); LOGGER.log(Level.FINE, "Invoking getCustomer, id={0}", id); Customer customer = customers.get(Long.parseLong(id)); if (customer == null) { LOGGER.log(Level.SEVERE, "Specified customer does not exist, id={0}", id); } return customer; }
From source file:de.weltraumschaf.registermachine.front.Parser.java
static boolean isOperator(final Token<?> token, final String literal) { Validate.notNull(token);//ww w. j a v a 2s .c om Validate.notNull(literal); Validate.notEmpty(literal); return token.getType() == TokenType.OPERATOR && literal.equals(((Token<String>) token).getValue()); }
From source file:ar.com.zauber.commons.web.proxy.impl.dao.properties.provider.JndiPropertiesProvider.java
/** * Creates the JndiPropertiesProvider./*from ww w . j ava 2s .c o m*/ * * @param jndiVariable * @param resourceLoader * @param fallback * @throws IOException . */ public JndiPropertiesProvider(final String jndiVariable, final ResourceLoader resourceLoader, final PropertiesProvider fallback) throws IOException { Validate.notEmpty(jndiVariable); Validate.notNull(resourceLoader); Validate.notNull(fallback); try { final InitialContext initCtx = new InitialContext(); final Context envCtx = (Context) initCtx.lookup("java:comp/env"); final Resource resource = resourceLoader.getResource((String) envCtx.lookup(jndiVariable)); target = new ResourcePropertiesProvider(resource); } catch (final NamingException e) { target = fallback; } }
From source file:ar.com.zauber.garfio.modules.jira.model.actions.FixInVersionAction.java
/** Creates the AddNoteToIssueAction. */ public FixInVersionAction(final JiraIssue issue, final JiraTrackerSession session, final String version) { Validate.notNull(issue);/*w w w. ja v a 2 s . co m*/ Validate.notNull(session); Validate.notEmpty(version); this.issue = issue; this.session = session; this.version = version; }
From source file:ar.com.zauber.commons.message.message.StringMessagePart.java
/** @see MessagePart#isContentType(java.lang.String) */ public final boolean isContentType(final String aContentType) { Validate.notEmpty(contentType); return contentType.equals(aContentType); }
From source file:com.vmware.identity.saml.SignatureAlgorithm.java
/** * Returns SignatureAlgorithm matching specific algorithm URI * * @param signatureAlgorithmURI// w ww .j ava 2 s . c o m * cannot be empty. * @return One of SignatureAlgorithm enum values or null if there is no such * algorithm supported and/or algorithmURI is unknown. */ public static SignatureAlgorithm getSignatureAlgorithmForURI(String signatureAlgorithmURI) { Validate.notEmpty(signatureAlgorithmURI); SignatureAlgorithm result = null; for (SignatureAlgorithm algo : SignatureAlgorithm.values()) { if (algo.toString().equals(signatureAlgorithmURI)) { result = algo; break; } } return result; }
From source file:ar.com.zauber.commons.message.mail.SendEmailDTO.java
/** * Creates the EmailDTO.// w ww. j a v a 2s . c om * * @param from * @param replyTo * @param to * @param subject * @param content * @param contentType */ public SendEmailDTO(final String from, final String replyTo, final String[] to, final String subject, final String content, final String contentType) { Validate.notEmpty(from); Validate.notEmpty(replyTo); Validate.notNull(to); Validate.notEmpty(subject); Validate.notEmpty(content); Validate.notEmpty(contentType); this.from = from; this.replyTo = replyTo; this.to = to.clone(); this.subject = subject; this.content = content; this.contentType = contentType; }
From source file:net.iglyduck.utils.sqlbuilder.WrapTable.java
public WrapTable(TempTable table, String aliasName) { Validate.notNull(table); Validate.notEmpty(aliasName); this.table = table; this.aliasName = aliasName; }
From source file:bigbluej.Client.java
Client(String url, String sharedSecret) { Validate.notEmpty(url); Validate.notEmpty(sharedSecret); this.url = url; this.sharedSecret = sharedSecret; }
From source file:fr.ribesg.bukkit.api.chat.Click.java
/** * Builds a new Click of the provided Type with the provided text. * * @param type the Type/*from w w w. j a v a2 s.c o m*/ * @param action the text * * @return a new Click of the provided Type */ private static Click forType(final Type type, final String action) { Validate.notEmpty(action); return new Click(type, action); }