public final class PackageRelationshipCollection extends java.lang.Object implements java.lang.Iterable<PackageRelationship>
Constructor and Description |
---|
PackageRelationshipCollection(OPCPackage container)
Constructor.
|
PackageRelationshipCollection(OPCPackage container, PackagePart part)
Constructor.
|
PackageRelationshipCollection(PackagePart part)
Constructor.
|
PackageRelationshipCollection(PackageRelationshipCollection coll, java.lang.String filter)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addRelationship(PackageRelationship relPart)
Add the specified relationship to the collection.
(将指定的关系添加到集合中。)
|
PackageRelationship |
addRelationship(java.net.URI targetUri, TargetMode targetMode, java.lang.String relationshipType, java.lang.String id)
Add a relationship to the collection.
(向集合添加关系。)
|
void |
clear()
Clear all relationships.
(清除所有关系。)
|
PackageRelationship |
findExistingInternalRelation(PackagePart packagePart) |
PackageRelationship |
getRelationship(int index)
Retrieves a relationship by its index in the collection.
(通过集合中的索引检索关系。)
|
PackageRelationship |
getRelationshipByID(java.lang.String id)
Retrieves a package relationship based on its id.
(根据 id 检索包关系。)
|
PackageRelationshipCollection |
getRelationships(java.lang.String typeFilter)
Retrieves all relations with the specified type.
(检索具有指定类型的所有关系。)
|
java.util.Iterator<PackageRelationship> |
iterator()
Get this collection's iterator.
(获取此集合的迭代器。)
|
java.util.Iterator<PackageRelationship> |
iterator(java.lang.String typeFilter)
Get an iterator of a collection with all relationship with the specified type.
(获取与指定类型具有所有关系的集合的迭代器。)
|
void |
parseRelationshipsPart(PackagePart relPart)
Parse the relationship part and add all relationship in this collection.
(解析关系部分并添加此集合中的所有关系。)
|
void |
removeRelationship(java.lang.String id)
Remove a relationship by its ID.
(通过 ID 删除关系。)
|
int |
size()
Get the numbe rof relationships in the collection.
(获取集合中的 numbe rof 关系。)
|
java.lang.String |
toString() |
public PackageRelationshipCollection(PackageRelationshipCollection coll, java.lang.String filter)
coll
- Collection to import.
(coll - 要导入的集合。)
filter
- Relationship type filter.
(filter - 关系类型过滤器。)
public PackageRelationshipCollection(OPCPackage container) throws InvalidFormatException
InvalidFormatException
(无效格式异常)
public PackageRelationshipCollection(PackagePart part) throws InvalidFormatException
InvalidFormatException
- Throws if the format of the content part is invalid.
(InvalidFormatException - 如果内容部分的格式无效,则抛出。)
InvalidOperationException
- Throws if the specified part is a relationship part.
(InvalidOperationException - 如果指定的部分是关系部分,则抛出。)
public PackageRelationshipCollection(OPCPackage container, PackagePart part) throws InvalidFormatException
container
- The parent package.
(容器 - 父包。)
part
- The part that own this relationships collection. If
null then this part is considered as the package root.
(part - 拥有此关系集合的部分。如果为 null,则此部分被视为包根。)
InvalidFormatException
- If an error occurs during the parsing of the relatinships part fo the specified part.
(InvalidFormatException - 如果在解析指定部分的关系部分期间发生错误。)
public void addRelationship(PackageRelationship relPart)
relPart
- The relationship to add.
(relPart - 要添加的关系。)
public PackageRelationship addRelationship(java.net.URI targetUri, TargetMode targetMode, java.lang.String relationshipType, java.lang.String id)
targetUri
- Target URI.
(targetUri - 目标 URI。)
targetMode
- The target mode : INTERNAL or EXTERNAL
(targetMode - 目标模式:内部或外部)
relationshipType
- Relationship type.
(relationshipType - 关系类型。)
id
- Relationship ID.
(id - 关系 ID。)
PackageAccess
public void removeRelationship(java.lang.String id)
id
- The relationship ID to remove.
(id - 要删除的关系 ID。)
public PackageRelationship getRelationship(int index)
index
- Must be a value between [0-relationships_count-1]
(index - 必须是 [0-relationships_count-1] 之间的值)
public PackageRelationship getRelationshipByID(java.lang.String id)
id
- ID of the package relationship to retrieve.
(id - 要检索的包关系的 ID。)
public int size()
public void parseRelationshipsPart(PackagePart relPart) throws InvalidFormatException
relPart
- The package part to parse.
(relPart - 要解析的包部分。)
InvalidFormatException
- Throws if the relationship part is invalid.
(InvalidFormatException - 如果关系部分无效,则抛出。)
public PackageRelationshipCollection getRelationships(java.lang.String typeFilter)
typeFilter
- Relationship type filter. If
null then all relationships are returned.
(typeFilter - 关系类型过滤器。如果为 null,则返回所有关系。)
public java.util.Iterator<PackageRelationship> iterator()
iterator
in interface
java.lang.Iterable<PackageRelationship>
(接口 java.lang.Iterable 中的迭代器
public java.util.Iterator<PackageRelationship> iterator(java.lang.String typeFilter)
typeFilter
- Type filter.
(typeFilter - 类型过滤器。)
public void clear()
public PackageRelationship findExistingInternalRelation(PackagePart packagePart)
public java.lang.String toString()
toString
in class
java.lang.Object
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.