public EntityData(Entity entity) {
if (entity == null) throw new NullPointerException("entity is null");
this.entity = entity;
Attributes attributes = entity.getAttributes();
if (attributes != null) {
for (Id id : attributes.getId()) {
String name = id.getName();
ids.put(name, id);
fields.put(name, id);
}
for (Basic basic : attributes.getBasic()) {
String name = basic.getName();
fields.put(name, basic);
}
for (RelationField relationField : attributes.getOneToOne()) {
String name = relationField.getName();
relations.put(name, relationField);
}
for (RelationField relationField : attributes.getOneToMany()) {
String name = relationField.getName();
relations.put(name, relationField);
}
for (RelationField relationField : attributes.getManyToOne()) {
String name = relationField.getName();
relations.put(name, relationField);
}
for (RelationField relationField : attributes.getManyToMany()) {
String name = relationField.getName();
relations.put(name, relationField);
}
}