Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add factory-method #14

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2a75584
Add Documented annotation
alexengrig Jul 15, 2021
260beed
Create GetterSupplierFactory annotation
alexengrig Jul 15, 2021
c2823c5
Update MethodDescriptor
alexengrig Jul 15, 2021
2f32b6b
Refactor BaseMethodSupplierProcessor
alexengrig Jul 15, 2021
47f9d42
Create OnClassMethodSupplierProcessor
alexengrig Jul 15, 2021
e966747
Update GetterSupplierProcessor and SetterSupplierProcessor
alexengrig Jul 15, 2021
086cbfe
Add TODO
alexengrig Jul 15, 2021
8d4dee3
Create BaseMethodSupplierProcessor#assertValidCustomClassName
alexengrig Sep 1, 2021
f1493c3
Update OnClassSupplierProcessor
alexengrig Sep 1, 2021
2a45dc5
Create demo Factory
alexengrig Sep 1, 2021
a90a6ff
Create MethodDescriptor#getParent
alexengrig Sep 1, 2021
ce7794a
Create hasPackage and getPackage in TypeDescriptor
alexengrig Sep 1, 2021
6e7266c
Update GetterSupplierProcessor and SetterSupplierProcessor
alexengrig Sep 1, 2021
903d011
Create OnMethodSupplierProcessor
alexengrig Sep 1, 2021
eff34af
Create GetterSupplierFactoryProcessor
alexengrig Sep 1, 2021
a9d9f35
Add BaseProcessor#note(Object)
alexengrig Sep 2, 2021
547bf5e
Refactor SimpleDomainTest
alexengrig Sep 2, 2021
024548a
Create demo Factory
alexengrig Sep 2, 2021
caa9cb4
Create demo BaseDomainFactoryTest
alexengrig Sep 2, 2021
c6b067b
Create demo SimpleDomainFactoryTest
alexengrig Sep 2, 2021
b932b25
Create demo SimpleDomainFactory
alexengrig Sep 2, 2021
66be294
Update demo SimpleDomain factory
alexengrig Sep 3, 2021
be589df
Create SetterSupplierFactory annotation
alexengrig Sep 3, 2021
5c5c4c2
Refactor BaseMethodSupplierProcessor
alexengrig Sep 3, 2021
ddd7d04
Refactor OnClassSupplierProcessor
alexengrig Sep 3, 2021
b98354d
Refactor OnMethodSupplierProcessor
alexengrig Sep 3, 2021
fad44c5
Refactor GetterSupplierProcessor
alexengrig Sep 3, 2021
1c2c61a
Refactor GetterSupplierFactoryProcessor
alexengrig Sep 3, 2021
9c2ef9d
Refactor SetterSupplierProcessor
alexengrig Sep 3, 2021
28a1a92
Fix demo SimpleDomain factory
alexengrig Sep 3, 2021
29cecee
Update BaseMethodSupplierProcessor
alexengrig Sep 3, 2021
65c9bc9
Refactor SetterSupplierProcessor
alexengrig Sep 3, 2021
250a6ac
Create SetterSupplierFactoryProcessor
alexengrig Sep 3, 2021
cc75540
Update SimpleDomainTest
alexengrig Sep 3, 2021
ee743ff
Create InheritedSimpleDomain with tests
alexengrig Sep 3, 2021
47c5fe9
Fix SimpleDomainFactoryTest
alexengrig Sep 3, 2021
6ec420e
Create InheritedSimpleDomainFactory with tests
alexengrig Sep 3, 2021
4f1f032
Set BaseDomainFactoryTest abstract
alexengrig Sep 3, 2021
e22696d
Refactor tests
alexengrig Sep 4, 2021
eb99b82
Create NamedDomainFactory with tests
alexengrig Sep 4, 2021
8ab437a
Create NoPackageDomainFactory with tests
alexengrig Sep 4, 2021
07bc027
Create ExcludedDomainFactory with tests
alexengrig Sep 4, 2021
822c272
Create InheritedExcludedDomainFactory with tests
alexengrig Sep 4, 2021
9efe670
Create IncludedDomainFactory with tests
alexengrig Sep 4, 2021
a4d1395
Create InheritedIncludedDomainFactory with tests
alexengrig Sep 4, 2021
e10d075
Create IncludedAndExcludedDomainFactory with tests
alexengrig Sep 4, 2021
359393d
Create InheritedIncludedAndExcludedDomainFactory with tests
alexengrig Sep 4, 2021
96eaff2
Create FatherDomainFactory with tests
alexengrig Sep 4, 2021
980e15a
Create SonDomainFactory with tests
alexengrig Sep 4, 2021
b038d8b
Fix package
alexengrig Sep 4, 2021
70c278f
Fix SonDomainFactory
alexengrig Sep 4, 2021
4ccfc37
Create GrandsonDomainFactory with tests
alexengrig Sep 4, 2021
4c97f47
Create LombokDataDomainFactory with tests
alexengrig Sep 4, 2021
1d8a29f
Create InheritedLombokDataDomainFactory with tests
alexengrig Sep 4, 2021
3c12bd7
Create LombokGetterAndSetterDomainFactory with tests
alexengrig Sep 4, 2021
6a04c52
Create InheritedLombokGetterAndSetterDomainFactory with tests
alexengrig Sep 4, 2021
8e25fa0
Create LombokGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
aa1b971
Create InheritedLombokGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
3776a3a
Create PrivateGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
65b2ef2
Create InheritedPrivateGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
c7335b4
Create PrivateLombokGetterAndSetterDomainFactory with tests
alexengrig Sep 4, 2021
2b5354b
Create InheritedPrivateLombokGetterAndSetterDomainFactory with tests
alexengrig Sep 4, 2021
c807a6d
Create PrivateLombokGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
ab3c27d
Create InheritedPrivateLombokGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
8e05f7b
Create ProtectedGettersAndSettersDomain with tests
alexengrig Sep 4, 2021
23dacde
Create ProtectedGettersAndSettersDomainFactory with tests
alexengrig Sep 4, 2021
da72f19
Create package getters and setters domains with tests
alexengrig Sep 5, 2021
91a4bb4
Create ProtectedGettersAndSettersDomainFactory with same domain package
alexengrig Sep 5, 2021
c484281
Add support of package/protected access
alexengrig Sep 5, 2021
dc7da64
Comment tests
alexengrig Sep 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions demo/src/main/java/NoPackageDomainFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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.
*/

import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class NoPackageDomainFactory implements Factory<NoPackageDomain> {
@Override
@GetterSupplierFactory(NoPackageDomain.class)
public Map<String, Function<NoPackageDomain, Object>> getters() {
return new NoPackageDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(NoPackageDomain.class)
public Map<String, BiConsumer<NoPackageDomain, Object>> setters() {
return new NoPackageDomainSetterSupplierFactory().get();
}
}
27 changes: 27 additions & 0 deletions demo/src/main/java/dev/alexengrig/metter/demo/Factory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public interface Factory<T> {
Map<String, Function<T, Object>> getters();

Map<String, BiConsumer<T, Object>> setters();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.excluding.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.excluding.ExcludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class ExcludedDomainFactory implements Factory<ExcludedDomain> {
@Override
@GetterSupplierFactory(value = ExcludedDomain.class, props = @GetterSupplier(excludedFields = "excluded"))
public Map<String, Function<ExcludedDomain, Object>> getters() {
return new ExcludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = ExcludedDomain.class, props = @SetterSupplier(excludedFields = "excluded"))
public Map<String, BiConsumer<ExcludedDomain, Object>> setters() {
return new ExcludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.excluding.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.excluding.InheritedExcludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class InheritedExcludedDomainFactory implements Factory<InheritedExcludedDomain> {
@Override
@GetterSupplierFactory(value = InheritedExcludedDomain.class, props =
@GetterSupplier(excludedFields = {"excluded", "alsoExcluded"}))
public Map<String, Function<InheritedExcludedDomain, Object>> getters() {
return new InheritedExcludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = InheritedExcludedDomain.class, props =
@SetterSupplier(excludedFields = {"excluded", "alsoExcluded"}))
public Map<String, BiConsumer<InheritedExcludedDomain, Object>> setters() {
return new InheritedExcludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.including.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.including.IncludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class IncludedDomainFactory implements Factory<IncludedDomain> {
@Override
@GetterSupplierFactory(value = IncludedDomain.class, props =
@GetterSupplier(includedFields = "included"))
public Map<String, Function<IncludedDomain, Object>> getters() {
return new IncludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = IncludedDomain.class, props =
@SetterSupplier(includedFields = "included"))
public Map<String, BiConsumer<IncludedDomain, Object>> setters() {
return new IncludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.including.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.including.InheritedIncludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class InheritedIncludedDomainFactory implements Factory<InheritedIncludedDomain> {
@Override
@GetterSupplierFactory(value = InheritedIncludedDomain.class, props =
@GetterSupplier(includedFields = {"included", "alsoIncluded"}))
public Map<String, Function<InheritedIncludedDomain, Object>> getters() {
return new InheritedIncludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = InheritedIncludedDomain.class, props =
@SetterSupplier(includedFields = {"included", "alsoIncluded"}))
public Map<String, BiConsumer<InheritedIncludedDomain, Object>> setters() {
return new InheritedIncludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.includingandexcluding.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.includingandexcluding.IncludedAndExcludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class IncludedAndExcludedDomainFactory implements Factory<IncludedAndExcludedDomain> {
@Override
@GetterSupplierFactory(value = IncludedAndExcludedDomain.class, props =
@GetterSupplier(includedFields = "included", excludedFields = "excluded"))
public Map<String, Function<IncludedAndExcludedDomain, Object>> getters() {
return new IncludedAndExcludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = IncludedAndExcludedDomain.class, props =
@SetterSupplier(includedFields = "included", excludedFields = "excluded"))
public Map<String, BiConsumer<IncludedAndExcludedDomain, Object>> setters() {
return new IncludedAndExcludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.includingandexcluding.factory;

import dev.alexengrig.metter.annotation.GetterSupplier;
import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplier;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.includingandexcluding.InheritedIncludedAndExcludedDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class InheritedIncludedAndExcludedDomainFactory implements Factory<InheritedIncludedAndExcludedDomain> {
@Override
@GetterSupplierFactory(value = InheritedIncludedAndExcludedDomain.class, props =
@GetterSupplier(includedFields = {"included", "alsoIncluded"}, excludedFields = {"excluded", "alsoExcluded"}))
public Map<String, Function<InheritedIncludedAndExcludedDomain, Object>> getters() {
return new InheritedIncludedAndExcludedDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(value = InheritedIncludedAndExcludedDomain.class, props =
@SetterSupplier(includedFields = {"included", "alsoIncluded"}, excludedFields = {"excluded", "alsoExcluded"}))
public Map<String, BiConsumer<InheritedIncludedAndExcludedDomain, Object>> setters() {
return new InheritedIncludedAndExcludedDomainSetterSupplierFactory().get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2020-2021 Alexengrig Dev.
*
* 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 dev.alexengrig.metter.demo.inheritance.factory;

import dev.alexengrig.metter.annotation.GetterSupplierFactory;
import dev.alexengrig.metter.annotation.SetterSupplierFactory;
import dev.alexengrig.metter.demo.Factory;
import dev.alexengrig.metter.demo.inheritance.FatherDomain;

import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

public class FatherDomainFactory implements Factory<FatherDomain> {
@Override
@GetterSupplierFactory(FatherDomain.class)
public Map<String, Function<FatherDomain, Object>> getters() {
return new FatherDomainGetterSupplierFactory().get();
}

@Override
@SetterSupplierFactory(FatherDomain.class)
public Map<String, BiConsumer<FatherDomain, Object>> setters() {
return new FatherDomainSetterSupplierFactory().get();
}
}
Loading