Class Body
- java.lang.Object
-
- org.eclipse.handly.model.impl.support.Body
-
- Direct Known Subclasses:
SourceElementBody
public class Body extends java.lang.Object
Holds cached structure and properties for anIElement
.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:
IBodyCache
-
-
Constructor Summary
Constructors Constructor Description Body()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(IElement child)
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[]
getChildren()
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.
-
-
-
Method Detail
-
getChildren
public IElement[] 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
public void setChildren(IElement[] children)
Sets the child elements for this body. Clients must not modify the given array afterwards.- Parameters:
children
- notnull
, must not containnull
elements
-
addChild
public void addChild(IElement child)
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
public void removeChild(IElement child)
Removes the given child element from this body if it is present.- Parameters:
child
- may benull
-
findContentChange
public void findContentChange(Body oldBody, IElement element, IElementDeltaBuilder builder)
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
)
-
-