Java Code Examples for javax.lang.model.type.TypeKind#PACKAGE

The following examples show how to use javax.lang.model.type.TypeKind#PACKAGE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MalformedFormatString.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Unbox a wrapper type into a TypeKind. Some additional types are mapped to TypeKinds which cannot really appear in 
 * expressions (at least I hope)
 * 
 * @param tm
 * @return 
 */
private static TypeKind unboxBoxed(TypeMirror tm) {
    TypeElement te = (TypeElement)((DeclaredType)tm).asElement();
    String qn = te.getQualifiedName().toString();
    if (!qn.startsWith("java.lang.")) { // NO18N
        if (qn.equals("java.math.BigInteger")) { // NOI18N
            return TypeKind.WILDCARD;
        }
        return null;
    }
    switch (qn.substring(10)) {
        case "Short": return TypeKind.SHORT; // NOI18N
        case "Long": return TypeKind.LONG; // NOI18N
        case "Byte": return TypeKind.BYTE; // NOI18N
        case "Integer": return TypeKind.INT; // NOI18N
        case "Double": return TypeKind.DOUBLE; // NOI18N
        case "Float": return TypeKind.FLOAT; // NOI18N
        case "Character": return TypeKind.CHAR; // NOI18N
        case "String": return TypeKind.OTHER; // NOI18N
        case "Object": return TypeKind.PACKAGE; // NOI18N
    }
    return null;
}
 
Example 2
Source File: Type.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public TypeKind getKind() {
    return TypeKind.PACKAGE;
}
 
Example 3
Source File: Utilities.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static boolean isValidType(TypeMirror m) {
    return m != null && (
            m.getKind() != TypeKind.PACKAGE &&
            m.getKind() != TypeKind.OTHER && 
            m.getKind() != TypeKind.ERROR);
}
 
Example 4
Source File: Tiny.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static boolean isAcceptable(CompilationInfo info, TypeMirror type) {
    if (!Utilities.isValidType(type)) return false;
    TypeKind typeKind = type.getKind();
    return typeKind != TypeKind.EXECUTABLE && typeKind != TypeKind.PACKAGE;
}
 
Example 5
Source File: Type.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public TypeKind getKind() {
    return TypeKind.PACKAGE;
}
 
Example 6
Source File: TurbineTypeMirror.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public TypeKind getKind() {
  return TypeKind.PACKAGE;
}
 
Example 7
Source File: PackageElementImpl.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public TypeKind getKind() {
  return TypeKind.PACKAGE;
}
 
Example 8
Source File: StandalonePackageType.java    From buck with Apache License 2.0 4 votes vote down vote up
public StandalonePackageType(ArtificialPackageElement packageElement) {
  super(TypeKind.PACKAGE);
  this.packageElement = packageElement;
}