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