com.canoo.dolphin.server.DolphinController Maven / Gradle / Ivy
Show all versions of dolphin-platform-server Show documentation
/*
* Copyright 2015-2017 Canoo Engineering AG.
*
* Licensed 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 com.canoo.dolphin.server;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Annotation to define a Dolphin controller. A Dolphin Controller is the server side controller of a MVC group / widget.
* When using Dolphin Plaftorm your application is seperated in a hirarchie of several MVC groups. Each MVC group defines
* a client side view, a server side controller and a model that is automatically shared between the client and server.
*
*
*
*
* Each dolphin controller must be annotated with {@link com.canoo.dolphin.server.DolphinController}.
* A dolphin controller will automatically managed by the container (spring or JavaEE) and the lifecycle
* of the controller is bound to the view lifecycle. A server site controller will be automatically created
* when a macthing controller proxy is created at the client. This means that you can have several instances of
* a dolphin controller on the server, one for each matching view instance. This will happen if several clients use the
* same view or a view is shown several times in a client.
*
*
* Since the controller instances are managed by the platform you can use all teh default annotations and APIs
* that are supported by the Platform like {@link javax.annotation.PostConstruct} or {@link javax.inject.Inject}.
* In addition Dolphin Platform supports some custom annotations that can be used in a controller:
*
* - {@link com.canoo.dolphin.server.DolphinModel}
* - {@link com.canoo.dolphin.server.DolphinAction}
* - {@link com.canoo.dolphin.server.Param}
*
*
*
* Example:
*
*
* {@literal @}DolphinController("my-controller")
* public class MyController {
*
* {@literal @}DolphinModel
* private MyModel model;
*
* {@literal @}DolphinAction()
* private void onAction() { . . . };
* }
*
*
*
*/
@Documented
@Inherited
@Retention(RUNTIME)
@Target(ElementType.TYPE)
public @interface DolphinController {
String value() default "";
}