Class ContainerUnit
java.lang.Object
com.pnfsoftware.jeb.core.events.JebEventSource
com.pnfsoftware.jeb.core.units.AbstractUnit
com.pnfsoftware.jeb.core.units.impl.ContainerUnit
- All Implemented Interfaces:
IUnitCreator,IUserDataSupport,IUnit,IEventSource
- Direct Known Subclasses:
DataContainerUnit,FileContainerUnit,LazyDataContainerUnit
Container units are non-binary units used to represent tree structures.
Children can be attached to container units; it is recommended that clients handle container units as if they were file system folders (eg, displaying children should take priority over displaying container unit details).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<IUnit> Comparator that sorts container units before leaf units, then by name.Fields inherited from class com.pnfsoftware.jeb.core.events.JebEventSource
onEventCallCount -
Constructor Summary
ConstructorsConstructorDescriptionContainerUnit(String name, IUnitProcessor unitProcessor, IUnitCreator parent, IPropertyDefinitionManager pdm) Create a container unit of the "composite" format type.ContainerUnit(String formatType, String name, IUnitProcessor unitProcessor, IUnitCreator parent, IPropertyDefinitionManager pdm) Create a container unit. -
Method Summary
Modifier and TypeMethodDescriptionbooleanSub-classes overriding this method must override related methods consistently.Get the top-level container unit, within a hierarchy of containers.inthashCode()booleanprocess()The default implementation callsAbstractUnit.processInternal(), and makes sure that a status string is set on error, or nullified on success.booleanprocess(boolean processLeaves) Process the container.Methods inherited from class com.pnfsoftware.jeb.core.units.AbstractUnit
addChild, addChild, addChild, addNotification, canBePersisted, clearAllData, dispose, finalize, generateQuickState, getAllData, getContributions, getCreationTimestamp, getData, getDescription, getFormatter, getFormatType, getIconData, getInterpreters, getLock, getName, getNotes, getNotificationManager, getParent, getPropertyDefinitionManager, getPropertyManager, getRealName, getStatus, getUid, getUnitProcessor, hasChildren, initializePropertyObjects, internalSwapChildren, isDeserialized, isDisposed, isProcessed, isStale, isTransientChild, logError, logException, logInfo, logTrace, logWarn, onPropertyChange, postDeserialization, processInternal, removeChild, removeChild, setChild, setChild, setData, setName, setNotes, setParent, setProcessed, setProcessed, setRealName, setStatus, setStatus, setUnitProcessor, toStringMethods inherited from class com.pnfsoftware.jeb.core.events.JebEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, notifyListeners, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.core.units.IUnit
execprvfunc, getExtraInputs, getInput, getParentArtifact, getParentProject, notifyGenericChange
-
Field Details
-
CONTAINERS_FIRST
Comparator that sorts container units before leaf units, then by name.
-
-
Constructor Details
-
ContainerUnit
public ContainerUnit(String formatType, String name, IUnitProcessor unitProcessor, IUnitCreator parent, IPropertyDefinitionManager pdm) Create a container unit.- Parameters:
formatType- unit format typename- unit nameunitProcessor- unit processorparent- parent unit or artifactpdm- property definition manager
-
ContainerUnit
public ContainerUnit(String name, IUnitProcessor unitProcessor, IUnitCreator parent, IPropertyDefinitionManager pdm) Create a container unit of the "composite" format type.- Parameters:
name- unit nameunitProcessor- unit processorparent- parent unit or artifactpdm- property definition manager
-
-
Method Details
-
process
public boolean process()Description copied from class:AbstractUnitThe default implementation callsAbstractUnit.processInternal(), and makes sure that a status string is set on error, or nullified on success. processInternal() is never called isAbstractUnit.isProcessed()returns true.Plugins may decide to override this method, if they need finer control over processing (we recommend overriding processInternal(); in that case, processInternal() should be ignored.
- Specified by:
processin interfaceIUnit- Overrides:
processin classAbstractUnit- Returns:
- true if processing is or was successful (in the latter case, process() should do
nothing but return true), or false is processing failed. The unit should also notify
clients by issuing a
J.UnitProcessedevent. If processing succeeded, subsequent calls toIUnit.isProcessed()should return true.
-
process
public boolean process(boolean processLeaves) Process the container.- Parameters:
processLeaves- true to process leaf units- Returns:
- true if processing succeeded
-
equals
-
hashCode
public int hashCode() -
getRootContainer
Get the top-level container unit, within a hierarchy of containers.- Returns:
- the first non-container parent
-
getChildren
Description copied from class:AbstractUnitSub-classes overriding this method must override related methods consistently.- Specified by:
getChildrenin interfaceIUnit- Overrides:
getChildrenin classAbstractUnit- Returns:
- the children or an empty list, never null
-