public abstract class Entity extends Any {
- private Set<Relation> relations = new HashSet<Relation>();
+ private final Set<Relation> relations = new HashSet<Relation>();
// ==============================================================================================================================
// Constructors
protected Entity () {
}
// Initialization constructor
- protected Entity (ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+ protected Entity (final ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
super(prop);
}
// Public member functions
// ==============================================================================================================================
- public Relation getFirstRelation (Class<? extends Relation> type) {
+ public Relation getFirstRelation (final Class<? extends Relation> type) {
// -----------------------------------------------------------------
for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
Relation link = i.next();
- if (link.getClass().equals(type)) return link;
+ if (link.getClass().equals(type)) {
+ return link;
+ }
}
return null;
}
- public List<Relation> getRelations (Class<? extends Relation> type) {
+ public List<Relation> getRelations (final Class<? extends Relation> type) {
List<Relation> result = new Vector<Relation>();
for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
Relation link = i.next();
- if (link.getClass().equals(type)) result.add(link);
+ if (link.getClass().equals(type)) {
+ result.add(link);
+ }
}
return result;
}
// Protected services
// ==============================================================================================================================
- protected Set<Relation> getAllRelations () {
+ public Set<Relation> getAllRelations () {
return relations;
}
- protected Relation addRelation (Relation link) {
+ public Relation addRelation (Relation link) {
relations.add(link);
return link;
}
- protected void removeRelation (Class<? extends Relation> type, Persistent to) {
+ public void removeRelation (final Class<? extends Relation> type, final Persistent to) {
for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
Relation link = i.next();
- if (!link.getClass().equals(type)) continue;
- if (!link.getTo().equals(to)) continue;
+ if (!link.getClass().equals(type)) {
+ continue;
+ }
+ if (!link.getTo().equals(to)) {
+ continue;
+ }
i.remove();
return;
}