/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */

package org.apache.isis.applib;

import org.apache.isis.applib.annotation.Programmatic;

/**
 * Indicates that an object belongs to the UI/application layer, and is intended to be used as a view model.
 *
 * <p>
 *     Objects that are part of the domain object layer should instead implement {@link RecreatableDomainObject}.
 * </p>
 *
 * @since 1.x {@index}
 */
public interface ViewModel {

    /**
     * Obtain a memento of the view model.
     *
     * <p>
     * Typically this will be the identifier of a backing domain entity, but it could also be an arbitrary string,
     * for example a bunch of JSON.
     *
     * <p>
     * This method is called by the framework in order that the view model may be recreated subsequently
     * through {@link #viewModelInit(String)}.
     */
    @Programmatic
    String viewModelMemento();

    /**
     * Used to re-initialize a view model with a memento obtained from {@link #viewModelMemento()}.
     */
    @Programmatic
    void viewModelInit(String memento);

//    /**
//     * Cloneable view models can in effect appear to be editable; the viewer can build a new view model from a
//     * view model whose state has been edited.
//     */
//    public interface Cloneable {
//        /**
//         *
//         * @return a copy of this object - injection points are automatically resolved by the framework
//         */
//        @Programmatic
//        Object copy();
//    }
//
//    /**
//     * Specialization of {@link ViewModel.Cloneable},
//     * that utilizes Java serialization to in-memory create ViewModel clones.
//     * @since 2.0
//     */
//    public interface CloneableViaSerialization
//    extends
//        Cloneable,
//        Serializable {
//        @Override
//        @Programmatic
//        default Object copy() {
//            val bytes = _Serializables.write(this);
//            val copy =  _Serializables.read(this.getClass(), bytes);
//            return copy;
//        }
//    }
//
//    /**
//     * Specialization of {@link ViewModel.Cloneable},
//     * that utilizes {@link ViewModel}'s mementos to in-memory create ViewModel clones.
//     * @since 2.0
//     */
//    public interface CloneableViaMemento
//    extends
//        Cloneable,
//        ViewModel {
//        @Override
//        @Programmatic
//        @SneakyThrows
//        default Object copy() {
//            val memento = this.viewModelMemento();
//            val copy =  this.getClass().getDeclaredConstructor().newInstance();
//            copy.viewModelInit(memento);
//            return copy;
//        }
//    }


}

@@ -1841,1583 +1841,6 @@
 );%0A%0A
-//    /**%0A//     * Cloneable view models can in effect appear to be editable; the viewer can build a new view model from a%0A//     * view model whose state has been edited.%0A//     */%0A//    public interface Cloneable %7B%0A//        /**%0A//         *%0A//         * @return a copy of this object - injection points are automatically resolved by the framework%0A//         */%0A//        @Programmatic%0A//        Object copy();%0A//    %7D%0A//%0A//    /**%0A//     * Specialization of %7B@link ViewModel.Cloneable%7D,%0A//     * that utilizes Java serialization to in-memory create ViewModel clones.%0A//     * @since 2.0%0A//     */%0A//    public interface CloneableViaSerialization%0A//    extends%0A//        Cloneable,%0A//        Serializable %7B%0A//        @Override%0A//        @Programmatic%0A//        default Object copy() %7B%0A//            val bytes = _Serializables.write(this);%0A//            val copy =  _Serializables.read(this.getClass(), bytes);%0A//            return copy;%0A//        %7D%0A//    %7D%0A//%0A//    /**%0A//     * Specialization of %7B@link ViewModel.Cloneable%7D,%0A//     * that utilizes %7B@link ViewModel%7D's mementos to in-memory create ViewModel clones.%0A//     * @since 2.0%0A//     */%0A//    public interface CloneableViaMemento%0A//    extends%0A//        Cloneable,%0A//        ViewModel %7B%0A//        @Override%0A//        @Programmatic%0A//        @SneakyThrows%0A//        default Object copy() %7B%0A//            val memento = this.viewModelMemento();%0A//            val copy =  this.getClass().getDeclaredConstructor().newInstance();%0A//            copy.viewModelInit(memento);%0A//            return copy;%0A//        %7D%0A//    %7D%0A%0A%0A
 %7D%0A

remove comments