Java 8 ArrayType - 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 ArrayType class.

This code example shows how to use the following methods:getComponentType
		return objectReturn ? "jobject" : signature.toString();
	} 
 
	@Override 
	public Void visitArray(ArrayType t, Void o) {
		final String className = t.getComponentType().toString();
		if ( "java.lang.CharSequence".equals(className) )
			signature.append("jlong");
		else if ( "java.nio.ByteBuffer".equals(className) )
			signature.append("jobjectArray");
		else if ( "org.lwjgl.opencl.CLMem".equals(className) )
			signature.append("jobjectArray");
		else 
			throw new RuntimeException(t + " is not allowed");
		return DEFAULT_VALUE;
	} 
 
	private void visitClassType(DeclaredType t) {
		final Class<?> type = Utils.getJavaType(t);
		if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) {
5
CodeRank
This code example shows how to use the following methods:getComponentType
		return signature.toString();
	} 
 
	@Override 
	public Void visitArray(ArrayType t, Void o) {
		final Class type = Utils.getJavaType(t.getComponentType());
		if ( CharSequence.class.isAssignableFrom(type) )
			signature.append("J");
		else if ( Buffer.class.isAssignableFrom(type) )
			signature.append("[Ljava/nio/ByteBuffer;");
		else if ( PointerWrapper.class.isAssignableFrom(type) )
			signature.append("[L" + getNativeNameFromClassName(type.getName()) + ";");
		else 
			throw new RuntimeException(t + " is not allowed");
		return DEFAULT_VALUE;
	} 
 
	private void visitClassType(DeclaredType t) {
		Class type = NativeTypeTranslator.getClassFromType(t);
 
5
CodeRank
This code example shows how to use the following methods:getComponentType
				new TypeKindVisitor6<DeclaredType, Void>() {
 
					@Override 
					public DeclaredType visitArray(ArrayType t, Void p) {
 
						return t.getComponentType().accept(
								new TypeKindVisitor6<DeclaredType, Void>() {
 
									@Override 
									public DeclaredType visitDeclared(DeclaredType t, Void p) {
										return t;
									} 
 
								}, null 
						); 
					} 
 
				}, null 
		); 
 
4
CodeRank
This code example shows how to use the following methods:getComponentType
This code example shows how to use the following methods:toString
	} 
 
	@Override 
	public R visitArray(ArrayType t, P p)
	{ 
		log("visitArray(ArrayType=[%s], P p=[%s])", t.toString(), p);
		if (next != null)
			return next.visitArray(t, p);
		return null; 
	} 
 
	@Override 
	public R visitDeclared(DeclaredType t, P p)
	{ 
		log("visitDeclared(DeclaredType=[%s], P p=[%s])", t.toString(), p);
		if (next != null)
			return next.visitDeclared(t, p);
		return null; 
	} 
 
4
CodeRank
This code example shows how to use the following methods:toString
     * INTERNAL: 
     * Visit a declared array field. 
     */ 
    @Override 
    public MetadataAnnotatedElement visitArray(ArrayType arrayType, MetadataAnnotatedElement annotatedElement) {
        annotatedElement.setType(arrayType.toString());
        return annotatedElement;
    } 
     
    /** 
     * INTERNAL: 
     * Visit a declared field or Class. 
     */ 
    @Override 
    public MetadataAnnotatedElement visitDeclared(DeclaredType declaredType, MetadataAnnotatedElement annotatedElement) {
        // Get the metadata class of the declared type from the factory. 
        MetadataMirrorFactory factory = (MetadataMirrorFactory) annotatedElement.getMetadataFactory();
        MetadataClass cls = factory.getMetadataClass(declaredType);
         
        // Set the type, which is the class name. 
3
CodeRank
This code example shows how to use the following methods:getComponentType
    // Arrays 
    if (element.asType().getKind() == TypeKind.ARRAY) {
 
      ArrayType arrayType = (ArrayType) element.asType();
 
      TypeMirror arrayOf = arrayType.getComponentType();
 
      if (arrayOf.getKind() == TypeKind.CHAR) {
        return new CodeGenInfo(typeMap.get(TYPE_KEY_CHAR_ARRAY));
      } 
 
      if (arrayOf.getKind() == TypeKind.BOOLEAN) {
        return new CodeGenInfo(typeMap.get(TYPE_KEY_BOOL_ARRAY));
      } 
 
      if (arrayOf.getKind() == TypeKind.BYTE) {
        return new CodeGenInfo(typeMap.get(TYPE_KEY_BYTE_ARRAY));
      } 
 
      if (arrayOf.getKind() == TypeKind.DOUBLE) {
3
CodeRank
See Code Examples for Java 8 ArrayType Methods: