List of usage examples for java.lang Class getCanonicalName
public String getCanonicalName()
From source file:eu.dasish.annotation.backend.rest.ResourceJaxbMarshallerProvider.java
@Override public Marshaller getContext(Class<?> type) { try {//from w w w . j a v a2 s.c o m return jaxbMarshallerFactory.createMarshaller(type); } catch (JAXBException e) { System.out.println("Cannot create a marshaller for type " + type.getCanonicalName()); return null; } }
From source file:com.rosenvold.spring.SpringContextAnalyzer.java
private boolean isSpringFrameworkClass(Class clazz) { return clazz.getCanonicalName().startsWith("org.springframework"); }
From source file:com.intuit.tank.project.EntityVersion.java
/** * @param objectId/* w w w . j a va2 s . co m*/ * @param versionId * @param objectClass */ public EntityVersion(int objectId, int versionId, @Nonnull Class<? extends BaseEntity> objectClass) { this.objectId = objectId; this.versionId = versionId; this.objectClass = objectClass.getCanonicalName(); }
From source file:capital.scalable.restdocs.constraints.ConstraintReaderImpl.java
private List<String> getEnumConstraintMessage(Class<?> javaBaseClass, String javaFieldName) { // could be getter actually Field field = findField(javaBaseClass, javaFieldName); if (field == null) { return emptyList(); }/* ww w . j a va2s .c o m*/ Class<?> rawClass = field.getType(); if (!rawClass.isEnum()) { return emptyList(); } Class<Enum> enumClass = (Class<Enum>) rawClass; String value = arrayToString(enumClass.getEnumConstants()); String enumName = enumClass.getCanonicalName(); String message = constraintDescriptionResolver .resolveDescription(new Constraint(enumName, singletonMap(VALUE, (Object) value))); // fallback if (isBlank(message) || message.equals(enumName)) { message = "Must be one of " + value; } return singletonList(message); }
From source file:com.linkedin.restli.tools.idlgen.RestLiDoclet.java
/** * Query Javadoc {@link ClassDoc} for the specified resource class. * * @param resourceClass resource class to be queried * @return corresponding {@link ClassDoc} *//*w w w.j a v a 2s.c o m*/ public ClassDoc getClassDoc(Class<?> resourceClass) { return _docInfo.getClassDoc(resourceClass.getCanonicalName()); }
From source file:com.cognifide.aemrules.extensions.RulesLoader.java
private RulesDefinition.NewRule loadRule(RulesDefinition.NewExtendedRepository repo, Class<? extends JavaCheck> clazz, Rule ruleAnnotation) { String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName()); String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null); String description = StringUtils.defaultIfEmpty(getDescriptionFromResources(ruleKey), "No description yet."); RulesDefinition.NewRule rule = repo.createRule(ruleKey); rule.setName(ruleName).setMarkdownDescription(description); rule.setSeverity(ruleAnnotation.priority().name()); rule.setStatus(RuleStatus.valueOf(ruleAnnotation.status())); rule.setTags(ruleAnnotation.tags()); List<Field> fields = FieldUtils2.getFields(clazz, true); for (Field field : fields) { loadParameters(rule, field);// w w w. j av a 2 s .c om } return rule; }
From source file:org.jtalks.common.security.DtoLookupStrategy.java
/** * This method returns {@link ObjectIdentity} mapped to provided one using the following logic: * <ul>/*from w w w. j a va 2 s .com*/ * <li>If no mapping found for the identity type, same object is returned;</li> * <li>Instead, a new {@link ObjectIdentity} is created with the type mapped to the type of the original * identity and with the same identifier.</li> * </ul> * * @param identity Original identity * @return Mapped identity as described above. */ private ObjectIdentity getMappedIdentity(ObjectIdentity identity) { ObjectIdentity result = identity; String identityClass = identity.getType(); Class identityMappedTo = mapper.getMapping(identityClass); if (identityMappedTo != null) { result = new ObjectIdentityImpl(identityMappedTo.getCanonicalName(), identity.getIdentifier()); } return result; }
From source file:com.openkm.servlet.admin.UnitTestingServlet.java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { log.debug("doGet({}, {})", request, response); String test = WebUtils.getString(request, "test"); response.setContentType("text/html; charset=UTF-8"); response.setCharacterEncoding("UTF-8"); OutputStream os = response.getOutputStream(); PrintStream ps = new PrintStream(os); header(ps, "Unit testing", breadcrumb); ps.flush();// w w w .j a va2 s .c o m RunListener listener = new CustomListener(ps); JUnitCore junit = new JUnitCore(); junit.addListener(listener); if (test != null && !test.isEmpty()) { try { Class<?> clazz = Class.forName(test); ps.println("<b>" + clazz.getCanonicalName() + "</b><br/>"); ps.flush(); ps.println("<pre>"); ps.flush(); junit.run(clazz); ps.println("</pre>"); ps.flush(); } catch (ClassNotFoundException e) { warn(ps, e.getMessage()); } } else { for (Class<?> clazz : new Reflections("com.openkm.test.api").getSubTypesOf(TestCase.class)) { ps.println("<a style=\"color: black; font-weight:bold;\" href=\"UnitTesting?test=" + clazz.getCanonicalName() + "\">" + clazz.getCanonicalName() + "</a><br/>"); ps.flush(); ps.println("<pre>"); ps.flush(); junit.run(clazz); ps.println("</pre>"); ps.flush(); } } ps.println( "<span style=\"color: blue; font-weight:bold;\">>>> End Of Unit Testing <<<</span>"); footer(ps); ps.flush(); IOUtils.closeQuietly(ps); IOUtils.closeQuietly(os); }
From source file:org.web4thejob.orm.EntityFactoryImpl.java
@Override @SuppressWarnings("unchecked") public <T extends Parameter> T buildParameter(Class<T> parameterType) { try {/* w w w . j a va2 s. com*/ return (T) ContextUtil.getBean(CustomSessionFactoryBean.class).getConfiguration() .getClassMapping(parameterType.getCanonicalName()).getMappedClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:AIR.Common.DB.SQL_TYPE_To_JAVA_TYPE.java
public boolean matchesMyJavaType(Class<?> javatype) { String t1 = javatype.getCanonicalName(); String t2 = _javaType.getCanonicalName(); if (StringUtils.equals(t1, t2)) { return true; }/*from w ww. j av a2s.c o m*/ return false; }