List of usage examples for java.util Objects toString
public static String toString(Object o)
From source file:de.monticore.io.paths.ModelCoordinateImpl.java
@Override public String toString() { return "Location: " + Objects.toString(location) + " Package: " + Objects.toString(qualifiedPath); }
From source file:org.dspace.app.rest.DiscoveryRestController.java
@RequestMapping(method = RequestMethod.GET, value = "/search/objects") public SearchResultsResource getSearchObjects(@RequestParam(name = "query", required = false) String query, @RequestParam(name = "dsoType", required = false) String dsoType, @RequestParam(name = "scope", required = false) String dsoScope, @RequestParam(name = "configuration", required = false) String configurationName, List<SearchFilter> searchFilters, Pageable page) throws Exception { if (log.isTraceEnabled()) { log.trace("Searching with scope: " + StringUtils.trimToEmpty(dsoScope) + ", configuration name: " + StringUtils.trimToEmpty(configurationName) + ", dsoType: " + StringUtils.trimToEmpty(dsoType) + ", query: " + StringUtils.trimToEmpty(dsoType) + ", filters: " + Objects.toString(searchFilters) + ", page: " + Objects.toString(page)); }//w w w . ja v a 2s . c o m //Get the Search results in JSON format SearchResultsRest searchResultsRest = discoveryRestRepository.getSearchObjects(query, dsoType, dsoScope, configurationName, searchFilters, page); //Convert the Search JSON results to paginated HAL resources SearchResultsResource searchResultsResource = new SearchResultsResource(searchResultsRest, utils, page); halLinkService.addLinks(searchResultsResource, page); return searchResultsResource; }
From source file:org.apache.logging.log4j.util.Strings.java
/** * <p>Joins the elements of the provided {@code Iterator} into * a single String containing the provided elements.</p> * * <p>No delimiter is added before or after the list. Null objects or empty * strings within the iteration are represented by empty strings.</p> * * @param iterator the {@code Iterator} of values to join together, may be null * @param separator the separator character to use * @return the joined String, {@code null} if null iterator input *///from w w w . ja va 2 s. c om public static String join(final Iterator<?> iterator, final char separator) { // handle null, zero and one elements before building a buffer if (iterator == null) { return null; } if (!iterator.hasNext()) { return EMPTY; } final Object first = iterator.next(); if (!iterator.hasNext()) { return Objects.toString(first); } // two or more elements final StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small if (first != null) { buf.append(first); } while (iterator.hasNext()) { buf.append(separator); final Object obj = iterator.next(); if (obj != null) { buf.append(obj); } } return buf.toString(); }
From source file:com.github.benmanes.caffeine.cache.testing.CacheValidationListener.java
/** Free memory by clearing unused resources after test execution. */ private void cleanUp(ITestResult testResult) { Object[] params = testResult.getParameters(); for (int i = 0; i < params.length; i++) { Object param = params[i]; if ((param instanceof AsyncLoadingCache<?, ?>) || (param instanceof Cache<?, ?>) || (param instanceof Map<?, ?>)) { params[i] = param.getClass().getSimpleName(); } else {//from ww w . ja v a 2s . c o m params[i] = Objects.toString(param); } } CacheSpec.interner.remove(); }
From source file:de.tiqsolutions.hdfs.HadoopFileSystemProvider.java
static void rethrowRemoteException(RemoteException e, Path p1, Path p2) throws IOException { switch (e.getClassName()) { case "org.apache.hadoop.fs.PathIsNotEmptyDirectoryException": throw new DirectoryNotEmptyException(p1.toString()); case "org.apache.hadoop.fs.PathExistsException": case "org.apache.hadoop.fs.FileAlreadyExistsException": throw new FileAlreadyExistsException(Objects.toString(p1), Objects.toString(p2), e.getLocalizedMessage()); case "org.apache.hadoop.fs.PathPermissionException": case "org.apache.hadoop.fs.PathAccessDeniedException": throw new AccessDeniedException(Objects.toString(p1), Objects.toString(p2), e.getLocalizedMessage()); case "org.apache.hadoop.fs.ParentNotDirectoryException": case "org.apache.hadoop.fs.DirectoryListingStartAfterNotFoundException": case "org.apache.hadoop.fs.PathIsNotDirectoryException": throw new NotDirectoryException(Objects.toString(p1)); case "org.apache.hadoop.fs.PathIsDirectoryException": case "org.apache.hadoop.fs.InvalidPathException": case "org.apache.hadoop.fs.PathNotFoundException": throw new NoSuchFileException(Objects.toString(p1), Objects.toString(p2), e.getLocalizedMessage()); case "org.apache.hadoop.fs.UnresolvedLinkException": throw new NotLinkException(Objects.toString(p1), Objects.toString(p2), e.getLocalizedMessage()); case "org.apache.hadoop.fs.PathIOException": case "org.apache.hadoop.fs.ChecksumException": case "org.apache.hadoop.fs.InvalidRequestException": case "org.apache.hadoop.fs.UnsupportedFileSystemException": case "org.apache.hadoop.fs.ZeroCopyUnavailableException": }/*from w ww. j a v a 2 s . co m*/ throw new IOException(e.getLocalizedMessage(), e); }
From source file:com.github.technosf.posterer.models.RequestBean.java
/** * Create a hashcode for the {@code Request} * //from w ww . j a v a 2 s . c o m * @param request * @return */ private static int hashCode(final RequestData request) { return Objects.hash(Objects.toString(request.getEndpoint()), Objects.toString(request.getPayload()), Objects.toString(request.getMethod()), Objects.toString(request.getContentType()), Objects.toString(request.getBase64()), Objects.toString(request.getHttpUser()), Objects.toString(request.getHttpPassword())); }
From source file:com.github.technosf.posterer.models.impl.ProxyBean.java
/** * Create a hashcode for the {@code Proxy} * /*from w w w.jav a2 s . co m*/ * @param proxy * @return */ private static int hashCode(final @Nullable Proxy proxy) { if (proxy == null) { return 0; } return Objects.hash(Objects.toString(proxy.getProxyHost()), Objects.toString(proxy.getProxyPort()), Objects.toString(proxy.getProxyUser()), Objects.toString(proxy.getProxyPassword())); }
From source file:org.openepics.discs.conf.webservice.InstallationSlotResourceImpl.java
private PropertyValue createPropertyValue(final org.openepics.discs.conf.ent.PropertyValue slotPropertyValue) { final PropertyValue propertyValue = new PropertyValue(); final Property parentProperty = slotPropertyValue.getProperty(); propertyValue.setName(parentProperty.getName()); propertyValue/*w ww . j av a 2 s . c o m*/ .setDataType(parentProperty.getDataType() != null ? parentProperty.getDataType().getName() : null); propertyValue.setUnit(parentProperty.getUnit() != null ? parentProperty.getUnit().getName() : null); propertyValue.setValue(Objects.toString(slotPropertyValue.getPropValue())); if (slotPropertyValue instanceof ComptypePropertyValue) { propertyValue.setPropertyKind(PropertyKind.TYPE); } else if (slotPropertyValue instanceof SlotPropertyValue) { propertyValue.setPropertyKind(PropertyKind.SLOT); } else if (slotPropertyValue instanceof DevicePropertyValue) { propertyValue.setPropertyKind(PropertyKind.DEVICE); } else { throw new UnhandledCaseException(); } return propertyValue; }
From source file:org.dspace.services.sessions.StatelessRequestServiceImpl.java
/** * (non-Javadoc)//from ww w.ja va 2 s. c o m * * @see org.dspace.services.RequestService#getCurrentUserId() */ public String getCurrentUserId() { Request currentRequest = getCurrentRequest(); if (currentRequest == null) { return null; } else { return Objects.toString(currentRequest.getAttribute(AUTHENTICATED_EPERSON)); } }
From source file:de.micromata.genome.tpsb.httpmockup.MockHttpServletResponse.java
@Override public String getHeader(final String name) { List<Object> hd = headers.get(name); if (hd != null && hd.isEmpty() == false) { return Objects.toString(hd.get(0)); }/*from w ww. j a v a2 s. c o m*/ return null; }