List of usage examples for java.lang Class getCanonicalName
public String getCanonicalName()
From source file:com.grizzly.rest.WebServiceFactory.java
public <T, X> GenericRestCall<T, X> getGenericRestCallInstance(Class<T> entityClass, Class<X> responseClass, boolean isTest) { GenericRestCall<T, X> myRestCall = null; if (isTest) { myRestCall = new GenericRestCall<>(entityClass, responseClass, 1); } else {//from ww w .ja v a 2s . c o m myRestCall = new GenericRestCall<>(entityClass, responseClass); } try { if (context != null) { myRestCall.setContext(getContext()); if (!responseClass.getCanonicalName().equalsIgnoreCase(Void.class.getCanonicalName())) { String uuid = UUID.randomUUID().toString(); if (cachedRequests.containsKey(myRestCall.getUrl())) { uuid = cachedRequests.get(myRestCall.getUrl()); } myRestCall.setCachedFileName(uuid); cachedRequests.put(myRestCall.getUrl(), uuid); } } } catch (NullPointerException e) { e.printStackTrace(); } return myRestCall; }
From source file:org.openqa.grid.internal.utils.SelfRegisteringRemote.java
public void startRemoteServer() throws Exception { System.setProperty("org.openqa.jetty.http.HttpRequest.maxFormContentSize", "0"); nodeConfig.validate();// w w w . jav a 2 s .c o m RemoteControlConfiguration remoteControlConfiguration = nodeConfig.getRemoteControlConfiguration(); try { final String CLIENT_TIMEOUT = "timeout"; final String BROWSER_TIMEOUT = "browserTimeout"; JSONObject hubParameters = getHubConfiguration(CLIENT_TIMEOUT, BROWSER_TIMEOUT); if (hubParameters.has(CLIENT_TIMEOUT)) { int timeout = hubParameters.getInt(CLIENT_TIMEOUT) / 1000; remoteControlConfiguration.setTimeoutInSeconds(timeout); } if (hubParameters.has(BROWSER_TIMEOUT)) { int browserTimeout = hubParameters.getInt(BROWSER_TIMEOUT); remoteControlConfiguration.setBrowserTimeoutInMs(browserTimeout); } } catch (Exception e) { log.warning("error getting the parameters from the hub. The node may end up with wrong timeouts." + e.getMessage()); } server = new SeleniumServer(remoteControlConfiguration); Server jetty = server.getServer(); String servletsStr = (String) nodeConfig.getConfiguration().get(GridNodeConfiguration.SERVLETS); if (servletsStr != null) { List<String> servlets = Arrays.asList(servletsStr.split(",")); HttpContext extra = new HttpContext(); extra.setContextPath("/extra"); ServletHandler handler = new ServletHandler(); handler.addServlet("/resources/*", ResourceServlet.class.getName()); for (String s : servlets) { Class<? extends Servlet> servletClass = ExtraServletUtil.createServlet(s); if (servletClass != null) { String path = "/" + servletClass.getSimpleName() + "/*"; String clazz = servletClass.getCanonicalName(); handler.addServlet(path, clazz); log.info("started extra node servlet visible at : http://xxx:" + nodeConfig.getConfiguration().get(RegistrationRequest.PORT) + "/extra" + path); } } extra.addHandler(handler); jetty.addContext(extra); } server.boot(); }
From source file:net.famzangl.minecraft.minebot.ai.command.CommandRegistry.java
private void getCommandsForClass(Class<?> commandClass, List<CommandDefinition> commands) { for (final Method m : commandClass.getMethods()) { if (Modifier.isStatic(m.getModifiers()) && m.isAnnotationPresent(AICommandInvocation.class)) { LOGGER.debug(MARKER_REGISTER, "Registering method: %s#%s()", commandClass.getCanonicalName(), m.getName());//from www. j a v a 2 s . c om commands.addAll(getCommandsForMethod(m)); } } }
From source file:com.garethahealy.camelmapstruct.converter.MapStructTypeConverter.java
private String findMethodName(Class<?> from, Class<?> to) throws IllegalAccessException { String methodName;/*from w ww. j a va2 s. c o m*/ Table<Class<?>, Class<?>, String> resolved = configuration.getResolvedMappingMethods(); if (resolved.containsRow(from) && resolved.containsColumn(to)) { methodName = resolved.get(from, to); } else { String innerMessage = "Did'nt find method on mapper " + mapper.getClass().getCanonicalName() + " that container a parameter of " + from.getCanonicalName() + "; Found possible matches: " + StringUtils.join(resolved.values(), ", "); LOG.error(innerMessage); throw new IllegalAccessException(innerMessage); } return methodName; }
From source file:com.sonicle.webtop.core.app.ComponentsManager.java
public RecipientsProviderBase instantiateRecipientsProvider(Class<RecipientsProviderBase> clazz) { try {//from w ww. ja v a 2s . c o m //Constructor<RecipientsProviderBase> constructor = clazz.getConstructor(IConnectionProvider.class, IServiceSettingReader.class); //return constructor.newInstance(wta.getConnectionManager(), wta.getSettingsManager()); return (RecipientsProviderBase) clazz.newInstance(); } catch (Exception ex) { logger.error("Error instantiating RecipientsProvider [{}]", clazz.getCanonicalName(), ex); throw new WTRuntimeException("Error instantiating RecipientsProvider [{0}]", clazz.getCanonicalName()); } }
From source file:info.archinnov.achilles.entity.parsing.EmbeddedIdParser.java
private int validateNoDuplicateOrderAndType(String embeddedIdClassName, Set<Integer> orders, int orderSum, int order, Class<?> componentType) { Validator.validateBeanMappingTrue(orders.add(order), "The order '%s' is duplicated in @EmbeddedId class '%s'", order, embeddedIdClassName); orderSum += order;/*from w w w . j a v a 2s.co m*/ PropertyParsingValidator.validateAllowedTypes(componentType, PropertyHelper.allowedTypes, "The class '" + componentType.getCanonicalName() + "' is not a valid component type for the @EmbeddedId class '" + embeddedIdClassName + "'"); return orderSum; }
From source file:android.databinding.tool.LayoutXmlProcessor.java
public void writeInfoClass(/*Nullable*/ File sdkDir, File xmlOutDir, File exportClassListTo, boolean enableDebugLogs, boolean printEncodedErrorLogs) { final String sdkPath = sdkDir == null ? null : StringEscapeUtils.escapeJava(sdkDir.getAbsolutePath()); final Class annotation = BindingBuildInfo.class; final String layoutInfoPath = StringEscapeUtils.escapeJava(xmlOutDir.getAbsolutePath()); final String exportClassListToPath = exportClassListTo == null ? "" : StringEscapeUtils.escapeJava(exportClassListTo.getAbsolutePath()); String classString = "package " + RESOURCE_BUNDLE_PACKAGE + ";\n\n" + "import " + annotation.getCanonicalName() + ";\n\n" + "@" + annotation.getSimpleName() + "(buildId=\"" + mBuildId + "\", " + "modulePackage=\"" + mResourceBundle.getAppPackage() + "\", " + "sdkRoot=" + "\"" + (sdkPath == null ? "" : sdkPath) + "\"," + "layoutInfoDir=\"" + layoutInfoPath + "\"," + "exportClassListTo=\"" + exportClassListToPath + "\"," + "isLibrary=" + mIsLibrary + "," + "minSdk=" + mMinSdk + "," + "enableDebugLogs=" + enableDebugLogs + "," + "printEncodedError=" + printEncodedErrorLogs + ")\n" + "public class " + CLASS_NAME + " {}\n"; mFileWriter.writeToFile(RESOURCE_BUNDLE_PACKAGE + "." + CLASS_NAME, classString); }
From source file:org.querybyexample.jpa.GenericRepository.java
/** * This constructor needs the real type of the generic type E so it can be * given to the {@link EntityManager}.//from www .j a v a2 s . c o m * @param type */ public GenericRepository(Class<E> type) { this.type = type; this.log = LoggerFactory.getLogger(getClass()); this.cacheRegion = type.getCanonicalName(); entityManager = Persistence.createEntityManagerFactory(PersistencyConfig.PERSISTANCE_UNIT_NAME) .createEntityManager(); byExampleUtil = new ByExampleUtil(); orderByUtil = new OrderByUtil(); }
From source file:info.archinnov.achilles.entity.parsing.EmbeddedIdParser.java
private Constructor<?> getDefaultConstructor(Class<?> embeddedIdClass) { @SuppressWarnings({ "rawtypes", "unchecked" }) Set<Constructor> defaultConstructors = getAllConstructors(embeddedIdClass, withParametersCount(0)); Validator.validateBeanMappingFalse(defaultConstructors.isEmpty(), "The @EmbeddedId class '%s' should have a public default constructor", embeddedIdClass.getCanonicalName()); return defaultConstructors.iterator().next(); }
From source file:me.st28.flexseries.flexcore.plugin.FlexPlugin.java
/** * @return the current status for a module registered for this plugin. * @throws java.lang.IllegalArgumentException Thrown if the module is not registered under this plugin. *//*from w w w. j a va2 s . c om*/ public final ModuleStatus getModuleStatus(Class<? extends FlexModule> module) { if (!moduleStatuses.containsKey(module)) { throw new IllegalArgumentException("Module with class '" + module.getCanonicalName() + "' is not registered underneath this plugin."); } return moduleStatuses.get(module); }