Top Description Fields Constructors Methods
org.springframework.beans.factory.support

pack-priv Class BeanDefinitionResource

extends AbstractResource
Class Inheritance
Imports
java.io.FileNotFoundException, .IOException, .InputStream, org.springframework.beans.factory.config.BeanDefinition, org.springframework.core.io.AbstractResource, org.springframework.lang.Nullable, org.springframework.util.Assert

Descriptive org.springframework.core.io.Resource wrapper for a org.springframework.beans.factory.config.BeanDefinition.
Author
Juergen Hoeller
Since
2.5.2
See Also
org.springframework.core.io.DescriptiveResource

Field Summary

Modifier and TypeField and Description
private final BeanDefinition

Constructor Summary

AccessConstructor and Description
public
BeanDefinitionResource(BeanDefinition
the BeanDefinition object to wrap
beanDefinition
)

Create a new BeanDefinitionResource.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides org.springframework.core.io.AbstractResource.equals.

This implementation compares the underlying BeanDefinition.

public boolean
exists()

Overrides org.springframework.core.io.AbstractResource.exists.

Implements org.springframework.core.io.Resource.exists.

This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.

public final BeanDefinition
getBeanDefinition()

Return the wrapped BeanDefinition object.

public String
getDescription()

Implements org.springframework.core.io.Resource.getDescription.

Return a description for this resource, to be used for error output when working with the resource.

public InputStream
getInputStream()

Implements org.springframework.core.io.InputStreamSource.getInputStream.

Return an InputStream for the content of an underlying resource.

public int
hashCode()

Overrides org.springframework.core.io.AbstractResource.hashCode.

This implementation returns the hash code of the underlying BeanDefinition.

public boolean
isReadable()

Overrides org.springframework.core.io.AbstractResource.isReadable.

Overrides default org.springframework.core.io.Resource.isReadable.

This implementation always returns true for a resource that exists (revised as of 5.1).

Inherited from org.springframework.core.io.AbstractResource:
contentLengthcreateRelativegetFilegetFileForLastModifiedCheckgetFilenamegetURIgetURLisFileisOpenlastModifiedreadableChanneltoString

Field Detail

beanDefinitionback to summary
private final BeanDefinition beanDefinition

Constructor Detail

BeanDefinitionResourceback to summary
public BeanDefinitionResource(BeanDefinition beanDefinition)

Create a new BeanDefinitionResource.

Parameters
beanDefinition:BeanDefinition

the BeanDefinition object to wrap

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides org.springframework.core.io.AbstractResource.equals.

This implementation compares the underlying BeanDefinition.

Parameters
other:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
existsback to summary
public boolean exists()

Overrides org.springframework.core.io.AbstractResource.exists.

Implements org.springframework.core.io.Resource.exists.

Doc from org.springframework.core.io.AbstractResource.exists.

This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.

This will cover both directories and content resources.

Annotations
@Override
getBeanDefinitionback to summary
public final BeanDefinition getBeanDefinition()

Return the wrapped BeanDefinition object.

getDescriptionback to summary
public String getDescription()

Implements org.springframework.core.io.Resource.getDescription.

Doc from org.springframework.core.io.Resource.getDescription.

Return a description for this resource, to be used for error output when working with the resource.

Implementations are also encouraged to return this value from their toString method.

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Implements org.springframework.core.io.InputStreamSource.getInputStream.

Doc from org.springframework.core.io.InputStreamSource.getInputStream.

Return an InputStream for the content of an underlying resource.

It is expected that each call creates a fresh stream.

This requirement is particularly important when you consider an API such as JavaMail, which needs to be able to read the stream multiple times when creating mail attachments. For such a use case, it is required that each getInputStream() call returns a fresh stream.

Returns:InputStream

the input stream for the underlying resource (must not be null)

Annotations
@Override
Exceptions
IOException:
if the content stream could not be opened
hashCodeback to summary
public int hashCode()

Overrides org.springframework.core.io.AbstractResource.hashCode.

This implementation returns the hash code of the underlying BeanDefinition.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
isReadableback to summary
public boolean isReadable()

Overrides org.springframework.core.io.AbstractResource.isReadable.

Overrides default org.springframework.core.io.Resource.isReadable.

Doc from org.springframework.core.io.AbstractResource.isReadable.

This implementation always returns true for a resource that exists (revised as of 5.1).

Annotations
@Override