private void addNamedFacetAndPluralFacetIfRequired() {
    NamedFacet namedFacet = getFacet(NamedFacet.class);
    if (namedFacet == null) {
      namedFacet = new NamedFacetInferred(NameUtils.naturalName(getShortIdentifier()), this);
      addFacet(namedFacet);
    }

    PluralFacet pluralFacet = getFacet(PluralFacet.class);
    if (pluralFacet == null) {
      pluralFacet = new PluralFacetInferred(NameUtils.pluralName(namedFacet.value()), this);
      addFacet(pluralFacet);
    }
  }
Exemplo n.º 2
0
 /**
  * Return the default label for this member. This is based on the name of this member.
  *
  * @see #getId()
  */
 @Override
 public String getName() {
   final NamedFacet facet = getFacet(NamedFacet.class);
   final String name = facet.value();
   return name != null ? name : defaultName;
 }