001/*
002 * SPDX-License-Identifier: Apache-2.0
003 *
004 * Copyright 2024-2026 The Enola <https://enola.dev> Authors
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     https://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package dev.enola.model.enola.java;
019
020import dev.enola.model.enola.HasName;
021import dev.enola.thing.Thing;
022
023/**
024 * ☕ <a href="https://docs.enola.dev/models/enola.dev/java/type/">Java Type</a>.
025 *
026 * <p>Type (Class, Interface, Enum, Record, Primitives, Array, Void) in the Java Virtual Machine
027 * (JVM).
028 */
029// "https://enola.dev/java/type" - "https://enola.dev/java/type/{FQN}"
030public interface Type
031        extends /*Resource,*/ HasName { // NOT dev.enola.model.w3.rdfs.Class; these are the
032    // instances
033
034    // TODO default "https://enola.dev/java/package"
035    Package pkg();
036
037    // TODO default "https://enola.dev/java/type-kind"
038    Kind kind();
039
040    // TODO default "https://enola.dev/code/uses"
041    Iterable<Type> uses();
042
043    // TODO default "https://enola.dev/code/oop/parents" // parents extends #uses
044    Iterable<Type> parents();
045
046    // TODO How to best do enums with (RDF) Things?
047    enum Kind {
048        Class,
049        Interface,
050        Enum,
051        Record,
052        Primitives,
053        Array,
054        Void
055    }
056
057    interface Builder<B extends Type> extends Thing.Builder<B> { // skipcq: JAVA-E0169
058
059        Builder<B> label(String label);
060
061        Builder<B> pkg(Package pkg);
062
063        Builder<B> kind(Kind kind);
064
065        Builder<B> addUses(Type uses);
066
067        Builder<B> addParents(Type parents);
068    }
069}