コード例 #1
0
 @Override
 ObjectAdapter recreateAdapter(
     final ObjectAdapterMemento oam, ConcurrencyChecking concurrencyChecking) {
   ObjectSpecId objectSpecId = oam.objectSpecId;
   ObjectSpecification objectSpec = SpecUtils.getSpecificationFor(objectSpecId);
   final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
   return encodableFacet.fromEncodedString(oam.encodableValue);
 }
コード例 #2
0
  private void init(final ObjectAdapter adapter) {

    final ObjectSpecification specification = adapter.getSpecification();

    final EncodableFacet encodableFacet = specification.getFacet(EncodableFacet.class);
    final boolean isEncodable = encodableFacet != null;
    if (isEncodable) {
      encodableValue = encodableFacet.toEncodedString(adapter);
      type = Type.ENCODEABLE;
      return;
    }

    final RootOid oid = (RootOid) adapter.getOid();
    if (oid.isTransient()) {
      transientMemento = new Memento(adapter);
      type = Type.TRANSIENT;
      return;
    }

    persistentOidStr = oid.enString(getOidMarshaller());
    type = Type.PERSISTENT;
  }