public final class GroupEntity extends MetadataEntity
Groups entities. Allows groups hierachy.
Modifier and Type | Class and Description |
---|---|
static class |
GroupEntity.Builder
Builder.
|
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT_NAME
Group element name.
|
static String |
ENTITY_PREFIX
Group entity prefix.
|
static String |
ENTITY_REFERENCE_NAME
Group entity reference name.
|
UUID_COMPARATOR
Modifier and Type | Method and Description |
---|---|
boolean |
addMember(Entity member)
Adds a member to this group.
|
boolean |
cleanUp()
Cleans up unreferenced entities.
|
int |
compareTo(Entity other)
Implements Comparable.
|
boolean |
contains(Entity member,
boolean recursive)
Asks if this group contains a specified member.
|
GroupEntity |
copy()
Creates a copy of this entity.
|
boolean |
equals(Object other)
|
String |
getElementName()
Gets the entity element name.
|
List<Entity> |
getMembers()
Gets the members.
|
<T extends Entity> |
getMembers(Class<T> membersClass)
Gets the immediate members for a given cass.
|
<T extends Entity> |
getMembers(Class<T> membersClass,
boolean recursive)
Gets the members for a given class.
|
String |
getPrefix()
Gets the class prefix.
|
String |
getReferenceName()
Gets the entity reference name.
|
int |
hashCode() |
static GroupEntity.Builder |
newBuilder()
Returns a new builder.
|
addText, getAttributes, getAttributes, getTexts, setAttributes
getName, getNameInUpperCase, getThisLogger, getUUID, setName, setUUID, toString
public static final String ELEMENT_NAME
public static final String ENTITY_PREFIX
public static final String ENTITY_REFERENCE_NAME
@Nonnull @CheckReturnValue public static GroupEntity.Builder newBuilder()
@CheckReturnValue public boolean addMember(@Nonnull Entity member) throws TopologicalErrorException
member
- The new member.TopologicalErrorException
- When a cyclic reference is detected.@CheckReturnValue public boolean cleanUp()
public int compareTo(Entity other)
compareTo
in interface Comparable<Entity>
compareTo
in class AbstractEntity
other
- An other Entity.@CheckReturnValue public boolean contains(@Nonnull Entity member, boolean recursive)
member
- The member.recursive
- True verifies descendant groups members.public GroupEntity copy()
public boolean equals(Object other)
For two Entity
to be equal, they must at least be instances of
the same class, have the same UUID
and name.
For two Metadata
Entity
to be equal, they must at
least be instances of the same class, have the same UUID
,
Attributes
, name and descriptive texts.
equals
in class MetadataEntity
public String getElementName()
The entity element is used to in the generation of the entity URI.
@Nonnull @CheckReturnValue public List<Entity> getMembers()
@Nonnull @CheckReturnValue public <T extends Entity> Set<T> getMembers(@Nonnull Class<T> membersClass)
The returned set, if not empty, is the original.
T
- The type of the returned values.membersClass
- The class of the requested members.@Nonnull @CheckReturnValue public <T extends Entity> Set<T> getMembers(@Nonnull Class<T> membersClass, boolean recursive)
The returned set, even when recursive is true, is not the original.
T
- The type of the returned values.membersClass
- The class of the requested members.recursive
- True adds descendant groups members.public String getPrefix()
Each concrete entity subclass has its own prefix which will be the same for all its instances. This prefix is used to avoid name collision between different classes in a common registry.
public String getReferenceName()
public int hashCode()
hashCode
in class MetadataEntity
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.