Exemplo n.º 1
0
  private String getInverseNameImpl(EntityReference reference) {
    if (reference.getInverseName() != null) return reference.getInverseName();
    String destinationName = destinationName(reference);

    Entity entity = (Entity) reference.eContainer();
    Model model = (Model) entity.eContainer().eContainer();
    Entity destinationEntity = searchEntity(model, destinationName);

    for (EntityReference destinationEntityReference : destinationEntity.getReferences()) {
      Entity destEntity;

      if (destinationEntityReference.getListDestination() != null)
        destEntity = destinationEntityReference.getListDestination();
      else destEntity = destinationEntityReference.getSingleDestination();

      if (!destEntity.equals(entity)) continue;
      if (destinationEntityReference.getInverseName() == null) continue;

      if (destinationEntityReference.getInverseName().equals(reference.getName()))
        return destinationEntityReference.getName();
    }
    return null;
  }
Exemplo n.º 2
0
 public String setterName(EntityReference r) {
   return "set" + firstLetterUp(r.getName());
 }
Exemplo n.º 3
0
 public String removeNameCollection(EntityReference reference) {
   String suffix = firstLetterUp(reference.getName());
   return "remove" + suffix;
 }
Exemplo n.º 4
0
 public String removeName(EntityReference reference) {
   String suffix = firstLetterUp(reference.getName());
   if (suffix.endsWith("s")) suffix = suffix.substring(0, suffix.length() - 1);
   return "remove" + suffix;
 }
Exemplo n.º 5
0
 public String staticName(EntityReference reference) {
   StringBuilder result = allUpperCase(reference.getName());
   return result.toString();
 }