ResourcesAwareConstants.java
01 /*
02  * SPDX-License-Identifier: Apache-2.0
03  *
04  * Copyright 2008-2021 the original author or authors.
05  *
06  * Licensed under the Apache License, Version 2.0 (the "License");
07  * you may not use this file except in compliance with the License.
08  * You may obtain a copy of the License at
09  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package org.codehaus.griffon.compile.core;
19 
20 import static org.codehaus.griffon.compile.core.MethodDescriptor.annotatedMethod;
21 import static org.codehaus.griffon.compile.core.MethodDescriptor.annotations;
22 import static org.codehaus.griffon.compile.core.MethodDescriptor.args;
23 import static org.codehaus.griffon.compile.core.MethodDescriptor.type;
24 
25 /**
26  @author Andres Almiray
27  */
28 public interface ResourcesAwareConstants extends BaseConstants {
29     String RESOURCE_HANDLER_TYPE = "griffon.core.resources.ResourceHandler";
30     String RESOURCE_HANDLER_PROPERTY = "resourceHandler";
31 
32     String METHOD_GET_RESOURCE_AS_URL = "getResourceAsURL";
33     String METHOD_GET_RESOURCE_AS_STREAM = "getResourceAsStream";
34     String METHOD_GET_RESOURCES = "getResources";
35     String METHOD_CLASSLOADER = "classloader";
36 
37     MethodDescriptor[] METHODS = new MethodDescriptor[]{
38         annotatedMethod(
39             annotations(JAVAX_ANNOTATION_NULLABLE),
40             type(JAVA_NET_URL),
41             METHOD_GET_RESOURCE_AS_URL,
42             args(MethodDescriptor.annotatedType(annotations(JAVAX_ANNOTATION_NONNULL), JAVA_LANG_STRING))
43         ),
44         annotatedMethod(
45             annotations(JAVAX_ANNOTATION_NULLABLE),
46             type("java.io.InputStream"),
47             METHOD_GET_RESOURCE_AS_STREAM,
48             args(MethodDescriptor.annotatedType(annotations(JAVAX_ANNOTATION_NONNULL), JAVA_LANG_STRING))
49         ),
50         annotatedMethod(
51             annotations(JAVAX_ANNOTATION_NULLABLE),
52             type(JAVA_UTIL_LIST, JAVA_NET_URL),
53             METHOD_GET_RESOURCES,
54             args(MethodDescriptor.annotatedType(annotations(JAVAX_ANNOTATION_NONNULL), JAVA_LANG_STRING))
55         ),
56         annotatedMethod(
57             annotations(JAVAX_ANNOTATION_NONNULL),
58             type("java.lang.ClassLoader"),
59             METHOD_CLASSLOADER
60         )
61     };
62 }