2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.shale.test.el;
19  
20  import java.beans.FeatureDescriptor;
21  import javax.el.ELResolver;
22  
23  /***
24   * <p>Convenience base class for EL resolvers.</p>
25   */
26  abstract class AbstractELResolver extends ELResolver {
27      
28  
29  
30      // ------------------------------------------------------- Protected Methods
31  
32  
33      /***
34       * <p>Create and return a <code>FeatureDescriptor</code> configured with
35       * the specified arguments.</p>
36       *
37       * @param name Feature name
38       * @param displayName Display name
39       * @param description Short description
40       * @param expert Flag indicating this feature is for experts
41       * @param hidden Flag indicating this feature should be hidden
42       * @param preferred Flag indicating this feature is the preferred one
43       *  among features of the same type
44       * @param type Runtime type of this feature
45       * @param designTime Flag indicating feature is resolvable at design time
46       */
47      protected FeatureDescriptor descriptor(String name, String displayName,
48        String description, boolean expert, boolean hidden, boolean preferred,
49        Object type, boolean designTime) {
50  
51        FeatureDescriptor descriptor = new FeatureDescriptor();
52  
53        descriptor.setName(name);
54        descriptor.setDisplayName(displayName);
55        descriptor.setShortDescription(description);
56        descriptor.setExpert(expert);
57        descriptor.setHidden(hidden);
58        descriptor.setPreferred(preferred);
59        descriptor.setValue(ELResolver.TYPE, type);
60        if (designTime) {
61            descriptor.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
62        } else {
63            descriptor.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, Boolean.FALSE);
64        }
65  
66        return descriptor;
67  
68      }
69  
70  
71  }