blob: a7b7805cde8fb861b8a601ede1c051ebb51ee006 [file] [log] [blame]
<!--
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.
-->
<body>
<h1>Step 1 - Creating a ServiceComposite</h1>
<p>
In this tutorial we start with basic Java classes, to simulate a very simple Library where you can borrow
and return books.
</p>
<p>
Apache Zestâ„¢ relies heavily on the use of interfaces. This makes it possible for an object
to externally implement a number of interfaces which internally is backed by a number
of Mixins, some of which you may have written yourself, and some of which may have been
reused. This is also true for services, which we are to cover in this tutorial.
</p>
<p>
The first task is therefore to refactor the code so that the methods are implemented from an
interface instead, and to essentially make the identical "application" into a Zestâ„¢ application.
We also want the Book to be a ValueComposite.
</p>
<p>Steps for this tutorial:</p>
<ol>
<li>Make the Book into a ValueComposite.</li>
<li>Make the Library an interface with the same methods. We call this a <i>Mixin Type</i></li>
<li>Create a LibraryMixin class, which implements the Library interface.</li>
<li>Create a LibraryService that binds the LibraryMixin.</li>
<li>The LibraryMixin will need to be injected with the <code>ValueBuilderFactory</code> in the
<code>@Structure</code> scope.
</li>
</ol>
</body>