List of usage examples for org.springframework.util ObjectUtils nullSafeToString
public static String nullSafeToString(@Nullable short[] array)
From source file:com.frank.search.solr.core.query.result.SimpleStatsResult.java
@Override public String getMinAsString() { return ObjectUtils.nullSafeToString(min); }
From source file:org.pentaho.springdm.extender.ApplicationContextCreator.java
public DelegatedExecutionOsgiBundleApplicationContext createApplicationContext(BundleContext bundleContext) throws Exception { Bundle bundle = bundleContext.getBundle(); ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle, this.configurationScanner); if (log.isTraceEnabled()) { log.trace("Created configuration " + config + " for bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle)); }//from w w w . j a v a2s.c o m if (!config.isSpringPoweredBundle()) { return null; } else { log.info("Discovered configurations " + ObjectUtils.nullSafeToString(config.getConfigurationLocations()) + " in bundle [" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "]"); PentahoOsgiBundleXmlApplicationContext sdoac = new PentahoOsgiBundleXmlApplicationContext( config.getConfigurationLocations()); sdoac.setBundleContext(bundleContext); sdoac.setPublishContextAsService(config.isPublishContextAsService()); return sdoac; } }
From source file:org.okj.commons.web.taglib.template.impl.RadioTemplate.java
/** * @see com.lakala.bmcp.tags.template.impl.SelectOptionsTemplate#createOptions() *//*w w w .j a v a 2s . com*/ @Override protected String createOptions() { List<KeyValue> options = getOptions(); StringBuffer sb = new StringBuffer(); if (options != null && options.size() > 0) { for (int i = 0, n = options.size(); i < n; i++) { sb.append("<input type=\"radio\" "); if (StringUtils.isNotBlank(attribute.getId())) { sb.append("id=\"").append(attribute.getId()).append("_" + i).append("\" "); } sb.append("name=\"").append(attribute.getName()).append("\" "); if (StringUtils.isNotBlank(attribute.getStyleClass())) { sb.append("class=\"").append(attribute.getStyleClass()).append("\" "); } if (StringUtils.isNotBlank(attribute.getStyle())) { sb.append("style=\"").append(attribute.getStyle()).append("\" "); } if (StringUtils.isNotBlank(attribute.getOnclick())) { sb.append("onclick=\"").append(attribute.getOnclick()).append("\" "); } KeyValue keyValue = options.get(i); sb.append(" value=\"").append(keyValue.getValue()); String str = ObjectUtils.nullSafeToString(attribute.getValue()); if (StringUtils.isNotBlank(str) && StringUtils.equalsIgnoreCase(str, String.valueOf(keyValue.getValue()))) { sb.append("\" checked=\"true\" />"); } else { sb.append("\"/>"); } sb.append("<label for=\"").append(attribute.getId()).append("_" + i).append("\">"); sb.append(keyValue.getKey()).append("</label>"); } } return sb.toString(); }
From source file:net.solarnetwork.spring.osgi.NonValidatingOsgiApplicationContextCreator.java
@Override public DelegatedExecutionOsgiBundleApplicationContext createApplicationContext(BundleContext bundleContext) throws Exception { Bundle bundle = bundleContext.getBundle(); ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle, configurationScanner); if (log.isTraceEnabled()) { log.trace("Created configuration " + config + " for bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle)); }/*from w ww. ja va 2 s. c om*/ if (!config.isSpringPoweredBundle()) { return null; } log.info("Discovered configurations " + ObjectUtils.nullSafeToString(config.getConfigurationLocations()) + " in bundle [" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "]"); DelegatedExecutionOsgiBundleApplicationContext sdoac = new NonValidatingOsgiBundleXmlApplicationContext( config.getConfigurationLocations()); sdoac.setBundleContext(bundleContext); sdoac.setPublishContextAsService(config.isPublishContextAsService()); return sdoac; }
From source file:com.frank.search.solr.core.query.result.SimpleStatsResult.java
@Override public String getMaxAsString() { return ObjectUtils.nullSafeToString(max); }
From source file:cyrille.xml.xsd.XsomXsdParserSample.java
protected void dumpElementDeclration(XSElementDecl elementDeclaration, String indentation) { XSType type = elementDeclaration.getType(); String documentation = getDocumentation(elementDeclaration); // TODO DISABLE documentation = StringUtils.replace(documentation, "\n", "<br/>"); if (type.isComplexType()) { XSComplexType currentComplexType = type.asComplexType(); // ATTRIBUTES String valueType = null;//from w w w.jav a2 s .c o m Boolean required = null; String defaultValue = null; XSAttributeUse valueAttributeUse = currentComplexType.getAttributeUse("", "value"); if (valueAttributeUse != null) { XSAttributeDecl valueAttributeDeclaration = valueAttributeUse.getDecl(); valueType = valueAttributeDeclaration.getType().getName(); required = valueAttributeUse.isRequired(); defaultValue = ObjectUtils.nullSafeToString(valueAttributeUse.getDefaultValue()); } System.out.println(indentation + "|| *{{{" + elementDeclaration.getName() + "}}}* || " + valueType + " || " + required + " || " + defaultValue + " || " + documentation + " ||"); XSContentType currentContentType = currentComplexType.getContentType(); XSParticle currentParticle = currentContentType.asParticle(); if (currentParticle == null) { System.out.println("skip "); } else { XSTerm term = currentParticle.getTerm(); if (term.isModelGroup()) { XSModelGroup modelGroup = term.asModelGroup(); for (XSParticle particle : modelGroup.getChildren()) { XSTerm particleTerm = particle.getTerm(); if (particleTerm.isElementDecl()) { // xs:element inside complex type dumpElementDeclration(particleTerm.asElementDecl(), indentation + " "); } } } } } else { System.out.println(indentation + elementDeclaration.getName() + " " + documentation); } }
From source file:org.eclipse.gemini.blueprint.test.parsing.DifferentParentsInDifferentBundlesTest.java
private Manifest getParsedManifestFor(CaseWithVisibleMethodsBaseTest testCase) throws Exception { System.out.println(ObjectUtils.nullSafeToString(testCase.getBundleContentPattern())); Field jarSettings = AbstractConfigurableBundleCreatorTests.class.getDeclaredField("jarSettings"); // initialize settings jarSettings.setAccessible(true);/*from ww w. ja v a 2s.c om*/ jarSettings.set(null, testCase.getSettings()); Manifest mf = testCase.getManifest(); return mf; }
From source file:org.okj.commons.web.taglib.template.impl.SelectOptionsTemplate.java
/** * selectoptions/* w w w. j ava 2s .co m*/ * @return * @throws Exception */ protected String createOptions() { List<KeyValue> options = getOptions(); StringBuffer sb = new StringBuffer(); boolean alreadySelected = false;// option if (attribute.getHeaderValue() != null && attribute.getHeaderKey() != null) { sb.append("<option value=\"").append(attribute.getHeaderValue()).append("\">") .append(attribute.getHeaderKey()).append("</option>"); } if (options != null && options.size() > 0) { for (int i = 0, n = options.size(); i < n; i++) { KeyValue keyValue = options.get(i); sb.append("<option value=\"").append(keyValue.getValue()); String str = ObjectUtils.nullSafeToString(attribute.getValue()); if (StringUtils.isNotBlank(str) && StringUtils.equalsIgnoreCase(str, String.valueOf(keyValue.getValue())) && !alreadySelected) { sb.append("\" selected >"); alreadySelected = true; } else { sb.append("\">"); } sb.append(keyValue.getKey()).append("</option>"); } } return sb.toString(); }
From source file:spring.osgi.utils.OsgiStringUtils.java
/** * Returns a String representation of the given * <code>ServiceReference</code>. * * @param reference OSGi service reference (can be <code>null</code>) * @return String representation of the given service reference *///ww w.j ava2s . co m public static String nullSafeToString(ServiceReference reference) { if (reference == null) return NULL_STRING; StringBuilder buf = new StringBuilder(); Bundle owningBundle = reference.getBundle(); buf.append("ServiceReference [").append(OsgiStringUtils.nullSafeSymbolicName(owningBundle)).append("] "); String clazzes[] = (String[]) reference.getProperty(org.osgi.framework.Constants.OBJECTCLASS); buf.append(ObjectUtils.nullSafeToString(clazzes)); buf.append("={"); String[] keys = reference.getPropertyKeys(); for (int i = 0; i < keys.length; i++) { if (!org.osgi.framework.Constants.OBJECTCLASS.equals(keys[i])) { buf.append(keys[i]).append('=').append(reference.getProperty(keys[i])); if (i < keys.length - 1) { buf.append(','); } } } buf.append('}'); return buf.toString(); }
From source file:org.testng.spring.test.AbstractSpringContextTests.java
/** * Subclasses can override this to return a String representation of * their context key for use in logging. * @param contextKey the context key//w w w. j a v a 2 s.c o m */ protected String contextKeyString(Object contextKey) { return ObjectUtils.nullSafeToString(contextKey); }