run.halo.app.extension.index.AbstractIndexAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
API of halo project, connecting by other projects.
The newest version!
package run.halo.app.extension.index;
import lombok.EqualsAndHashCode;
import org.springframework.util.Assert;
import run.halo.app.extension.Extension;
import run.halo.app.extension.GVK;
@EqualsAndHashCode
public abstract class AbstractIndexAttribute implements IndexAttribute {
private final Class objectType;
/**
* Creates a new {@link AbstractIndexAttribute} for the given object type.
*
* @param objectType must not be {@literal null}.
*/
public AbstractIndexAttribute(Class objectType) {
Assert.notNull(objectType, "Object type must not be null");
Assert.state(isValidExtension(objectType),
"Invalid extension type, make sure you have annotated it with @" + GVK.class
.getSimpleName());
this.objectType = objectType;
}
@Override
public Class getObjectType() {
return this.objectType;
}
boolean isValidExtension(Class extends Extension> type) {
return type.getAnnotation(GVK.class) != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy