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.thing.java.test; 019 020import com.google.errorprone.annotations.CanIgnoreReturnValue; 021 022import dev.enola.thing.Thing; 023import dev.enola.thing.impl.IImmutableThing; 024import dev.enola.thing.java.HasType; 025import dev.enola.thing.java.RdfClass; 026import dev.enola.thing.java.TBF; 027 028import org.jspecify.annotations.Nullable; 029 030import java.time.Instant; 031 032// TODO Generate this, from a model 033@RdfClass(iri = TestSomething.CLASS_IRI) 034public interface TestSomething extends HasType, HasA, HasB, IImmutableThing { 035 036 String TEST_PROPERTY_IRI = "https://example.org/test"; 037 String CLASS_IRI = "https://example.org/TestSomething"; 038 039 default @Nullable String test() { 040 return getString(TestSomething.TEST_PROPERTY_IRI); 041 } 042 043 @Override 044 Builder<? extends TestSomething> copy(); 045 046 interface Builder<B extends TestSomething> // skipcq: JAVA-E0169 047 extends HasType.Builder<B>, HasA.Builder<B>, HasB.Builder<B>, Thing.Builder<B> { 048 049 @CanIgnoreReturnValue 050 default Builder<B> test(String test) { 051 set(TestSomething.TEST_PROPERTY_IRI, test); 052 return this; 053 } 054 055 @Override 056 @CanIgnoreReturnValue 057 default Builder<B> a(Long test) { 058 HasA.Builder.super.a(test); 059 return this; 060 } 061 062 @Override 063 @CanIgnoreReturnValue 064 default Builder<B> b(Instant test) { 065 HasB.Builder.super.b(test); 066 return this; 067 } 068 069 @Override 070 @CanIgnoreReturnValue 071 default Builder<B> addType(String typeIRI) { 072 HasType.Builder.super.addType(typeIRI); 073 return this; 074 } 075 076 @Override 077 @CanIgnoreReturnValue 078 Builder<B> iri(String iri); 079 } 080 081 @SuppressWarnings("unchecked") 082 static Builder<TestSomething> builder(TBF tbf) { 083 return tbf.create(Builder.class, TestSomething.class); 084 } 085 086 @SuppressWarnings("unchecked") 087 static Builder<TestSomething> builder() { 088 return builder(new TestSomethingTBF()); 089 } 090}