Class YangTextSchemaSource
- java.lang.Object
-
- com.google.common.io.ByteSource
-
- org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource
-
- All Implemented Interfaces:
Identifiable<SourceIdentifier>
,Immutable
,MutationBehaviour<Immutable>
,SchemaSourceRepresentation
,YangSchemaSourceRepresentation
@Beta public abstract class YangTextSchemaSource extends ByteSource implements YangSchemaSourceRepresentation
YANG text schema source representation. Exposes an RFC6020 or RFC7950 text representation as anInputStream
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
YangTextSchemaSource(SourceIdentifier identifier)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract MoreObjects.ToStringHelper
addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
Add subclass-specific attributes to the outputtoString()
output.static @NonNull YangTextSchemaSource
delegateForByteSource(String fileName, ByteSource delegate)
Create a new YangTextSchemaSource withSourceIdentifier
derived from a supplied filename and backed by ByteSource, which provides the actual InputStreams.static @NonNull YangTextSchemaSource
delegateForByteSource(SourceIdentifier identifier, ByteSource delegate)
Create a new YangTextSchemaSource with a specific source identifier and backed by ByteSource, which provides the actual InputStreams.static @NonNull YangTextSchemaSource
forFile(File file)
Create a new YangTextSchemaSource backed by aFile
withSourceIdentifier
derived from the file name.static @NonNull YangTextSchemaSource
forFile(File file, SourceIdentifier identifier)
Create a new YangTextSchemaSource backed by aFile
and specifiedSourceIdentifier
.static @NonNull YangTextSchemaSource
forResource(Class<?> clazz, String resourceName)
Create a newYangTextSchemaSource
backed by a resource by a resource available on the ClassLoader which loaded the specified class.static @NonNull YangTextSchemaSource
forResource(String resourceName)
Create a newYangTextSchemaSource
backed by a resource available in the ClassLoader where this class resides.static @NonNull YangTextSchemaSource
forURL(URL url, SourceIdentifier identifier)
Create a newYangTextSchemaSource
backed by a URL.SourceIdentifier
getIdentifier()
Return this objects Identifier.Class<? extends YangTextSchemaSource>
getType()
Return the concrete representation type.static @NonNull SourceIdentifier
identifierFromFilename(String name)
String
toString()
-
Methods inherited from class com.google.common.io.ByteSource
asCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, isEmpty, openBufferedStream, openStream, read, read, size, sizeIfKnown, slice, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation
getSymbolicName
-
-
-
-
Constructor Detail
-
YangTextSchemaSource
protected YangTextSchemaSource(SourceIdentifier identifier)
-
-
Method Detail
-
identifierFromFilename
public static @NonNull SourceIdentifier identifierFromFilename(String name)
-
delegateForByteSource
public static @NonNull YangTextSchemaSource delegateForByteSource(SourceIdentifier identifier, ByteSource delegate)
Create a new YangTextSchemaSource with a specific source identifier and backed by ByteSource, which provides the actual InputStreams.- Parameters:
identifier
- SourceIdentifier of the resulting schema sourcedelegate
- Backing ByteSource instance- Returns:
- A new YangTextSchemaSource
-
delegateForByteSource
public static @NonNull YangTextSchemaSource delegateForByteSource(String fileName, ByteSource delegate)
Create a new YangTextSchemaSource withSourceIdentifier
derived from a supplied filename and backed by ByteSource, which provides the actual InputStreams.- Parameters:
fileName
- File namedelegate
- Backing ByteSource instance- Returns:
- A new YangTextSchemaSource
- Throws:
IllegalArgumentException
- if the file name has invalid format
-
forFile
public static @NonNull YangTextSchemaSource forFile(File file)
Create a new YangTextSchemaSource backed by aFile
withSourceIdentifier
derived from the file name.- Parameters:
file
- Backing File- Returns:
- A new YangTextSchemaSource
- Throws:
IllegalArgumentException
- if the file name has invalid format or if the supplied File is not a fileNullPointerException
- if file isnull
-
forFile
public static @NonNull YangTextSchemaSource forFile(File file, SourceIdentifier identifier)
Create a new YangTextSchemaSource backed by aFile
and specifiedSourceIdentifier
.- Parameters:
file
- Backing Fileidentifier
- source identifier- Returns:
- A new YangTextSchemaSource
- Throws:
IllegalArgumentException
- if the file name has invalid format or if the supplied File is not a fileNullPointerException
- if any argument isnull
-
forResource
public static @NonNull YangTextSchemaSource forResource(String resourceName)
Create a newYangTextSchemaSource
backed by a resource available in the ClassLoader where this class resides.- Parameters:
resourceName
- Resource name- Returns:
- A new instance.
- Throws:
IllegalArgumentException
- if the resource does not exist or if the name has invalid format
-
forResource
public static @NonNull YangTextSchemaSource forResource(Class<?> clazz, String resourceName)
Create a newYangTextSchemaSource
backed by a resource by a resource available on the ClassLoader which loaded the specified class.- Parameters:
clazz
- Class referenceresourceName
- Resource name- Returns:
- A new instance.
- Throws:
IllegalArgumentException
- if the resource does not exist or if the name has invalid format
-
forURL
public static @NonNull YangTextSchemaSource forURL(URL url, SourceIdentifier identifier)
Create a newYangTextSchemaSource
backed by a URL.- Parameters:
url
- Backing URLidentifier
- Source identifier- Returns:
- A new instance.
- Throws:
NullPointerException
- if any argument isnull
-
getIdentifier
public final SourceIdentifier getIdentifier()
Description copied from interface:Identifiable
Return this objects Identifier.- Specified by:
getIdentifier
in interfaceIdentifiable<SourceIdentifier>
- Specified by:
getIdentifier
in interfaceSchemaSourceRepresentation
- Returns:
- Object's identifier, must not be null.
-
getType
public Class<? extends YangTextSchemaSource> getType()
Description copied from interface:SchemaSourceRepresentation
Return the concrete representation type.- Specified by:
getType
in interfaceSchemaSourceRepresentation
- Specified by:
getType
in interfaceYangSchemaSourceRepresentation
- Returns:
- The type of representation.
-
addToStringAttributes
protected abstract MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)
Add subclass-specific attributes to the outputtoString()
output. Since subclasses are prevented from overridingtoString()
for consistency reasons, they can add their specific attributes to the resulting string by attaching attributes to the suppliedMoreObjects.ToStringHelper
.- Parameters:
toStringHelper
- ToStringHelper onto the attributes can be added- Returns:
- ToStringHelper supplied as input argument.
-
-