io.permazen.JListFieldScanner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of permazen-main Show documentation
Show all versions of permazen-main Show documentation
Permazen classes that map Java model classes onto the core API.
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package io.permazen;
import io.permazen.annotation.JField;
import io.permazen.annotation.JListField;
import io.permazen.annotation.PermazenType;
import java.lang.reflect.Method;
import java.util.List;
/**
* Scans for {@link JListField @JListField} annotations.
*/
class JListFieldScanner extends AbstractFieldScanner {
JListFieldScanner(JClass jclass, PermazenType permazenType) {
super(jclass, JListField.class, permazenType);
}
@Override
protected JListField getDefaultAnnotation() {
return new DefaultJListField(this.permazenType);
}
@Override
protected boolean includeMethod(Method method, JListField annotation) {
this.checkNotStatic(method);
this.checkReturnType(method, List.class);
this.checkParameterTypes(method);
return true;
}
@Override
protected boolean isAutoPropertyCandidate(Method method) {
return super.isAutoPropertyCandidate(method) && List.class.isAssignableFrom(method.getReturnType());
}
// DefaultJListField
private static class DefaultJListField implements JListField {
private PermazenType permazenType;
DefaultJListField(PermazenType permazenType) {
this.permazenType = permazenType;
}
@Override
public Class annotationType() {
return JListField.class;
}
@Override
public String name() {
return "";
}
@Override
public int storageId() {
return 0;
}
@Override
public JField element() {
return JFieldScanner.getDefaultJField(this.permazenType);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy