示例#1
0
 public String destinationName(EntityReference reference) {
   if (reference.getListDestination() != null) {
     return reference.getListDestination().getName();
   } else {
     return reference.getSingleDestination().getName();
   }
 }
示例#2
0
 public String setterName(EntityReference r) {
   return "set" + firstLetterUp(r.getName());
 }
示例#3
0
 public String removeNameCollection(EntityReference reference) {
   String suffix = firstLetterUp(reference.getName());
   return "remove" + suffix;
 }
示例#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;
 }
示例#5
0
 public boolean isListReference(EntityReference reference) {
   return reference.getListDestination() != null;
 }
示例#6
0
 public String referenceType(EntityReference reference) {
   if (reference.getListDestination() != null) return ReferenceType.LIST.name();
   return ReferenceType.SINGLE.name();
 }
示例#7
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;
  }
示例#8
0
 public String entityName(EntityReference entityReference) {
   Entity entity = (Entity) entityReference.eContainer();
   return entity.getName();
 }
示例#9
0
 public String staticName(EntityReference reference) {
   StringBuilder result = allUpperCase(reference.getName());
   return result.toString();
 }