Skip to content

Commit

Permalink
Checkstyle fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-langer committed Jan 28, 2025
1 parent e29fd56 commit 465f1a0
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.helidon.common.types.Annotation;
import io.helidon.common.types.TypeName;

class LangchainTypes {
final class LangchainTypes {
static final TypeName AI_SERVICE = TypeName.create("io.helidon.integrations.langchain4j.Ai.Service");
static final TypeName AI_CHAT_MODEL = TypeName.create("io.helidon.integrations.langchain4j.Ai.ChatModel");
static final TypeName AI_STREAMING_CHAT_MODEL = TypeName.create("io.helidon.integrations.langchain4j.Ai.StreamingChatModel");
Expand All @@ -41,4 +41,7 @@ class LangchainTypes {
static final TypeName LC_MODERATION_MODEL = TypeName.create("dev.langchain4j.model.moderation.ModerationModel");
static final TypeName LC_RETRIEVAL_AUGMENTOR = TypeName.create("dev.langchain4j.rag.RetrievalAugmentor");
static final TypeName LC_CONTENT_RETRIEVER = TypeName.create("dev.langchain4j.rag.content.retriever.ContentRetriever");

private LangchainTypes() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@

import static io.helidon.integrations.langchain4j.codegen.LangchainTypes.LC_TOOL;

/**
* A {@link java.util.ServiceLoader} provider implementation of a {@link io.helidon.codegen.spi.TypeMapperProvider}
* to handle Tool annotated types.
*/
public class LcToolsMapperProvider implements TypeMapperProvider {
/**
* Public no-arg constructor required by {@link java.util.ServiceLoader}.
*/
public LcToolsMapperProvider() {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Integration with Langchain4j.
*
* @see io.helidon.integrations.langchain4j.Ai
*/
package io.helidon.integrations.langchain4j;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public final class TypeFactory {
private TypeFactory() {
}

/**
* Create a class from a type name.
* This is using {@link java.lang.Class#forName(String)} to obtain a class instance.
*
* @param typeName type to convert to class
* @return a class representing the type (ignoring generics)
* @throws java.lang.IllegalArgumentException in case the class cannot be created
*/
public static Class<?> toClass(TypeName typeName) {
try {
return Class.forName(typeName.fqName());
Expand All @@ -45,6 +53,12 @@ public static Class<?> toClass(TypeName typeName) {
}
}

/**
* Convert a type name to a {@link java.lang.reflect.Type}.
*
* @param typeName type name
* @return a Type representing the type name, may be a class, wildcard, or parameterized type
*/
public static Type toType(TypeName typeName) {
if (typeName.wildcard()) {
return new WildcardTypeImpl(typeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@
import jakarta.enterprise.inject.spi.Extension;
import org.jboss.weld.literal.NamedLiteral;

/**
* {@link java.util.ServiceLoader} provider implementation of CDI extension to add service registry types as CDI beans.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class InjectExtension implements Extension {
public class ServiceRegistryExtension implements Extension {
@SuppressWarnings("unchecked")
void registerQualifiers(@Observes BeforeBeanDiscovery bbd) {
var registry = GlobalServiceRegistry.registry();
Expand Down
2 changes: 1 addition & 1 deletion microprofile/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

provides jakarta.enterprise.inject.spi.Extension
with io.helidon.microprofile.cdi.ExecuteOnExtension,
io.helidon.microprofile.cdi.InjectExtension;
ServiceRegistryExtension;

opens io.helidon.microprofile.cdi to weld.core.impl;

Expand Down
2 changes: 1 addition & 1 deletion microprofile/cdi/src/test/resources/logging.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n

org.jboss.level=INFO
org.jboss.level=INFO
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ default List<ServiceInfo> allServices(Class<?> contract) {
* lookups trigger a full registry scan.
*
* @param lookup lookup criteria to find matching services
* @param <T> type of the expected result, use {@link java.lang.Object} for results with more than one contract
* @return a list of qualified service instances that match the lookup criteria
*/
<T> List<ServiceInstance<T>> lookupInstances(Lookup lookup);
Expand Down

0 comments on commit 465f1a0

Please sign in to comment.