io.crysknife.generator.api.ClassMetaInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crysknife-processor Show documentation
Show all versions of crysknife-processor Show documentation
apt processor for crysknife-annotations project
The newest version!
/*
* Copyright © 2020 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.generator.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Supplier;
public class ClassMetaInfo {
private final Set imports = new TreeSet<>();
private final List> onDestroy = new ArrayList<>();
private final List> doInitInstance = new ArrayList<>();
private final List> doCreateInstance = new ArrayList<>();
private final List> body = new ArrayList<>();
private final List> factoryConstructor = new ArrayList<>();
public void addImport(String _import) {
imports.add(_import);
}
public void addImport(Class _import) {
imports.add(_import.getCanonicalName());
}
public void addToBody(Supplier supplier) {
body.add(supplier);
}
public void addToOnDestroy(Supplier supplier) {
onDestroy.add(supplier);
}
public void addToDoInitInstance(Supplier supplier) {
doInitInstance.add(supplier);
}
public void addToFactoryConstructor(Supplier supplier) {
factoryConstructor.add(supplier);
}
public void addToDoCreateInstance(Supplier supplier) {
doCreateInstance.add(supplier);
}
public Set getImports() {
return imports;
}
public List getOnDestroy() {
return onDestroy.stream().map(Supplier::get).collect(java.util.stream.Collectors.toList());
}
public List getDoInitInstance() {
return doInitInstance.stream().map(Supplier::get).collect(java.util.stream.Collectors.toList());
}
public List getBodyStatements() {
return body.stream().map(Supplier::get).collect(java.util.stream.Collectors.toList());
}
public List getDoCreateInstance() {
return doCreateInstance.stream().map(Supplier::get)
.collect(java.util.stream.Collectors.toList());
}
public List getFactoryConstructor() {
return factoryConstructor.stream().map(Supplier::get)
.collect(java.util.stream.Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy