Skip to content

Commit

Permalink
CAUSEWAY-2297: converts CausewayBeanTypeClassifierDefault and
Browse files Browse the repository at this point in the history
CausewayDomainObjectScope to record
  • Loading branch information
andi-huber committed Nov 11, 2024
1 parent 1fc76be commit ed810e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,20 @@
import org.apache.causeway.commons.semantics.CollectionSemantics;
import org.apache.causeway.core.config.progmodel.ProgrammingModelConstants.TypeExcludeMarker;

import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
//@Log4j2
final class CausewayBeanTypeClassifierDefault
implements CausewayBeanTypeClassifier {

private final Can<String> activeProfiles;
private final Can<CausewayBeanTypeClassifier> classifierPlugins = CausewayBeanTypeClassifier.get();

private final _ClassCache classCache = _ClassCache.getInstance();
final record CausewayBeanTypeClassifierDefault(
@NonNull Can<String> activeProfiles,
@NonNull Can<CausewayBeanTypeClassifier> classifierPlugins,
@NonNull _ClassCache classCache)
implements CausewayBeanTypeClassifier {

CausewayBeanTypeClassifierDefault(Can<String> activeProfiles) {
this(activeProfiles, CausewayBeanTypeClassifier.get(), _ClassCache.getInstance());
}

// handle arbitrary types ...
@Override
public CausewayBeanMetaData classify(
final @NonNull Class<?> type) {

//debug
// _Debug.onClassSimpleNameMatch(type, "class of interest", ()->{
// System.err.printf("classifying %s%n", type);
// });
public CausewayBeanMetaData classify(final @NonNull Class<?> type) {

if(ClassUtils.isPrimitiveOrWrapper(type)
|| type.isEnum()) {
Expand Down Expand Up @@ -172,7 +163,7 @@ public CausewayBeanMetaData classify(

// -- HELPER

//XXX yet this is a naive implementation, not evaluating any expression logic like eg. @Profile("!dev")
//TODO yet this is a naive implementation, not evaluating any expression logic like eg. @Profile("!dev")
//either we find a Spring Boot utility class that does this logic for us, or we make it clear with the
//docs, that we have only limited support for the @Profile annotation
private boolean isProfileActive(final String profile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@
import org.apache.causeway.applib.services.iactn.Interaction;
import org.apache.causeway.applib.services.iactnlayer.InteractionService;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;

@RequiredArgsConstructor
@Log4j2
class CausewayDomainObjectScope implements Scope {

private final BeanFactory beanFactory;
record CausewayDomainObjectScope(BeanFactory beanFactory) implements Scope {

@Override
public Object get(final String name, final ObjectFactory<?> objectFactory) {
Expand Down

0 comments on commit ed810e8

Please sign in to comment.