List of usage examples for java.lang Class getCanonicalName
public String getCanonicalName()
From source file:org.moserp.common.repository.SequenceService.java
public synchronized String getNextIt(Class<?> entityClass) { String key = entityClass.getCanonicalName(); Sequence sequence = mongoTemplate.findById(key, Sequence.class); if (sequence != null) { sequence.increment();//from w w w . java 2 s. co m } else { sequence = new Sequence(key, 0L); } mongoTemplate.save(sequence); log.debug("Next Sequence from " + key + ": " + sequence.getCurrent()); return sequence.getCurrent().toString(); }
From source file:me.preilly.Globals.java
public void panic(Class<?> c, Exception e) { LOGGER.debug(c.getCanonicalName() + ": " + e); System.exit(0); }
From source file:kieker.tools.bridge.cli.CLIServerMain.java
/** * Create a connector instance for the given class. * * @param connector//from w w w.jav a2 s .c om * the connector class * @param configuration * configuration for the connector * @param lookupEntityMap * lookup map * @return o connector instance * @throws CLIConfigurationErrorException * when the instantiation fails */ private static IServiceConnector createConnector(final Class<?> connector, final Configuration configuration, final ConcurrentMap<Integer, LookupEntity> lookupEntityMap) throws CLIConfigurationErrorException { try { return (IServiceConnector) connector.getConstructor(Configuration.class, ConcurrentMap.class) .newInstance(configuration, lookupEntityMap); } catch (final IllegalArgumentException e) { throw new CLIConfigurationErrorException( "Broken implementation of the selected connector " + connector.getCanonicalName(), e); } catch (final SecurityException e) { throw new CLIConfigurationErrorException( "Cannot access included classes " + connector.getCanonicalName(), e); } catch (final InstantiationException e) { throw new CLIConfigurationErrorException("Instantiation failed for " + connector.getCanonicalName(), e); } catch (final IllegalAccessException e) { throw new CLIConfigurationErrorException("Access prohibited to class " + connector.getCanonicalName(), e); } catch (final InvocationTargetException e) { throw new CLIConfigurationErrorException( "Broken implementation of the selected connector " + connector.getCanonicalName(), e); } catch (final NoSuchMethodException e) { throw new CLIConfigurationErrorException( "Broken implementation of the selected connector " + connector.getCanonicalName(), e); } }
From source file:service.DataLinkService.java
private String getNameByClass(Class cl) { return cl.getCanonicalName(); }
From source file:com.jaspersoft.studio.data.tools.mapping.BeanMappingTool.java
/** * Take a class and return the name of the type. If the name is * a primitive type, then the name of the wrapper is returned * //from w ww. j a v a 2 s. com * @param propertyType a not null property type * @return a class name */ private static String getClassName(Class<?> propertyType) { if (primitiveTypeMap == null) { primitiveTypeMap = new HashMap<String, String>(); primitiveTypeMap.put("byte", "java.lang.Byte"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("short", "java.lang.Short"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("int", "java.lang.Integer"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("long", "java.lang.Long"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("float", "java.lang.Float"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("double", "java.lang.Double"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("char", "java.lang.Character"); //$NON-NLS-1$ //$NON-NLS-2$ primitiveTypeMap.put("boolean", "java.lang.Boolean"); //$NON-NLS-1$ //$NON-NLS-2$ } String className = propertyType.getCanonicalName(); if (primitiveTypeMap.containsKey(className)) className = primitiveTypeMap.get(className); return className; }
From source file:com.himanshu.um.impl.db.dao.GenericDao.java
public List<T> findAll(Class<T> entityClass) { return em.createQuery("from " + entityClass.getCanonicalName()).getResultList(); }
From source file:forge.quest.io.QuestDataIO.java
@SuppressWarnings("unchecked") private static <T> T readAsset(final XStream xs, final Document doc, final String tagName, final Class<T> clasz) { final NodeList nn = doc.getElementsByTagName(tagName); final Node n = nn.item(0); final Attr att = doc.createAttribute("resolves-to"); att.setValue(clasz.getCanonicalName()); n.getAttributes().setNamedItem(att); final String xmlData = XmlUtil.nodeToString(n); return (T) xs.fromXML(xmlData); }
From source file:com.vmware.photon.controller.common.dcp.ServiceHostUtils.java
/** * Logs the contents of all factories on a host. * * @param host//from w w w . ja v a 2 s . c o m * @throws Throwable */ public static <H extends ServiceHost & DcpHostInfoProvider> void dumpHost(H host, String referrer) throws Throwable { logger.info(String.format("host: %s - %s", host.getId(), host.getPort())); for (Class factory : host.getFactoryServices()) { try { Operation op = Operation .createGet(UriUtils.buildExpandLinksQueryUri(UriUtils.buildUri(host, factory))); Operation result = sendRequestAndWait(host, op, referrer); logger.info(String.format("%s: %s: %s", host.getPort(), factory.getSimpleName(), Utils.toJson(result.getBodyRaw()))); } catch (Throwable ex) { logger.info(String.format("Could not get service: %s", factory.getCanonicalName())); } } }
From source file:com.thoughtworks.go.agent.common.util.ParentClassAccessFilteringClassloader.java
@Override protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (permittedParentDefns.length == 0) { return super.loadClass(name, false); }/* w ww. j a v a2s .c o m*/ for (Class permittedParentDefn : permittedParentDefns) { if (permittedParentDefn.getCanonicalName().equals(name)) { ClassLoader parent = getParent(); LOG.info(String.format("Loading %s using %s", name, parent == null ? "null classloader" : parent.getClass().getCanonicalName())); return super.loadClass(name, false); } } return getSystemClassLoader().loadClass(name); }
From source file:net.sf.taverna.platform.spring.RavenSpringIntegrationTest.java
@SuppressWarnings("unchecked") @Test//from w ww .ja va2 s . co m /** * Test compact form of repository specification and the spi registry bean * factory */ public void testSpiWithCompactContextForm() { ApplicationContext context = new RavenAwareClassPathXmlApplicationContext("applicationContext2.xml"); SpiRegistry spi = (SpiRegistry) context.getBean("spiBean"); System.out.println("SPI : " + spi.toString()); for (Class c : spi) { System.out.println(" " + c.getCanonicalName()); } System.out.println("Done SPI scan, " + spi.getClasses().size() + " implementation(s) found."); assertEquals(spi.getClasses().size(), 1); }