private void addValue() {
    final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);

    // use the runtime type if we have a value, else the compile time type of the member otherwise
    final ObjectSpecification spec =
        valueAdapter != null ? valueAdapter.getSpecification() : objectMember.getSpecification();

    final ValueFacet valueFacet = spec.getFacet(ValueFacet.class);
    if (valueFacet != null) {
      String format = null;
      final Class<?> specClass = spec.getCorrespondingClass();
      if (specClass == java.math.BigDecimal.class) {
        // look for facet on member, else on the value's spec
        final BigDecimalValueFacet bigDecimalValueFacet =
            getFacet(
                BigDecimalValueFacet.class,
                objectMember,
                valueAdapter != null ? valueAdapter.getSpecification() : null);
        if (bigDecimalValueFacet != null) {
          final Integer precision = bigDecimalValueFacet.getPrecision();
          final Integer scale = bigDecimalValueFacet.getScale();
          format = String.format("big-decimal(%d,%d)", precision, scale);
        }
      } else if (specClass == java.math.BigInteger.class) {
        // TODO: need to extend BigIntegerValueFacet similar to BigDecimalValueFacet
      }
      JsonValueEncoder.appendValueAndFormat(spec, valueAdapter, representation, format);
      return;
    }

    final RenderFacet renderFacet = objectMember.getFacet(RenderFacet.class);
    boolean eagerlyRender =
        renderFacet != null
            && renderFacet.value() == Type.EAGERLY
            && rendererContext.canEagerlyRender(valueAdapter);

    if (valueAdapter == null) {
      representation.mapPut("value", NullNode.getInstance());
    } else {
      final TitleFacet titleFacet = spec.getFacet(TitleFacet.class);
      final String title = titleFacet.title(valueAdapter, rendererContext.getLocalization());

      final LinkBuilder valueLinkBuilder =
          DomainObjectReprRenderer.newLinkToBuilder(rendererContext, Rel.VALUE, valueAdapter)
              .withTitle(title);
      if (eagerlyRender) {
        final DomainObjectReprRenderer renderer =
            new DomainObjectReprRenderer(
                rendererContext, getLinkFollowSpecs(), JsonRepresentation.newMap());
        renderer.with(valueAdapter);
        if (mode.isEventSerialization()) {
          renderer.asEventSerialization();
        }

        valueLinkBuilder.withValue(renderer.render());
      }

      representation.mapPut("value", valueLinkBuilder.build());
    }
  }
 @Override
 public String getTitle(
     ObjectAdapter contextAdapterIfAny, ObjectAdapter targetAdapter, Localization localization) {
   if (titleFacet != null) {
     final String titleString = titleFacet.title(contextAdapterIfAny, targetAdapter, localization);
     if (titleString != null && !titleString.equals("")) {
       return titleString;
     }
   }
   return (this.isService() ? "" : "Untitled ") + getSingularName();
 }