/** * Gets the appropriate {@link FieldType} for the given type. * * @param type The field type * @return The field type */ static FieldType of(final String type) { return new TypeReader(type).readFieldType(); }
/** * Reads the next {@link Type} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public Type readType() { // Void Type if (this.peek() == 'V') { this.advance(); return VoidType.INSTANCE; } // Field Type return this.readFieldType(); }
/** * Reads the next {@link ArrayType} from source. * * @return The type * @throws IllegalStateException If the descriptor is invalid */ public ArrayType readArrayType() { int count = 0; while (this.hasNext() && this.peek() == '[') { this.advance(); count++; } return new ArrayType(count, this.readFieldType()); }