throw new IllegalArgumentException (); return new ElementHandle<PackageElement> (kind, descriptors); case CLASS: case INTERFACE: throw new IllegalArgumentException (); return new ElementHandle<TypeElement> (kind, descriptors); case METHOD: case CONSTRUCTOR: throw new IllegalArgumentException (); return new ElementHandle<ExecutableElement> (kind, descriptors); case INSTANCE_INIT: case STATIC_INIT: throw new IllegalArgumentException (); return new ElementHandle<ExecutableElement> (kind, descriptors); case FIELD: case ENUM_CONSTANT: return new ElementHandle<VariableElement> (kind, descriptors); default: throw new IllegalArgumentException ();
/** * Creates an {@link ElementHandle} representing a {@link PackageElement}. * @param packageName the name of the package * @return the created {@link ElementHandle} * @since 0.98 */ @NonNull public static ElementHandle<PackageElement> createPackageElementHandle ( @NonNull final String packageName) { Parameters.notNull("packageName", packageName); //NOI18N return new ElementHandle<PackageElement>(ElementKind.PACKAGE, packageName); }
throw new IllegalArgumentException(kind.toString()); return new ElementHandle<T> (kind, signatures);
/** * Creates an {@link ElementHandle} representing a {@link TypeElement}. * @param kind the {@link ElementKind} of the {@link TypeElement}, * allowed values are {@link ElementKind#CLASS}, {@link ElementKind#INTERFACE}, * {@link ElementKind#ENUM} and {@link ElementKind#ANNOTATION_TYPE}. * @param binaryName the class binary name as specified by JLS §13.1 * @return the created {@link ElementHandle} * @throws IllegalArgumentException if kind is neither class nor interface * @since 0.98 */ @NonNull public static ElementHandle<TypeElement> createTypeElementHandle( @NonNull final ElementKind kind, @NonNull final String binaryName) throws IllegalArgumentException { Parameters.notNull("kind", kind); //NOI18N Parameters.notNull("binaryName", binaryName); //NOI18N if (!kind.isClass() && !kind.isInterface()) { throw new IllegalArgumentException(kind.toString()); } return new ElementHandle<TypeElement>(kind, binaryName); }