Added annotations to allow to define the Resource Schema refs #18213

This commit is contained in:
Luca Frosini 2019-12-05 11:12:31 +01:00
parent 8c34a8363a
commit 3eb417a2a9
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package org.gcube.informationsystem.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
/**
* @author Luca Frosini (ISTI - CNR)
* It is used by {@link TypeBinder} to identify which getter method are
* related to and {@link Entity} {@link PropertyDefinition}.
* The name of the property is obtained by removing "get" or "is" from method
* name and lower casing the first letter.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ResourceSchema {
ResourceSchemaEntry[] value();
}

View File

@ -0,0 +1,35 @@
package org.gcube.informationsystem.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
/**
* @author Luca Frosini (ISTI - CNR)
* It is used by {@link TypeBinder} to identify which getter method are
* related to and {@link Entity} {@link PropertyDefinition}.
* The name of the property is obtained by removing "get" or "is" from method
* name and lower casing the first letter.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ResourceSchemaEntry {
@SuppressWarnings("rawtypes")
Class<? extends ConsistsOf> consistOfType() default ConsistsOf.class;
Class<? extends Facet> targetFacetType() default Facet.class;
String description() default "";
int min() default 0;
int max() default -1;
}