"/"
27 | */
28 | String SLASH = "/";
29 |
30 | /**
31 | * Double Slash : "//"
32 | */
33 | String DOUBLE_SLASH = SLASH + SLASH;
34 |
35 | /**
36 | * Back Slash : "\"
37 | */
38 | String BACK_SLASH = "\\";
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/microsphere-java-core/src/test/java/io/microsphere/io/filter/IOFileFilterTest.java:
--------------------------------------------------------------------------------
1 | package io.microsphere.io.filter;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import java.io.File;
6 | import java.util.Objects;
7 |
8 | import static org.junit.jupiter.api.Assertions.assertFalse;
9 | import static org.junit.jupiter.api.Assertions.assertTrue;
10 |
11 | /**
12 | * {@link IOFileFilter} Test
13 | *
14 | * @author Mercy
15 | * @see IOFileFilter
16 | * @since 1.0.0
17 | */
18 | class IOFileFilterTest {
19 |
20 | @Test
21 | void tes() {
22 | File file = new File("test");
23 | IOFileFilter filter = f -> Objects.equals(f, file);
24 | assertTrue(filter.accept(file));
25 | assertFalse(filter.accept(null));
26 | assertTrue(filter.accept(file.getParentFile(), file.getName()));
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/microsphere-java-core/src/test/java/io/microsphere/filter/PackageNameClassNameFilterTest.java:
--------------------------------------------------------------------------------
1 | package io.microsphere.filter;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.junit.jupiter.api.Assertions.assertFalse;
6 | import static org.junit.jupiter.api.Assertions.assertTrue;
7 |
8 | /**
9 | * {@link PackageNameClassNameFilter} Test
10 | *
11 | * @author Mercy
12 | * @see PackageNameClassNameFilter
13 | * @since 1.0.0
14 | */
15 | class PackageNameClassNameFilterTest {
16 |
17 | @Test
18 | void testAccept() {
19 | PackageNameClassNameFilter filter = new PackageNameClassNameFilter("io.microsphere", true);
20 | assertTrue(filter.accept("io.microsphere.filter.PackageNameClassNameFilterTest"));
21 | assertFalse(filter.accept("java.lang.String"));
22 | assertFalse(filter.accept(null));
23 | }
24 | }
--------------------------------------------------------------------------------
/microsphere-java-core/src/test/java/io/microsphere/util/ShutdownHookCallbacksThreadTest.java:
--------------------------------------------------------------------------------
1 | package io.microsphere.util;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static io.microsphere.util.ShutdownHookCallbacksThread.INSTANCE;
6 | import static io.microsphere.util.ShutdownHookUtils.addShutdownHookCallback;
7 |
8 | /**
9 | * {@link ShutdownHookCallbacksThread} Test
10 | *
11 | * @author Mercy
12 | * @see ShutdownHookCallbacksThread
13 | * @since 1.0.0
14 | */
15 | class ShutdownHookCallbacksThreadTest {
16 |
17 | @Test
18 | void testRun() {
19 | ShutdownHookCallbacksThread thread = INSTANCE;
20 |
21 | int times = 3;
22 | for (int i = 0; i < times; i++) {
23 | addShutdownHookCallback(new ShutdownHookUtilsTest.ShutdownHookCallback(i));
24 | }
25 |
26 | thread.run();
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | # Copyright 2013-2023 the original author or authors.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # https://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
16 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
--------------------------------------------------------------------------------
/microsphere-java-core/src/main/java/io/microsphere/filter/ClassFilter.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package io.microsphere.filter;
5 |
6 | /**
7 | * A {@link Filter} for {@link Class} objects.
8 | *
9 | * Implementations of this interface can be used to filter classes based on specific criteria, 10 | * such as whether they are interfaces, annotations, or belong to a particular package.
11 | * 12 | *{@code
14 | * public class MyTestClassFilter implements ClassFilter {
15 | * public boolean accept(Class> clazz) {
16 | * return clazz.isAnnotation();
17 | * }
18 | * }
19 | * }
20 | *
21 | * This example filters only annotation types.
22 | * 23 | * @author Mercy 24 | * @see Class 25 | * @see Filter 26 | * @since 1.0.0 27 | */ 28 | @FunctionalInterface 29 | public interface ClassFilter extends FilterA simple implementation might accept only entries whose names end with a ".class" 14 | * extension: 15 | * 16 | *
{@code
17 | * JarEntryFilter classFileFilter = entry -> entry.getName().endsWith(".class");
18 | * }
19 | *
20 | * This interface is designed to be used in conjunction with the methods of the
21 | * {@link java.util.jar.JarFile} class and other utilities that process JAR entries.
22 | *
23 | * @author Mercy
24 | * @see JarEntry
25 | * @see Filter
26 | * @since 1.0.0
27 | */
28 | @FunctionalInterface
29 | public interface JarEntryFilter extends Filter
9 | * This class is a singleton and provides a consistent filtering behavior
10 | * across the application lifecycle. It is typically used when all classes
11 | * need to be accepted without any filtering logic.
12 | *
9 | * Implementations of this interface define the logic to determine whether a given object should be accepted or filtered out.
10 | * This interface is typically used in scenarios where conditional processing or selection of objects is required.
11 | * Example Usage
15 | * {@code
16 | * // Get the singleton instance
17 | * ClassFilter filter = TrueClassFilter.INSTANCE;
18 | *
19 | * // Test against any Class object
20 | * boolean result = filter.accept(String.class); // returns true
21 | * }
22 | *
23 | * @author Mercy
24 | * @see ClassFilter
25 | * @since 1.0.0
26 | */
27 | public class TrueClassFilter implements ClassFilter {
28 |
29 | /**
30 | * Singleton {@link TrueClassFilter} instance
31 | */
32 | public static final TrueClassFilter INSTANCE = new TrueClassFilter();
33 |
34 | private TrueClassFilter() {
35 |
36 | }
37 |
38 | @Override
39 | public boolean accept(Class> filteredObject) {
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/microsphere-java-core/src/test/java/io/microsphere/test/MyHashMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package io.microsphere.test;
18 |
19 | import java.io.Serializable;
20 | import java.util.HashMap;
21 | import java.util.Map;
22 |
23 | /**
24 | * @author Mercy
25 | * @since 1.0.0
26 | */
27 | public class MyHashMap extends HashMap implements Map {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/microsphere-annotation-processor/src/test/java/io/microsphere/annotation/processor/model/StringArrayList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package io.microsphere.annotation.processor.model;
19 |
20 | import java.util.ArrayList;
21 |
22 | /**
23 | * String type {@link ArrayList}
24 | *
25 | * @author Mercy
26 | * @see ArrayList
27 | * @since 1.0.0
28 | */
29 | public class StringArrayList extends ArrayListExample Usage
14 | * {@code
15 | * public class EvenNumberFilter implements Filter
26 | *
27 | * @param {
28 |
29 | @Override
30 | protected List createMultiValue(int size, Class> multiValueType) {
31 | return new ArrayList(size);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/microsphere-java-core/src/main/java/io/microsphere/convert/multiple/StringToDequeConverter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package io.microsphere.convert.multiple;
18 |
19 | import java.util.ArrayDeque;
20 | import java.util.Deque;
21 |
22 | /**
23 | * The class to convert {@link String} to {@link Deque}-based value
24 | *
25 | * @since 1.0.0
26 | */
27 | public class StringToDequeConverter extends StringToIterableConverter