Skip to content

Commit

Permalink
Merge pull request #2 from treblereel/generators_refactoring
Browse files Browse the repository at this point in the history
Generators refactoring
  • Loading branch information
treblereel authored Aug 2, 2023
2 parents d801c26 + 6ecdb48 commit 711e522
Show file tree
Hide file tree
Showing 489 changed files with 5,167 additions and 17,452 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
.idea/
.factorypath
*.iml
*.jfr
.DS_Store
target
.vscode/
.flattened-pom.xml
dependency-reduced-pom.xml
dependency-reduced-pom.xml
2 changes: 1 addition & 1 deletion annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<artifactId>inject</artifactId>
</dependency>
<dependency>
<groupId>org.treblereel.gwt</groupId>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>utils</artifactId>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Application {

String[] packages() default {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void put(K key, V value) {
}

public Collection<V> values() {
return values().stream().collect(Collectors.toSet());
return Collections.unmodifiableCollection(super.values());
}

public List<V> get(K key) {
Expand All @@ -61,11 +61,11 @@ public void remove(K key, V value) {
}

public Collection<K> keys() {
return super.keySet().stream().collect(Collectors.toSet());
return Collections.unmodifiableCollection(super.keySet());
}

public Set<K> keySet() {
return super.keySet().stream().collect(Collectors.toSet());
return Collections.unmodifiableSet(super.keySet());
}

public void clear() {
Expand All @@ -77,10 +77,6 @@ public void removeAll(K key) {
}

public Collection<Map.Entry<K, V>> entries() {
Map<K, V> map = new TreeMap<>();
super.keys().forEach(key -> {
super.get(key).stream().forEach(v -> map.put(key, v));
});
return map.entrySet();
return Collections.unmodifiableCollection(super.entries());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
* @author Dmitrii Tikhomirov Created by treblereel 2/3/20
Expand All @@ -37,6 +38,12 @@ public Multimap() {
this(new HashMap<>());
}

public Collection<Map.Entry<K, V>> entries() {
Map<K, V> map = new TreeMap<>();
keys().forEach(key -> get(key).stream().forEach(v -> map.put(key, v)));
return map.entrySet();
}

public void put(K key, V value) {
if (!holder.containsKey(key)) {
holder.put(key, new ArrayList<>());
Expand All @@ -51,7 +58,7 @@ public Collection<V> values() {
result.add(value);
}
}
return result;
return Collections.unmodifiableSet(result);
}

public List<V> get(K key) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright © 2023 Treblereel
*
* 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.
*/

package io.crysknife.client.internal.managed;

import io.crysknife.client.BeanManager;
import io.crysknife.client.internal.InstanceImpl;
import io.crysknife.client.ioc.ContextualTypeProvider;
import io.crysknife.client.ioc.IOCProvider;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;

import java.lang.annotation.Annotation;

@IOCProvider
public class InstanceContextualTypeProvider implements ContextualTypeProvider<Instance> {

private final BeanManager manager;

@Inject
public InstanceContextualTypeProvider(BeanManager manager) {
this.manager = manager;
}

@Override
public Instance provide(Class<?>[] typeargs, Annotation[] qualifiers) {
Class clazz = typeargs[0];
if (qualifiers.length > 0) {
return new InstanceImpl(manager.lookupBean(clazz, qualifiers));
}
return new InstanceImpl(manager.lookupBean(clazz));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright © 2023 Treblereel
*
* 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.
*/

package io.crysknife.client.internal.managed;

import io.crysknife.client.BeanManager;
import io.crysknife.client.ManagedInstance;
import io.crysknife.client.internal.ManagedInstanceImpl;
import io.crysknife.client.ioc.ContextualTypeProvider;
import io.crysknife.client.ioc.IOCProvider;
import jakarta.inject.Inject;

import java.lang.annotation.Annotation;

@IOCProvider
public class ManagedInstanceContextualTypeProvider
implements ContextualTypeProvider<ManagedInstance> {

private final BeanManager manager;

@Inject
public ManagedInstanceContextualTypeProvider(BeanManager manager) {
this.manager = manager;
}

@Override
public ManagedInstance provide(Class<?>[] typeargs, Annotation[] qualifiers) {
Class clazz = typeargs[0];
return new ManagedInstanceImpl(manager, clazz, qualifiers);
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 Red Hat, Inc. and/or its affiliates.
* Copyright © 2023 Treblereel
*
* 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
Expand All @@ -12,20 +12,14 @@
* the License.
*/

package io.crysknife.ui.databinding.client.api;
package io.crysknife.client.internal.step;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that instances of the annotated class are bindable to UI components.
*
* @author Christian Sadilek <csadilek@redhat.com>
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface Bindable {

public @interface AfterBurnFactoryStep {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 Red Hat, Inc. and/or its affiliates.
* Copyright © 2023 Treblereel
*
* 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
Expand All @@ -12,21 +12,14 @@
* the License.
*/

package io.crysknife.ui.databinding.client.api;
package io.crysknife.client.internal.step;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that an implementation of {@link Converter} is to be used as a global default for
* converting between the specified model value and widget value type.
*
* @author Christian Sadilek <csadilek@redhat.com>
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface DefaultConverter {

public @interface BeanManagerStep {
}

This file was deleted.

47 changes: 15 additions & 32 deletions internal-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,13 @@

<jsoup.version>1.11.3</jsoup.version>
<javax.inject.version>1</javax.inject.version>
<freemarker.version>2.3.30</freemarker.version>
<lesscss.version>1.10</lesscss.version>
<google.jsinterop.annotations.version>2.0.0</google.jsinterop.annotations.version>
<google.guava.version>28.1-jre</google.guava.version>
<classgraph.classgraph.version>4.8.53</classgraph.classgraph.version>
<classgraph.classgraph.version>4.8.156</classgraph.classgraph.version>
<org.treblereel.j2cl.processors.version>0.6-SNAPSHOT</org.treblereel.j2cl.processors.version>

<jakarta.annotations.version>0.2-SNAPSHOT</jakarta.annotations.version>
<jakarta.ejb.version>0.2-SNAPSHOT</jakarta.ejb.version>
<jakarta.enterprise.version>0.2-SNAPSHOT</jakarta.enterprise.version>
<jakarta.inject.version>0.2-SNAPSHOT</jakarta.inject.version>
<jakarta.utils.version>0.2-SNAPSHOT</jakarta.utils.version>
<gwt.jakarta.version>0.2</gwt.jakarta.version>

<javaparser.core.version>3.15.18</javaparser.core.version>
<elemental2.version>1.1.0</elemental2.version>
Expand All @@ -91,6 +87,13 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>bom</artifactId>
<version>${gwt.jakarta.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
Expand All @@ -107,31 +110,6 @@
<artifactId>elemental2-dom</artifactId>
<version>${elemental2.version}</version>
</dependency>
<dependency>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>annotations</artifactId>
<version>${jakarta.annotations.version}</version>
</dependency>
<dependency>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>ejb</artifactId>
<version>${jakarta.ejb.version}</version>
</dependency>
<dependency>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>enterprise</artifactId>
<version>${jakarta.enterprise.version}</version>
</dependency>
<dependency>
<groupId>org.treblereel.gwt.jakarta</groupId>
<artifactId>inject</artifactId>
<version>${jakarta.inject.version}</version>
</dependency>
<dependency>
<groupId>org.treblereel.gwt</groupId>
<artifactId>utils</artifactId>
<version>${jakarta.utils.version}</version>
</dependency>
<dependency>
<groupId>com.google.auto</groupId>
<artifactId>auto-common</artifactId>
Expand Down Expand Up @@ -162,6 +140,11 @@
<artifactId>commons-text</artifactId>
<version>${apache.commons.commons-text.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
Expand Down
Loading

0 comments on commit 711e522

Please sign in to comment.