Documenting types

This commit is contained in:
Luca Frosini 2020-12-21 16:02:46 +01:00
parent 3f2a42fe17
commit c0bc729541
11 changed files with 20 additions and 20 deletions

View File

@ -33,12 +33,12 @@ public class EnumStringPropertyImpl extends GCubePropertyImpl implements EnumStr
}
@Override
public Set<String> getType() {
public Set<String> getSchema() {
return this.type;
}
@Override
public void setType(Set<String> type) {
public void setSchema(Set<String> type) {
this.type = type;
}

View File

@ -31,12 +31,12 @@ public class RegexPropertyImpl extends GCubePropertyImpl implements RegexPropert
}
@Override
public String getType() {
public String getSchema() {
return this.type;
}
@Override
public void setType(String type) {
public void setSchema(String type) {
this.type = type;
}

View File

@ -36,13 +36,13 @@ public class ValueSchemaImpl extends GCubePropertyImpl implements ValueSchema {
}
@Override
public URI getType() {
public URI getSchema() {
return this.schema;
}
@Override
public void setType(URI type) {
this.schema = type;
public void setSchema(URI schema) {
this.schema = schema;
}
}

View File

@ -45,7 +45,7 @@ public interface EnumStringProperty extends GCubeProperty, ValidatedTypedPropert
@Override
public Validation validate(EnumStringProperty property) {
return property.getType().contains(property.getValue()) ? Validation.success("Accepted!")
return property.getSchema().contains(property.getValue()) ? Validation.success("Accepted!")
: Validation.fail(property.getValue() + " is not a valid value.");
}
}

View File

@ -48,10 +48,10 @@ public interface RegexProperty extends GCubeProperty, ValidatedTypedProperty<Str
public Validation validate(RegexProperty property) {
if (Objects.isNull(property.getValue()))
return Validation.fail("The value of the regex property is not set.");
if (Objects.isNull(property.getType()))
if (Objects.isNull(property.getSchema()))
return Validation.fail("The type of the regex property is not set.");
Pattern pattern = Pattern.compile(property.getType());
Pattern pattern = Pattern.compile(property.getSchema());
Matcher matcher = pattern.matcher(property.getValue());
return matcher.find() ?
Validation.success("Accepted!") : Validation.fail(property.getValue() + " was not a valid match!");
@ -68,9 +68,9 @@ public interface RegexProperty extends GCubeProperty, ValidatedTypedProperty<Str
@ISProperty
@Override
public String getType();
public String getSchema();
@Override
public void setType(String type);
public void setSchema(String type);
}

View File

@ -71,9 +71,9 @@ public interface ValueSchema extends GCubeProperty, ValidatedTypedProperty<URI,S
*/
@ISProperty(description = "An URI containing a schema used to validate/interpret the content of the value. It is only an informative field. The validation is charge of the client.", mandatory=true, nullable=false)
@Override
public URI getType();
public URI getSchema();
@Override
public void setType(URI type);
public void setSchema(URI schema);
}

View File

@ -9,8 +9,8 @@ public interface TypedProperty<T, V> {
public void setValue(V value);
public T getType();
public T getSchema();
public void setType(T type);
public void setSchema(T type);
}

View File

@ -26,7 +26,7 @@ public class AccessPointFacetTest {
ValueSchema authorization = new ValueSchemaImpl();
authorization.setValue("pwd");
URI uri = new URI("http://www.gcube-system.org");
authorization.setType(uri);
authorization.setSchema(uri);
accessPointFacet.setAuthorization(authorization);
accessPointFacet.setAdditionalProperty("Test", "MyTest");

View File

@ -33,7 +33,7 @@ public class ActionFacetTest {
facet.setName("FirstAction");
EnumStringProperty type = new EnumStringPropertyImpl();
type.setValue("ANSIBLE");
type.setType(values);
type.setSchema(values);
facet.setType(type);
facet.setSource("git@myrepo:playbook.yml");
facet.setCommand("ansible-pull");

View File

@ -28,7 +28,7 @@ public class EnumStringPropertyTest {
*/
@Before
public void setUp() throws Exception {
property.setType(new HashSet<String>(Arrays.asList("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT")));
property.setSchema(new HashSet<String>(Arrays.asList("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT")));
}
/**

View File

@ -27,7 +27,7 @@ public class RegexPropertyTest {
@Before
public void setUp() throws Exception {
String patternString = ".*http://.*";
property.setType(patternString);
property.setSchema(patternString);
}
/**