Class Body
- Direct Known Subclasses:
SourceElementBody
IElement
.
This implementation is thread-safe under the condition that mutator methods are not invoked concurrently. If multiple threads access a body concurrently, and at most one of them modifies the body, which is the typical usage pattern, external synchronization is not required.
Clients can use this class as it stands or subclass it as circumstances warrant.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given child element to this body if it is not already present.void
findContentChange
(Body oldBody, IElement element, IElementDeltaBuilder builder) Finds whether this body has had a content change.IElement[]
Returns the child elements for this body.void
removeChild
(IElement child) Removes the given child element from this body if it is present.void
setChildren
(IElement[] children) Sets the child elements for this body.
-
Constructor Details
-
Body
public Body()
-
-
Method Details
-
getChildren
Returns the child elements for this body.This implementation returns an array of exactly the same runtime type as the array given in the most recent call to
setChildren
.- Returns:
- the child elements for this body (never
null
). Clients must not modify the returned array.
-
setChildren
Sets the child elements for this body. Clients must not modify the given array afterwards.- Parameters:
children
- notnull
, must not containnull
elements
-
addChild
Adds the given child element to this body if it is not already present. Throws a runtime exception if the class of the given element prevents it from being added.- Parameters:
child
- notnull
-
removeChild
Removes the given child element from this body if it is present.- Parameters:
child
- may benull
-
findContentChange
Finds whether this body has had a content change.Implementations can compare this body and the given old body and, if there are differences (excepting children), insert an appropriate change delta (such as
F_CONTENT
) for the given element into the delta tree being built. Implementations should not take changes in children into account.- Parameters:
oldBody
- the old version of the body (notnull
)element
- the element this body corresponds to (notnull
)builder
- represents the delta tree being built (notnull
)
-