Package com.sun.mirror.type

Examples of com.sun.mirror.type.DeclaredType


        } else throw  new IllegalArgumentException();
    }

    public boolean isParameterizedType(TypeMirror t) {
        if (t instanceof DeclaredType) {
            DeclaredType d = (DeclaredType) t;
            return !d.getActualTypeArguments().isEmpty();
        }
        return false;
    }
View Full Code Here


                }

                TypeMirror mapType = TypeMath.baseClassFinder.apply(type, env.getTypeDeclaration(Map.class.getName()));
                if(mapType!=null) {
                    // T=Map<...>
                    DeclaredType d = (DeclaredType)mapType;
                    Iterator<TypeMirror> itr = d.getActualTypeArguments().iterator();
                    itr.next();
                    return new MapPacker(itr.next());
                }

                return null;
View Full Code Here

    }

    TypeMirror isCollection(TypeMirror t) {
        TypeMirror collectionType = baseClassFinder.apply(t, env.getTypeDeclaration(Collection.class.getName()));
        if(collectionType!=null) {
            DeclaredType d = (DeclaredType)collectionType;
            return d.getActualTypeArguments().iterator().next();
        } else
            return null;
    }
View Full Code Here

    }

    private static String getCanonicalTypeFrom(MirroredTypeException me) {
        TypeMirror tm = me.getTypeMirror();
        if (tm instanceof DeclaredType) {
            DeclaredType dec = (DeclaredType) tm;
            String qn = dec.getDeclaration().getQualifiedName();
            return ( qn );
        }
        return ""//ok?
    }
View Full Code Here

    }

    public TypeDeclaration asDecl(TypeMirror m) {
        m = env.getTypeUtils().getErasure(m);
        if (m instanceof DeclaredType) {
            DeclaredType d = (DeclaredType) m;
            return d.getDeclaration();
        } else
            return null;
    }
View Full Code Here

    public <T> TypeMirror erasure(TypeMirror t) {
        Types tu = env.getTypeUtils();
        t = tu.getErasure(t);
        if(t instanceof DeclaredType) {
            DeclaredType dt = (DeclaredType)t;
            if(!dt.getActualTypeArguments().isEmpty())
            return tu.getDeclaredType(dt.getDeclaration());
        }
        return t;
    }
View Full Code Here

        throw new IllegalArgumentException();
    }

    public TypeMirror getTypeArgument(TypeMirror typeMirror, int i) {
        if (typeMirror instanceof DeclaredType){
            DeclaredType d = (DeclaredType)typeMirror;
            TypeMirror[] args = d.getActualTypeArguments().toArray(new TypeMirror[0]);
            return args[i];
        } else throw  new IllegalArgumentException();
    }
View Full Code Here

        } else throw  new IllegalArgumentException();
    }

    public boolean isParameterizedType(TypeMirror t) {
        if (t instanceof DeclaredType) {
            DeclaredType d = (DeclaredType) t;
            return !d.getActualTypeArguments().isEmpty();
        }
        return false;
    }
View Full Code Here

        private String toString(AnnotationValue value) {
            if (value.getValue() instanceof TypeMirror) {
                TypeMirror tm = (TypeMirror) value.getValue();
                // TODO: needs to be more robust
                if (tm instanceof DeclaredType) {
                    DeclaredType dt = (DeclaredType) tm;
                    return getClassName(dt.getDeclaration());
                }
            }
            return value.toString();
        }
View Full Code Here

TOP

Related Classes of com.sun.mirror.type.DeclaredType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.