List of usage examples for java.lang String getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.rmn.qa.servlet.StatusServlet.java
private String prettyHtmlPrint(GridHubConfiguration config) { StringBuilder b = new StringBuilder(); b.append(key("host")).append(config.host).append("</br>"); b.append(key("port")).append(config.port).append("</br>"); b.append(key("cleanUpCycle")).append(config.cleanUpCycle).append("</br>"); b.append(key("timeout")).append(config.timeout).append("</br>"); b.append(key("browserTimeout")).append(config.browserTimeout).append("</br>"); b.append(key("newSessionWaitTimeout")).append(config.newSessionWaitTimeout).append("</br>"); //no grid1mapping //b.append(key("grid1Mapping")).append(config.getGrid1Mapping()).append("</br>"); b.append(key("throwOnCapabilityNotPresent")).append(config.throwOnCapabilityNotPresent).append("</br>"); b.append(key("capabilityMatcher")).append( config.capabilityMatcher == null ? "null" : config.capabilityMatcher.getClass().getCanonicalName()) .append("</br>"); b.append(key("prioritizer")) .append(config.prioritizer == null ? "null" : config.prioritizer.getClass().getCanonicalName()) .append("</br>"); b.append(key("servlets")); for (String s : config.servlets) { b.append(s.getClass().getCanonicalName()).append(","); }// ww w . j ava 2 s. c o m b.append("</br></br>"); b.append("<u>all customs :</u></br></br>"); List<String> keys = new ArrayList<String>(); keys.addAll(config.custom.keySet()); Collections.sort(keys); for (String s : keys) { b.append(key(s.replaceFirst("-", ""))).append(config.custom.get(s)).append("</br>"); } b.append("</br>"); return b.toString(); }
From source file:org.kalypso.metadoc.ui.FileSelectionWizardPage.java
/** * Returns the name of a container with a location that encompasses targetDirectory. Returns null if there is no * conflict./* www. j a v a2s. c o m*/ * * @param targetDirectory * the path of the directory to check. * @return the conflicting container name or <code>null</code> */ protected boolean isContainerConflicting(final String targetDirectory) { targetDirectory.getClass(); // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // IPath testPath = new Path( targetDirectory ); // // if( root.getLocation().isPrefixOf( testPath ) ) // return true; // // IProject[] projects = root.getProjects(); // // for( int i = 0; i < projects.length; i++ ) // { // if( projects[i].getLocation().isPrefixOf( testPath ) ) // return true; // } // return false; }
From source file:ro.pippo.csv.CsvEngine.java
public Object objectFromString(String value, Class<?> objectClass) throws ParseException { if (value == null) { return null; } else if (objectClass.isAssignableFrom(value.getClass())) { return value; }/*w w w .j a va2 s . c o m*/ // re-use the infinitely useful ParameterValue class ParameterValue pv = new ParameterValue(value); if (objectClass.isEnum()) { return pv.toEnum((Class) objectClass); } else if (java.sql.Date.class.isAssignableFrom(objectClass)) { return pv.toSqlDate(); } else if (java.sql.Time.class.isAssignableFrom(objectClass)) { return pv.toSqlTime(); } else if (java.sql.Timestamp.class.isAssignableFrom(objectClass)) { return pv.toSqlTimestamp(); } else if (Date.class.isAssignableFrom(objectClass)) { return pv.toDate(datePattern); } return pv.to(objectClass); }
From source file:fr.cls.atoll.motu.processor.wps.StringList.java
public static void testCreateObject() { Class<?> clazz = null;//from ww w.ja v a 2s. c o m Class<?> clazzTemp = null; Constructor<?> ctor = null; try { Object[] values = { "it's a string", true, new BigDecimal(125489.365), DateUtils.stringToDateTime("2007-10-05"), new DateTime(125236636), new Period(6539), DateUtils.stringToPeriod("P5Y2M10DT15H"), new URI("http://www.w3schools.com/Schema/schema_dtypes_date.asp"), 125639, 4526L, 4253.635, (short) 25, 125.36f, (byte) 'a', }; for (Object value : values) { Object object = null; String valueString = value.toString(); clazz = value.getClass(); clazzTemp = valueString.getClass(); if (DateTime.class.equals(clazz)) { object = DateUtils.stringToDateTime(valueString); } else if (Period.class.equals(clazz)) { object = DateUtils.stringToPeriod(valueString); } else { ctor = clazz.getConstructor(clazzTemp); object = ctor.newInstance(valueString); } // System.out.print(value.getClass().getName()); System.out.print(object.getClass().getName()); System.out.print(" --> "); System.out.println(object); } } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MotuConverterException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.jaxygen.http.HttpRequestParser.java
@Override public List<?> getAsEnums(String name, Class<?> clazz) throws InvalidRequestParameter { List<String> names = getAsListOfStrings(name); List<Object> rc = new ArrayList<Object>(); try {//from ww w . j a va 2s . c o m for (String value : names) { if (value != null && value.length() > 0) { Method m = clazz.getDeclaredMethod("valueOf", value.getClass()); Object e = m.invoke(null, value); rc.add(e); } } } catch (Exception e) { throw new InvalidRequestParameter(name); } return rc; }
From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithArrayTest.java
@Test public void testConfigurationPropertiesWithStringArray() { ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); String stringValue = config.stringArray[0]; assertEquals(String.class, stringValue.getClass()); assertEquals("Test", stringValue); assertEquals(3, config.stringArray.length); }
From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithArrayTest.java
@Test public void testConfigurationXMLWithStringArray() { ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); String stringValue = config.stringArray[0]; assertEquals(String.class, stringValue.getClass()); assertEquals("Test", stringValue); assertEquals(3, config.stringArray.length); }
From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithListTest.java
@Test public void testConfigurationPropertiesWithStringList() { ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); String stringValue = config.stringList.get(0); assertEquals(String.class, stringValue.getClass()); assertEquals("Test", stringValue); assertEquals(3, config.stringList.size()); }
From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithListTest.java
@Test public void testConfigurationXMLWithStringList() { ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); String stringValue = config.stringList.get(0); assertEquals(String.class, stringValue.getClass()); assertEquals("Test", stringValue); assertEquals(3, config.stringList.size()); }
From source file:org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginH2Dao.java
public PipelineMavenPluginH2Dao(String jdbcUrl, String username, String password) { jdbcUrl.getClass(); // check non null username.getClass(); // check non null password.getClass(); // check non null this.jdbcConnectionPool = JdbcConnectionPool.create(jdbcUrl, username, password); LOGGER.log(Level.FINE, "Open database {0}", jdbcUrl); initializeDatabase();/* w w w .j a v a2 s . c o m*/ }