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

How to use
isArray
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.isArray (Showing top 20 results out of 38,808)

origin: apache/incubator-dubbo

@Override
public boolean accept(Type type, Class<?> clazz) {
  if (clazz == null) {
    return false;
  }
  return clazz.isArray();
}
origin: apache/incubator-dubbo

@Override
public boolean accept(Type type, Class<?> clazz) {
  if (clazz == null) {
    return false;
  }
  return clazz.isArray();
}
origin: spring-projects/spring-framework

/**
 * Returns '{@code true}' for arrays, {@link Collection Collections}
 * and {@link Map Maps}.
 */
private static boolean typeRequiresMultiple(Class<?> type) {
  return (type.isArray() || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type));
}
origin: spring-projects/spring-framework

/**
 * Determine whether the given object is an array:
 * either an Object array or a primitive array.
 * @param obj the object to check
 */
public static boolean isArray(@Nullable Object obj) {
  return (obj != null && obj.getClass().isArray());
}
origin: apache/incubator-dubbo

/**
 * Determine if the object needs wrap
 *
 * @param clazz object type
 * @return need wrap
 */
public static boolean needWrapper(Class<?> clazz) {
  return WrapperUtils.WRAPPER_SET.contains(clazz) || clazz.isArray() || clazz.isEnum();
}
origin: apache/incubator-dubbo

/**
 * Determine if the object needs wrap
 *
 * @param clazz object type
 * @return need wrap
 */
public static boolean needWrapper(Class<?> clazz) {
  return WrapperUtils.WRAPPER_SET.contains(clazz) || clazz.isArray() || clazz.isEnum();
}
origin: spring-projects/spring-framework

/**
 * Check if the given class represents an array of primitives,
 * i.e. boolean, byte, char, short, int, long, float, or double.
 * @param clazz the class to check
 * @return whether the given class is a primitive array class
 */
public static boolean isPrimitiveArray(Class<?> clazz) {
  Assert.notNull(clazz, "Class must not be null");
  return (clazz.isArray() && clazz.getComponentType().isPrimitive());
}
origin: google/guava

 @Override
 Type usedInGenericType(Type type) {
  checkNotNull(type);
  if (type instanceof Class) {
   Class<?> cls = (Class<?>) type;
   if (cls.isArray()) {
    return new GenericArrayTypeImpl(cls.getComponentType());
   }
  }
  return type;
 }
},
origin: spring-projects/spring-framework

/**
 * Is this type an array type?
 */
public boolean isArray() {
  return getType().isArray();
}
origin: spring-projects/spring-framework

  @Override
  public void printValue(String label, @Nullable Object value) {
    if (value != null && value.getClass().isArray()) {
      value = CollectionUtils.arrayToList(value);
    }
    writer.println(String.format("%17s = %s", label, value));
  }
});
origin: spring-projects/spring-framework

  private void appendType(StringBuilder sb, Class<?> type, boolean useLongTypeName) {
    if (type.isArray()) {
      appendType(sb, type.getComponentType(), useLongTypeName);
      sb.append("[]");
    }
    else {
      sb.append(useLongTypeName ? type.getName() : type.getSimpleName());
    }
  }
}
origin: spring-projects/spring-framework

private boolean isBindingCandidate(String name, @Nullable Object value) {
  return (!name.startsWith(BindingResult.MODEL_KEY_PREFIX) && value != null &&
      !value.getClass().isArray() && !(value instanceof Collection) &&
      !(value instanceof Map) && !BeanUtils.isSimpleValueType(value.getClass()));
}
origin: spring-projects/spring-framework

/**
 * Check if the given class represents an array of primitive wrappers,
 * i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double.
 * @param clazz the class to check
 * @return whether the given class is a primitive wrapper array class
 */
public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
  Assert.notNull(clazz, "Class must not be null");
  return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
}
origin: apache/incubator-dubbo

private static boolean isPrimitives(Class<?> cls) {
  if (cls.isArray()) {
    return isPrimitive(cls.getComponentType());
  }
  return isPrimitive(cls);
}
origin: apache/incubator-dubbo

public static boolean isPrimitives(Class<?> cls) {
  if (cls.isArray()) {
    return isPrimitive(cls.getComponentType());
  }
  return isPrimitive(cls);
}
origin: spring-projects/spring-framework

/**
 * Return {@code true} if this type resolves to a Class that represents an array.
 * @see #getComponentType()
 */
public boolean isArray() {
  if (this == NONE) {
    return false;
  }
  return ((this.type instanceof Class && ((Class<?>) this.type).isArray()) ||
      this.type instanceof GenericArrayType || resolveType().isArray());
}
origin: apache/incubator-dubbo

  @Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}
origin: apache/incubator-dubbo

  @Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}
origin: spring-projects/spring-framework

@Test
public void testBeanPropertyIsArray() {
  PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(ContainerBean.class);
  for (PropertyDescriptor descriptor : descriptors) {
    if ("containedBeans".equals(descriptor.getName())) {
      assertTrue("Property should be an array", descriptor.getPropertyType().isArray());
      assertEquals(descriptor.getPropertyType().getComponentType(), ContainedBean.class);
    }
  }
}
origin: spring-projects/spring-framework

@Test
public void arrayClassType() throws Exception {
  ResolvableType type = ResolvableType.forField(Fields.class.getField("arrayClassType"));
  assertThat(type.getType(), instanceOf(Class.class));
  assertThat(((Class) type.getType()).isArray(), equalTo(true));
}
java.langClassisArray

Javadoc

Tests whether the class represented by this Class is an array class.

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
  • 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,
  • 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
  • Top plugins for Android Studio
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