private void setDependency(Dependency dependency) { Assert.notNull(dependency, "Dependency must be set"); this.dependency = dependency; }
public static boolean isQualified(final String className) { String[] tokens = tokenizeClassName(className); return (tokens != null) && (tokens.length > 1); }
public boolean hasJdbcConnectionInfo() { return !Strings.isNullOrEmpty(databaseURL) || !Strings.isNullOrEmpty(jdbcDriver) || !Strings.isNullOrEmpty(username) || !Strings.isNullOrEmpty(password); }
public String canonicalize(final String name) { StringBuilder result = new StringBuilder(); String[] split = name.split("[^A-Za-z0-9]"); for (String string : split) { result.append(Strings.capitalize(string)); } return result.toString(); } }
/** * Create a <i>toString</i> implementation using the supplied fields * * @param clazz * @param fields */ public static void createToStringFromFields(final JavaClass clazz, final Field<JavaClass>... fields) { createToStringFromFields(clazz, Arrays.asList(fields)); }
public static String getGenerics(final String type) { if (isGeneric(type)) { return type.replaceFirst("^[^<]*(<.*?>)$", "$1"); } return ""; }
public static String getGenericsTypeParameter(final String type) { return getGenerics(type).replaceAll("<", "").replaceAll(">", ""); }
public static boolean areEqualTrimmed(final String left, final String right) { if ((left != null) && (right != null)) { return left.trim().equals(right.trim()); } return areEqual(left, right); }
/** * Install the given facets without prompting for confirmation */ public InstallFacets(final Class<? extends Facet>... facetTypes) { // FIXME This method causes warnings when used as intended... fix? Assert.notNull(facetTypes, "Facet types may not be null."); this.facetTypes = Arrays.asList(facetTypes); }
public boolean isGit() { return !Strings.isNullOrEmpty(gitRepo); }
/** * Create a <i>toString</i> implementation using all the fields in this class * * @param clazz */ public static void createToStringFromFields(final JavaClass clazz) { List<Field<JavaClass>> fields = clazz.getFields(); createToStringFromFields(clazz, fields); }
public static String toSimpleName(final String fieldType) { String result = fieldType; if (result != null) { String[] tokens = tokenizeClassName(result); if (tokens != null) { result = tokens[tokens.length - 1]; } } return result; }
/** * Install the given facets without prompting for confirmation */ public RemoveFacets(final Class<? extends Facet>... facetTypes) { // FIXME This method causes warnings when used as intended... fix? Assert.notNull(facetTypes, "Facet types may not be null."); this.facetTypes = Arrays.asList(facetTypes); }
public DependencyRepositoryImpl(final String id, final String url) { if (Strings.isNullOrEmpty(id)) { throw new IllegalArgumentException("must specify repository id"); } if (Strings.isNullOrEmpty(url)) { throw new IllegalArgumentException("must specify repository url"); } this.id = id; this.url = url; }
/** * Return the index of the last element of this List, if any (size - 1), if the list is empty, return 0; */ public static int indexOfLastElement(List<?> list) { Assert.notNull(list, "Argument List<?> must not be null."); return list.size() == 0 ? 0 : list.size() - 1; }
public String getLocation() { String location = getHomeRepo(); if (Strings.isNullOrEmpty(location)) { location = getGitRepo(); } if (Strings.isNullOrEmpty(location)) { location = "Unknown"; } return location; }
/** * Return the the last element of this List, if any. If the list contains elements, return the element at index: * "size - 1", if the list is empty, return null; */ public static <T> T lastElement(List<T> list) { Assert.notNull(list, "Argument List<?> must not be null."); if (list.isEmpty()) return null; return list.get(list.size() - 1); } }
/** * Install the given facet without prompting for confirmation */ public InstallFacets(final Class<? extends Facet> facetType) { Assert.notNull(facetType, "Facet type may not be null."); this.facetTypes = new ArrayList<Class<? extends Facet>>(); facetTypes.add(facetType); }
/** * Install the given facet without prompting for confirmation */ public RemoveFacets(final Class<? extends Facet> facetType) { Assert.notNull(facetType, "Facet type may not be null."); this.facetTypes = new ArrayList<Class<? extends Facet>>(); facetTypes.add(facetType); }
public static boolean isApiCompatible(CharSequence runtimeVersion, PluginEntry entry) { Assert.notNull(runtimeVersion, "Runtime API version must not be null."); Assert.notNull(entry, "Plugin entry must not be null."); String pluginApiVersion = entry.getApiVersion(); Assert.notNull(pluginApiVersion, "Plugin entry.getApiVersion() must not be null."); return isApiCompatible(runtimeVersion, pluginApiVersion); }