Skip to content

Commit

Permalink
Remove Kotlin "translations" of Java APIs in the reference manual
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Feb 16, 2021
1 parent a315abf commit 829000d
Showing 1 changed file with 5 additions and 83 deletions.
88 changes: 5 additions & 83 deletions src/docs/asciidoc/core/core-resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ following listing provides an overview of the `Resource` interface. See the
{api-spring-framework}/core/io/Resource.html[`Resource`] javadoc for further details.


[source,java,indent=0,subs="verbatim,quotes",role="primary"]
[source,java,indent=0,subs="verbatim,quotes"]
.Java
----
public interface Resource extends InputStreamSource {
Expand Down Expand Up @@ -70,67 +70,21 @@ following listing provides an overview of the `Resource` interface. See the
String getFilename();
String getDescription();
}
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
interface Resource : InputStreamSource {
fun exists(): Boolean
fun isReadable(): Boolean
fun isOpen(): Boolean
fun isFile(): Boolean
fun getURL(): URL
@Throws(IOException::class)
fun getURI(): URI
val file: File
@Throws(IOException::class)
fun readableChannel(): ReadableByteChannel
@Throws(IOException::class)
fun contentLength(): long
@Throws(IOException::class)
fun lastModified(): long
@Throws(IOException::class)
fun createRelative(relativePath: String): Resource
val filename: String
val description: String
}
----

As the definition of the `Resource` interface shows, it extends the `InputStreamSource`
interface. The following listing shows the definition of the `InputStreamSource`
interface:

[source,java,indent=0,subs="verbatim,quotes",role="primary"]
[source,java,indent=0,subs="verbatim,quotes"]
.Java
----
public interface InputStreamSource {
InputStream getInputStream() throws IOException;
}
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
interface InputStreamSource {
val inputStream: InputStream
}
----

Some of the most important methods from the `Resource` interface are:

Expand Down Expand Up @@ -303,7 +257,7 @@ The `ResourceLoader` interface is meant to be implemented by objects that can re
(that is, load) `Resource` instances. The following listing shows the `ResourceLoader`
interface definition:

[source,java,indent=0,subs="verbatim,quotes",role="primary"]
[source,java,indent=0,subs="verbatim,quotes"]
.Java
----
public interface ResourceLoader {
Expand All @@ -313,16 +267,6 @@ interface definition:
ClassLoader getClassLoader();
}
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
interface ResourceLoader {
fun getResource(location: String): Resource
fun getClassLoader(): ClassLoader
}
----

All application contexts implement the `ResourceLoader` interface. Therefore, all
application contexts may be used to obtain `Resource` instances.
Expand Down Expand Up @@ -426,28 +370,14 @@ The `ResourcePatternResolver` interface is an extension to the `ResourceLoader`
which defines a strategy for resolving a location pattern (for example, an Ant-style path
pattern) into `Resource` objects.

[source,java,indent=0,subs="verbatim,quotes",role="primary"]
[source,java,indent=0,subs="verbatim,quotes"]
.Java
----
public interface ResourcePatternResolver extends ResourceLoader {
String CLASSPATH_ALL_URL_PREFIX = "classpath*:";
Resource[] getResources(String locationPattern) throws IOException;
}
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
interface ResourcePatternResolver: ResourceLoader {
@JvmField
val CLASSPATH_ALL_URL_PREFIX: String = "classpath*:"
@Throws(IOException::class)
fun getResources(locationPattern: String): Resource[]
}
----

Expand Down Expand Up @@ -492,22 +422,14 @@ The `ResourceLoaderAware` interface is a special callback interface which identi
components that expect to be provided a `ResourceLoader` reference. The following listing
shows the definition of the `ResourceLoaderAware` interface:

[source,java,indent=0,subs="verbatim,quotes",role="primary"]
[source,java,indent=0,subs="verbatim,quotes"]
.Java
----
public interface ResourceLoaderAware {
void setResourceLoader(ResourceLoader resourceLoader);
}
----
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
interface ResourceLoaderAware {
fun setResourceLoader(resourceLoader: ResourceLoader)
}
----

When a class implements `ResourceLoaderAware` and is deployed into an application context
(as a Spring-managed bean), it is recognized as `ResourceLoaderAware` by the application
Expand Down

0 comments on commit 829000d

Please sign in to comment.