• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

raphw / byte-buddy / #642

20 Aug 2024 09:12AM CUT coverage: 85.383% (-0.006%) from 85.389%
#642

push

raphw
Delegate class reader to factories.

28757 of 33680 relevant lines covered (85.38%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/byte-buddy-dep/src/main/java/net/bytebuddy/build/AndroidDescriptor.java
1
/*
2
 * Copyright 2014 - Present Rafael Winterhalter
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package net.bytebuddy.build;
17

18
import net.bytebuddy.description.type.TypeDescription;
19

20
/**
21
 * Provides Android context information to {@link Plugin} instances that include it as
22
 * their constructor parameter.
23
 */
24
public interface AndroidDescriptor {
25

26
    /**
27
     * Provides the scope of the passed {@link TypeDescription} instance.
28
     *
29
     * @param typeDescription The type to get the scope for.
30
     * @return a {@link TypeScope} describing the type's origin.
31
     */
32
    TypeScope getTypeScope(TypeDescription typeDescription);
33

34
    /**
35
     * Describes the origin of a type within an Android project.
36
     */
37
    enum TypeScope {
×
38

39
        /**
40
         * Denotes a type that comes from the local project.
41
         */
42
        LOCAL,
×
43

44
        /**
45
         * Denotes a type that comes from a dependency of the local project.
46
         */
47
        EXTERNAL
×
48
    }
49

50
    /**
51
     * A trivial implementation of an {@link AndroidDescriptor} that returns a fixed value.
52
     */
53
    enum Trivial implements AndroidDescriptor {
×
54

55
        /**
56
         * A descriptor that marks all types as {@link TypeScope#LOCAL}.
57
         */
58
        LOCAL(TypeScope.LOCAL),
×
59

60
        /**
61
         * A descriptor that marks all types as {@link TypeScope#EXTERNAL}.
62
         */
63
        EXTERNAL(TypeScope.EXTERNAL);
×
64

65
        /**
66
         * The type scope to return.
67
         */
68
        private final TypeScope typeScope;
69

70
        /**
71
         * Creates a new trivial android descriptor.
72
         *
73
         * @param typeScope The type scope to return.
74
         */
75
        Trivial(TypeScope typeScope) {
×
76
            this.typeScope = typeScope;
×
77
        }
×
78

79
        /**
80
         * {@inheritDoc}
81
         */
82
        public TypeScope getTypeScope(TypeDescription typeDescription) {
83
            return typeScope;
×
84
        }
85
    }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc