Tabnine Logo
Class.getTypeName
Code IndexAdd Tabnine to your IDE (free)

How to use
getTypeName
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getTypeName (Showing top 20 results out of 1,404)

origin: spring-projects/spring-framework

/**
 * Return the qualified name of the given class: usually simply
 * the class name, but component type class name + "[]" for arrays.
 * @param clazz the class
 * @return the qualified name of the class
 */
public static String getQualifiedName(Class<?> clazz) {
  Assert.notNull(clazz, "Class must not be null");
  return clazz.getTypeName();
}
origin: spring-projects/spring-framework

/**
 * Check whether the given class matches the user-specified type name.
 * @param clazz the class to check
 * @param typeName the type name to match
 */
public static boolean matchesTypeName(Class<?> clazz, @Nullable String typeName) {
  return (typeName != null &&
      (typeName.equals(clazz.getTypeName()) || typeName.equals(clazz.getSimpleName())));
}
origin: org.springframework/spring-core

/**
 * Return the qualified name of the given class: usually simply
 * the class name, but component type class name + "[]" for arrays.
 * @param clazz the class
 * @return the qualified name of the class
 */
public static String getQualifiedName(Class<?> clazz) {
  Assert.notNull(clazz, "Class must not be null");
  return clazz.getTypeName();
}
origin: org.junit.jupiter/junit-jupiter-engine

/**
 * Properties {@link #annotationType} and {@link #reason} are <b>not</b>
 * included on purpose. This allows more cache hits when using instances
 * of this class as keys in a hash map.
 */
private int computeHashCode() {
  return Objects.hash(annotationType.getTypeName(), engine, source);
}
origin: org.springframework/spring-core

/**
 * Check whether the given class matches the user-specified type name.
 * @param clazz the class to check
 * @param typeName the type name to match
 */
public static boolean matchesTypeName(Class<?> clazz, @Nullable String typeName) {
  return (typeName != null &&
      (typeName.equals(clazz.getTypeName()) || typeName.equals(clazz.getSimpleName())));
}
origin: spring-projects/spring-framework

/**
 * Return a descriptive name for the given object's type: usually simply
 * the class name, but component type class name + "[]" for arrays,
 * and an appended list of implemented interfaces for JDK proxies.
 * @param value the value to introspect
 * @return the qualified name of the class
 */
@Nullable
public static String getDescriptiveType(@Nullable Object value) {
  if (value == null) {
    return null;
  }
  Class<?> clazz = value.getClass();
  if (Proxy.isProxyClass(clazz)) {
    StringBuilder result = new StringBuilder(clazz.getName());
    result.append(" implementing ");
    Class<?>[] ifcs = clazz.getInterfaces();
    for (int i = 0; i < ifcs.length; i++) {
      result.append(ifcs[i].getName());
      if (i < ifcs.length - 1) {
        result.append(',');
      }
    }
    return result.toString();
  }
  else {
    return clazz.getTypeName();
  }
}
origin: apache/geode

private <T> T convertJdbcObjectToJavaType(Class<T> javaType, Object jdbcObject) {
 try {
  return javaType.cast(jdbcObject);
 } catch (ClassCastException classCastException) {
  throw JdbcConnectorException.createException("Could not convert "
    + jdbcObject.getClass().getTypeName() + " to " + javaType.getTypeName(),
    classCastException);
 }
}
origin: MovingBlocks/Terasology

private static boolean hasSenderAnnotation(Method method) {
  final Class[] paramTypes = method.getParameterTypes();
  final Annotation[][] paramAnnotations = method.getParameterAnnotations();
  for (int i = 0; i < paramAnnotations.length; i++) {
    if (paramTypes[i].getTypeName().equals(ENTITY_REF_NAME)) {
      if (paramAnnotations[i].length == 0) {
        return false;
      } else {
        for (Annotation annotation: paramAnnotations[i]) {
          if (annotation instanceof Sender) {
            return true;
          }
        }
      }
    }
  }
  return true;
}
origin: Graylog2/graylog2-server

private Object getProperty(Object bean, String fieldName) {
  try {
    Object property = PropertyUtils.getProperty(bean, fieldName);
    if (property == null) {
      // in case the bean is a Map, try again with a simple property, it might be masked by the Map
      property = PropertyUtils.getSimpleProperty(bean, fieldName);
    }
    log.debug("[field access] property {} of bean {}: {}", fieldName, bean.getClass().getTypeName(), property);
    return property;
  } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
    log.debug("Unable to read property {} from {}", fieldName, bean);
    return null;
  }
}
origin: jersey/jersey

  @Override
  public String getId() {
    return getBeanClass().getTypeName() + "#jersey";
  }
}
origin: alibaba/Sentinel

  private static void registerFallback() {
    // Register fallback handler for consumer.
    // If you only want to handle degrading, you need to
    // check the type of BlockException.
    DubboFallbackRegistry.setConsumerFallback((a, b, ex) ->
      new RpcResult("Error: " + ex.getClass().getTypeName()));
  }
}
origin: konsoletyper/teavm

@Override
public boolean isApplicable(MethodReference methodReference) {
  return classSource.isSuperType(Resource.class.getTypeName(), methodReference.getClassName()).orElse(false);
}
origin: konsoletyper/teavm

@Override
public boolean canHandle(MethodReference method) {
  return classSource.isSuperType(Resource.class.getTypeName(), method.getClassName()).orElse(false);
}
origin: aol/micro-server

@Test
public void namingClasses() {
  System.out.println(ActiveEventsTest.class.getCanonicalName());
  System.out.println(ActiveEventsTest.class.getName());
  System.out.println(ActiveEventsTest.class.getSimpleName());
  System.out.println(ActiveEventsTest.class.getPackage()
                       .getName());
  System.out.println(ActiveEventsTest.class.getTypeName());
}
origin: blox/blox

@Test
public void itDeserializesExceptionsWithOnlyMessageConstructor() {
 ObjectNode response =
   response(
     error(
       ThrowableSerializationMixin.ERROR_CODE,
       VALID_MESSAGE,
       data(RuntimeException.class.getTypeName())));
 Throwable throwable = resolver.resolveException(response);
 assertThat(throwable).isInstanceOf(RuntimeException.class).hasMessage(VALID_MESSAGE);
}
origin: blox/blox

@Test
public void itPrefersMessageFromDataOverMessageFromError() {
 ObjectNode response =
   response(
     error(
       ThrowableSerializationMixin.ERROR_CODE,
       VALID_MESSAGE,
       data(RuntimeException.class.getTypeName(), "message=" + OTHER_MESSAGE)));
 Throwable throwable = resolver.resolveException(response);
 assertThat(throwable).isInstanceOf(RuntimeException.class).hasMessage(OTHER_MESSAGE);
}
origin: blox/blox

@Test
public void itDeserializesPojoExceptionsWithJsonCreatorConstructor() {
 ObjectNode response =
   response(
     error(
       ThrowableSerializationMixin.ERROR_CODE,
       VALID_MESSAGE,
       data(PojoTestException.class.getTypeName(), "someValue=foo", "anotherValue=bar")));
 Throwable throwable = resolver.resolveException(response);
 assertThat(throwable)
   .isInstanceOf(PojoTestException.class)
   .hasMessage("foo:bar")
   .hasFieldOrPropertyWithValue("someValue", "foo")
   .hasFieldOrPropertyWithValue("anotherValue", "bar");
}
origin: blox/blox

@Test
public void itReturnsNullForOtherErrorCodes() {
 ObjectNode response =
   response(
     error(RANDOM_ERROR_CODE, VALID_MESSAGE, data(PojoTestException.class.getTypeName())));
 Throwable throwable = resolver.resolveException(response);
 assertThat(throwable).isNull();
}
origin: blox/blox

@Test
public void itReturnsNullWhenJacksonDeserializationFails() {
 ObjectNode response =
   response(
     error(
       ThrowableSerializationMixin.ERROR_CODE,
       VALID_MESSAGE,
       data(PojoTestException.class.getTypeName(), "invalidProperty=badValue")));
 Throwable throwable = resolver.resolveException(response);
 assertThat(throwable).isNull();
}
origin: Alluxio/alluxio

@Test
public void getInStreamUfs() throws Exception {
 WorkerNetAddress worker1 = new WorkerNetAddress().setHost("worker1");
 WorkerNetAddress worker2 = new WorkerNetAddress().setHost("worker2");
 BlockInfo info = new BlockInfo().setBlockId(0);
 URIStatus dummyStatus =
   new URIStatus(new FileInfo().setPersisted(true).setBlockIds(Collections.singletonList(0L))
     .setFileBlockInfos(Collections.singletonList(new FileBlockInfo().setBlockInfo(info))));
 OpenFilePOptions readOptions = OpenFilePOptions.newBuilder()
   .setFileReadLocationPolicy(MockFileWriteLocationPolicy.class.getTypeName()).build();
 InStreamOptions options = new InStreamOptions(dummyStatus, readOptions, sConf);
 ((MockFileWriteLocationPolicy) options.getUfsReadLocationPolicy())
   .setHosts(Arrays.asList(worker1, worker2));
 when(mMasterClient.getBlockInfo(BLOCK_ID)).thenReturn(new BlockInfo());
 when(mMasterClient.getWorkerInfoList()).thenReturn(
   Arrays.asList(new WorkerInfo().setAddress(worker1), new WorkerInfo().setAddress(worker2)));
 // Location policy chooses worker1 first.
 assertEquals(worker1, mBlockStore.getInStream(BLOCK_ID, options).getAddress());
 // Location policy chooses worker2 second.
 assertEquals(worker2, mBlockStore.getInStream(BLOCK_ID, options).getAddress());
}
java.langClassgetTypeName

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
    Finds a resource with a given name. The rules for searching resources associated with a given class
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now