Java 8 GenericArrayType - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GenericArrayType class.

This code example shows how to use the following methods:getGenericComponentType
			else 
				return erase(tv.getBounds()[0]);
		} 
		else if (type instanceof GenericArrayType) {
			GenericArrayType aType = (GenericArrayType) type;
			Class<?> componentType = erase(aType.getGenericComponentType());
			return Array.newInstance(componentType, 0).getClass();
		} 
		else { 
			throw new RuntimeException("not supported: " + type.getClass());
		} 
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
    @Override 
    public boolean equals(Object obj) { 
        if (obj instanceof GenericArrayType) {
            GenericArrayType that = (GenericArrayType) obj;
            if (genericComponentType == null) {
                return that.getGenericComponentType() == null;
            } else { 
                return genericComponentType.equals(that.getGenericComponentType());
            } 
        } else { 
            return false; 
        } 
    } 
 
    @Override 
    public String toString() {
        StringBuilder sb = new StringBuilder();
        if (genericComponentType instanceof Class<?>) {
            sb.append(Reflections.<Class<?>>cast(genericComponentType).getName());
        } else { 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
    this.type = type;
  } 
 
  @Override 
  public MetaType getGenericComponentType() { 
    return JavaReflectionUtil.fromType(type.getGenericComponentType());
  } 
 
  @Override 
  public String getName() {
    return type.toString();
  } 
   
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
	 * @see org.springframework.data.util.TypeDiscoverer#getType() 
	 */ 
	@Override 
	@SuppressWarnings("unchecked") 
	public Class<S> getType() {
		return (Class<S>) Array.newInstance(resolveType(type.getGenericComponentType()), 0).getClass();
	} 
 
	/* 
	 * (non-Javadoc) 
	 * @see org.springframework.data.util.TypeDiscoverer#doGetComponentType() 
	 */ 
	@Override 
	protected TypeInformation<?> doGetComponentType() { 
 
		Type componentType = type.getGenericComponentType();
		return createInfo(componentType);
	} 
 
	/*  
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
        	elementMetaInfo = new ParserMetaInfo();
        	elementMetaInfo.setType(eleClass);
        	elementMetaInfo.setParser(ParserStateMachine.getParser(eleClass));
    	} else if(elementType instanceof GenericArrayType) {
    		GenericArrayType t = (GenericArrayType)elementType;
    		Class<?> eleType = (Class<?>)t.getGenericComponentType();
    		Object obj = Array.newInstance(eleType, 0);
    		Class<?> rawClass = obj.getClass();
    		 
    		elementMetaInfo = new ParserMetaInfo();
        	elementMetaInfo.setType(rawClass);
        	elementMetaInfo.setParser(ParserStateMachine.getParser(rawClass));
    	} else { 
    		throw new JsonException("mot support type " + elementType);
    	} 
	} 
	 
	public ParserMetaInfo getElementMetaInfo() { 
		return elementMetaInfo;
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
 
        if (!(that instanceof GenericArrayType))
            return false; 
 
        GenericArrayType other = (GenericArrayType) that;
        return Objects.equal(getGenericComponentType(), other.getGenericComponentType());
    } 
 
    @Override public int hashCode() { 
        return Objects.hashCode(getGenericComponentType());
    } 
 
    @Override public String toString() {
        return getGenericComponentType().toString() + "[]";
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
    if (o == this)
      return true; 
    else if (o instanceof GenericArrayType) {
      GenericArrayType type = (GenericArrayType) o;
 
      return _componentType.equals(type.getGenericComponentType());
    } 
    else 
      return false; 
  } 
 
  @Override 
  public String getSimpleName()
  { 
    return _componentType.getSimpleName() + "[]";
  } 
 
  @Override 
  public String toString()
  { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
		if ( type instanceof TypeVariable<?> ) {
			return actualTypeArguments.get( ( (TypeVariable<?>) type ).getName() );
		} 
		if ( type instanceof GenericArrayType ) {
			GenericArrayType gat = (GenericArrayType) type;
			return type( gat.getGenericComponentType() ).getArrayType();
		} 
		if ( type instanceof WildcardType ) {
			WildcardType wt = (WildcardType) type;
			java.lang.reflect.Type[] upperBounds = wt.getUpperBounds();
			if ( upperBounds.length == 1 ) {
				return type( upperBounds[0] ).asUpperBound();
			} 
		} 
		throw notSupportedYet( type );
	} 
 
	private static <T> Type<T> parameterizedType( ParameterizedType type,
			Map<String, Type<?>> actualTypeArguments ) {
		@SuppressWarnings ( "unchecked" ) 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
      return new ParameterizedTypeImpl(p.getOwnerType(),
          p.getRawType(), p.getActualTypeArguments());
 
    } else if (type instanceof GenericArrayType) {
      GenericArrayType g = (GenericArrayType) type;
      return new GenericArrayTypeImpl(g.getGenericComponentType());
 
    } else if (type instanceof WildcardType) {
      WildcardType w = (WildcardType) type;
      return new WildcardTypeImpl(w.getUpperBounds(), w.getLowerBounds());
 
    } else { 
      // type is either serializable as-is or unsupported 
      return type;
    } 
  } 
 
  @SuppressWarnings("unchecked") 
  public static Class<?> getRawType(Type type) {
    if (type instanceof Class<?>) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getGenericComponentType
    private static Type fix(Type t) {
        if(!(t instanceof GenericArrayType))
            return t;
 
        GenericArrayType gat = (GenericArrayType) t;
        if(gat.getGenericComponentType() instanceof Class) {
            Class c = (Class) gat.getGenericComponentType();
            return Array.newInstance(c,0).getClass();
        } 
 
        return t;
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 GenericArrayType Methods: