You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/07/23 07:35:59 UTC
[isis] 01/01: ISIS-2819: improves/extends/adds to base
meta-annotations
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2819
in repository https://gitbox.apache.org/repos/asf/isis.git
commit ed4a158d5997905d6f1b46116a7461391eedccc8
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jul 23 08:32:07 2021 +0100
ISIS-2819: improves/extends/adds to base meta-annotations
---
.../subdomains/base/applib/types/AddressLine.java | 79 ++++++++++++++++
.../subdomains/base/applib/types/Description.java | 54 +++++++++--
.../isis/subdomains/base/applib/types/Email.java | 105 +++++++++++++++++++++
.../isis/subdomains/base/applib/types/Fqcn.java | 43 ++++++++-
.../base/applib/types/LogicalTypeName.java | 87 +++++++++++++++++
.../isis/subdomains/base/applib/types/Money.java | 48 +++++++++-
.../isis/subdomains/base/applib/types/Name.java | 47 ++++++++-
.../isis/subdomains/base/applib/types/Notes.java | 53 +++++++++--
.../base/applib/types/ObjectIdentifier.java | 53 +++++++++--
.../subdomains/base/applib/types/Percentage.java | 47 ++++++++-
.../subdomains/base/applib/types/PhoneNumber.java | 96 +++++++++++++++++++
.../subdomains/base/applib/types/PostalCode.java | 79 ++++++++++++++++
.../subdomains/base/applib/types/ProperName.java | 45 ++++++++-
.../subdomains/base/applib/types/Reference.java | 65 +++++++++++--
.../isis/subdomains/base/applib/types/Title.java | 45 ++++++++-
.../subdomains/base/applib/types/UrlTemplate.java | 45 ++++++++-
.../subdomains/base/applib/types/Username.java | 45 ++++++++-
17 files changed, 977 insertions(+), 59 deletions(-)
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/AddressLine.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/AddressLine.java
new file mode 100644
index 0000000..66f29f7
--- /dev/null
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/AddressLine.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.subdomains.base.applib.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
+
+/**
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a line of an address.
+ *
+ * @since 2.0 {@index}
+ */
+@Property(
+ maxLength = AddressLine.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = AddressLine.NAMED
+)
+@Parameter(
+ maxLength = AddressLine.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = AddressLine.NAMED
+)
+//@javax.jdo.annotations.Column(length = AddressLine.MAX_LENGTH, allowsNull = "false")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AddressLine {
+
+ int MAX_LENGTH = 100;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Address Line";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default "";
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default "";
+
+}
\ No newline at end of file
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Description.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Description.java
index 96aeb62..14827d0 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Description.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Description.java
@@ -23,26 +23,66 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
+ * Meta-annotation for an optional {@link String} property or parameter representing a
* description of some sort.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Description.MAX_LEN)
-@PropertyLayout(multiLine = Description.MULTI_LINE)
-@Parameter(maxLength = Description.MAX_LEN)
-@ParameterLayout(multiLine = Description.MULTI_LINE)
+@Property(
+ maxLength = Description.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL
+)
+@PropertyLayout(
+ named = Description.NAMED,
+ multiLine = Description.MULTI_LINE
+)
+@Parameter(
+ maxLength = Description.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL
+)
+@ParameterLayout(
+ named = Description.NAMED,
+ multiLine = Description.MULTI_LINE
+)
+//@javax.jdo.annotations.Column(length = Description.MAX_LENGTH, allowsNull = "true")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Description {
- int MAX_LEN = 254;
- int MULTI_LINE = 5;
+ int MAX_LENGTH = 254;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Description";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+ int MULTI_LINE = 1;
+ @AliasFor( annotation = PropertyLayout.class, attribute = "multiLine")
+ int propertyLayoutMultiLine() default MULTI_LINE;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "multiLine")
+ int parameterLayoutMultiLine() default MULTI_LINE;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Email.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Email.java
new file mode 100644
index 0000000..4e25c73
--- /dev/null
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Email.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.subdomains.base.applib.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
+
+/**
+ * Meta-annotation for an optional {@link String} property or parameter representing an
+ * email address.
+ *
+ * @since 2.0 {@index}
+ */
+@Property(
+ maxLength = Email.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL,
+ regexPattern = Email.REGEX_PATTERN,
+ regexPatternReplacement = Email.REGEX_PATTERN_REPLACEMENT
+)
+@PropertyLayout(
+ named = Email.NAMED
+)
+@Parameter(
+ maxLength = Email.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL,
+ regexPattern = Email.REGEX_PATTERN,
+ regexPatternReplacement = Email.REGEX_PATTERN_REPLACEMENT
+)
+@ParameterLayout(
+ named = Email.NAMED
+)
+//@javax.jdo.annotations.Column(length = Email.MAX_LENGTH, allowsNull = "true")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Email {
+
+ /**
+ * See <a href="http://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address">maximum length of an email address</a>.
+ */
+ int MAX_LENGTH = 254;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+ /**
+ * as per http://emailregex.com/
+ */
+ String REGEX_PATTERN = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]) [...]
+ @AliasFor( annotation = Property.class, attribute = "regexPattern")
+ String propertyRegexPattern() default REGEX_PATTERN;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPattern")
+ String parameterRegexPattern() default REGEX_PATTERN;
+
+ String REGEX_PATTERN_REPLACEMENT = "Email address is badly formed";
+ @AliasFor( annotation = Property.class, attribute = "regexPatternReplacement")
+ String propertyRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPatternReplacement")
+ String parameterRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Email";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+
+
+
+}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Fqcn.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Fqcn.java
index aa6ecd2..1e31ade 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Fqcn.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Fqcn.java
@@ -23,8 +23,12 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
* Meta-annotation for a {@link String} property or parameter representing a
@@ -32,12 +36,45 @@ import org.apache.isis.applib.annotation.Property;
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Fqcn.MAX_LEN)
-@Parameter(maxLength = Fqcn.MAX_LEN)
+@Property(
+ maxLength = Fqcn.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = Fqcn.NAMED
+)
+@Parameter(
+ maxLength = Fqcn.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = Fqcn.NAMED
+)
+//@javax.jdo.annotations.Column(length = Fqcn.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Fqcn {
- int MAX_LEN = 254;
+ int MAX_LENGTH = 254;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Fully qualified class name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/LogicalTypeName.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/LogicalTypeName.java
new file mode 100644
index 0000000..9822f77
--- /dev/null
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/LogicalTypeName.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.subdomains.base.applib.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
+
+/**
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
+ * logical type name of a domain object (as per @{@link DomainObject#logicalTypeName() DomainObject#logicalTypeName}
+ * or @{@link DomainService#logicalTypeName() DomainObject#logicalTypeName}).
+ *
+ * @see DomainObject
+ * @see DomainService
+ * @see ObjectIdentifier
+ *
+ * @since 2.0 {@index}
+ */
+@Property(
+ maxLength = LogicalTypeName.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = LogicalTypeName.NAMED
+)
+@Parameter(
+ maxLength = LogicalTypeName.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = LogicalTypeName.NAMED
+)
+//@javax.jdo.annotations.Column(length = LogicalTypeName.MAX_LENGTH, allowsNull = "false")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LogicalTypeName {
+
+ int MAX_LENGTH = 254;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Logical type name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Money.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Money.java
index 6b82993..1eb6687 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Money.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Money.java
@@ -23,21 +23,61 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link java.math.BigDecimal} property or parameter
+ * Meta-annotation for an optional {@link java.math.BigDecimal} property or parameter
* representing a monetary amount.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Fqcn.MAX_LEN)
-@Parameter(maxLength = Fqcn.MAX_LEN)
+@Property(
+ optionality = Optionality.OPTIONAL
+)
+@PropertyLayout(
+ named = Money.NAMED
+)
+@Parameter(
+ optionality = Optionality.OPTIONAL
+)
+@ParameterLayout(
+ named = Money.NAMED
+)
+@javax.validation.constraints.Digits(
+ integer = Money.INTEGER,
+ fraction = Money.FRACTION
+)
+//@javax.jdo.annotations.Column(allowsNull = "true")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Money {
- int SCALE = 2;
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+
+ String NAMED = "Amount";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+ int INTEGER = 10;
+ @AliasFor( annotation = javax.validation.constraints.Digits.class, attribute = "integer")
+ int digitsInteger() default Money.INTEGER;
+
+ int FRACTION = 2;
+ @AliasFor( annotation = javax.validation.constraints.Digits.class, attribute = "fraction")
+ int digitsFraction() default Money.FRACTION;
+
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Name.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Name.java
index 9e24e98..4732cb6 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Name.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Name.java
@@ -23,21 +23,58 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
* name of some sort.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Name.MAX_LEN)
-@Parameter(maxLength = Name.MAX_LEN)
+@Property(
+ maxLength = Name.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = Name.NAMED
+)
+@Parameter(
+ maxLength = Name.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = Name.NAMED
+)
+//@javax.jdo.annotations.Column(length = Name.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Name {
- int MAX_LEN = 50;
+ int MAX_LENGTH = 50;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
-}
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+}
\ No newline at end of file
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Notes.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Notes.java
index 00ea7ba..325e5c4 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Notes.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Notes.java
@@ -18,32 +18,71 @@
*/
package org.apache.isis.subdomains.base.applib.types;
-
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
+ * Meta-annotation for an optional {@link String} property or parameter representing a
* notes or comments about some object.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Notes.MAX_LEN)
-@PropertyLayout(multiLine = Notes.MULTI_LINE)
-@Parameter(maxLength = Notes.MAX_LEN)
-@ParameterLayout(multiLine = Notes.MULTI_LINE)
+@Property(
+ maxLength = Notes.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL
+)
+@PropertyLayout(
+ named = Notes.NAMED,
+ multiLine = Notes.MULTI_LINE
+)
+@Parameter(
+ maxLength = Notes.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL
+)
+@ParameterLayout(
+ named = Notes.NAMED,
+ multiLine = Notes.MULTI_LINE
+)
+//@javax.jdo.annotations.Column(length = Notes.MAX_LENGTH, allowsNull = "true")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Notes {
- int MAX_LEN = 4000;
+ int MAX_LENGTH = 4000;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Notes";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
int MULTI_LINE = 10;
+ @AliasFor( annotation = PropertyLayout.class, attribute = "multiLine")
+ int propertyLayoutMultiLine() default MULTI_LINE;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "multiLine")
+ int parameterLayoutMultiLine() default MULTI_LINE;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ObjectIdentifier.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ObjectIdentifier.java
index 2b40374..183f351 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ObjectIdentifier.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ObjectIdentifier.java
@@ -18,27 +18,68 @@
*/
package org.apache.isis.subdomains.base.applib.types;
-
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
- * the identity of a domain object (with respect to its logical type).
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
+ * the identity of a domain object (with respect to its logical type, as per @{@link DomainObject#logicalTypeName() DomainObject#logicalTypeName}
+ * or @{@link DomainService#logicalTypeName() DomainObject#logicalTypeName}).
+ *
+ * @see LogicalTypeName
*
* @since 2.0 {@index}
*/
-@Property(maxLength = ObjectIdentifier.MAX_LEN)
-@Parameter(maxLength = ObjectIdentifier.MAX_LEN)
+@Property(
+ maxLength = ObjectIdentifier.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = ObjectIdentifier.NAMED
+)
+@Parameter(
+ maxLength = ObjectIdentifier.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = ObjectIdentifier.NAMED
+)
+//@javax.jdo.annotations.Column(length = ObjectIdentifier.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ObjectIdentifier {
- int MAX_LEN = 50;
+ int MAX_LENGTH = 50;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Object identifier";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Percentage.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Percentage.java
index 83b06cc..8c3f9a2 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Percentage.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Percentage.java
@@ -23,19 +23,60 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a numeric property or parameter representing a
- * the identity of a domain object (with respect to its logical type).
+ * Meta-annotation for an optional {@link java.math.BigDecimal} property or parameter
+ * representing a percentage amount.
*
* @since 2.0 {@index}
*/
+@Property(
+ optionality = Optionality.OPTIONAL
+)
+@PropertyLayout(
+ named = Percentage.NAMED
+)
+@Parameter(
+ optionality = Optionality.OPTIONAL
+)
+@ParameterLayout(
+ named = Percentage.NAMED
+)
+@javax.validation.constraints.Digits(
+ integer = Percentage.INTEGER,
+ fraction = Percentage.FRACTION
+)
+//@javax.jdo.annotations.Column(allowsNull = "true")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Percentage {
- int SCALE = 2;
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+
+ String NAMED = "Percentage (%)";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+ int INTEGER = 3;
+ @AliasFor( annotation = javax.validation.constraints.Digits.class, attribute = "integer")
+ int digitsInteger() default Money.INTEGER;
+
+ int FRACTION = 2;
+ @AliasFor( annotation = javax.validation.constraints.Digits.class, attribute = "fraction")
+ int digitsFraction() default Money.FRACTION;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PhoneNumber.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PhoneNumber.java
new file mode 100644
index 0000000..791b21b
--- /dev/null
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PhoneNumber.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.subdomains.base.applib.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
+
+/**
+ * Meta-annotation for an optional {@link String} property or parameter representing a
+ * phone number.
+ *
+ * @since 2.0 {@index}
+ */
+@Property(
+ maxLength = PhoneNumber.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL,
+ regexPattern = PhoneNumber.REGEX_PATTERN,
+ regexPatternReplacement = PhoneNumber.REGEX_PATTERN_REPLACEMENT
+)
+@PropertyLayout(
+ named = PhoneNumber.NAMED
+)
+@Parameter(
+ maxLength = PhoneNumber.MAX_LENGTH,
+ optionality = Optionality.OPTIONAL,
+ regexPattern = PhoneNumber.REGEX_PATTERN,
+ regexPatternReplacement = PhoneNumber.REGEX_PATTERN_REPLACEMENT
+)
+@ParameterLayout(
+ named = PhoneNumber.NAMED
+)
+//@javax.jdo.annotations.Column(length = PhoneNumber.MAX_LENGTH, allowsNull = "true")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PhoneNumber {
+
+ int MAX_LENGTH = 20;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+ String REGEX_PATTERN = "[+]?[0-9 -]*";
+ @AliasFor( annotation = Property.class, attribute = "regexPattern")
+ String propertyRegexPattern() default REGEX_PATTERN;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPattern")
+ String parameterRegexPattern() default REGEX_PATTERN;
+
+ String REGEX_PATTERN_REPLACEMENT = "Only numbers and two symbols being \"-\" and \"+\" are allowed ";
+ @AliasFor( annotation = Property.class, attribute = "regexPatternReplacement")
+ String propertyRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPatternReplacement")
+ String parameterRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "true";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Phone Number";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+
+}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PostalCode.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PostalCode.java
new file mode 100644
index 0000000..c492e49
--- /dev/null
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/PostalCode.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.subdomains.base.applib.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
+
+/**
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
+ * postal code or zip code.
+ *
+ * @since 2.0 {@index}
+ */
+@Property(
+ maxLength = PostalCode.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = PostalCode.NAMED
+)
+@Parameter(
+ maxLength = PostalCode.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = PostalCode.NAMED
+)
+//@javax.jdo.annotations.Column(length = PostalCode.MAX_LENGTH, allowsNull = "true")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PostalCode {
+
+ int MAX_LENGTH = 12;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Postal code";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
+}
\ No newline at end of file
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ProperName.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ProperName.java
index 85d698b..7fba60c 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ProperName.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/ProperName.java
@@ -23,21 +23,58 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing the
+ * Meta-annotation for a mandatory {@link String} property or parameter representing the
* "proper" (or formal) name of some sort.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = ProperName.MAX_LEN)
-@Parameter(maxLength = ProperName.MAX_LEN)
+@Property(
+ maxLength = ProperName.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = ProperName.NAMED
+)
+@Parameter(
+ maxLength = ProperName.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = ProperName.NAMED
+)
+//@javax.jdo.annotations.Column(length = ProperName.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ProperName {
- int MAX_LEN = 50;
+ int MAX_LENGTH = 50;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Proper (or formal) name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Reference.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Reference.java
index 7f73ce8..e48470a 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Reference.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Reference.java
@@ -18,30 +18,79 @@
*/
package org.apache.isis.subdomains.base.applib.types;
-
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing A
- * unique reference code of some sort.
+ * Meta-annotation for a mandatory {@link String} property or parameter representing A
+ * unique reference code of some sort, restricted to capitals, numbers and '_', '/' and '-'.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Reference.MAX_LEN, regexPattern = Reference.REGEX, regexPatternReplacement = Reference.REGEX_DESCRIPTION)
-@Parameter(maxLength = Reference.MAX_LEN, regexPattern = Reference.REGEX, regexPatternReplacement = Reference.REGEX_DESCRIPTION)
+@Property(
+ maxLength = Reference.MAX_LENGTH,
+ optionality = Optionality.MANDATORY,
+ regexPattern = Reference.REGEX_PATTERN,
+ regexPatternReplacement = Reference.REGEX_PATTERN_REPLACEMENT
+)
+@PropertyLayout(
+ named = Reference.NAMED
+)
+@Parameter(
+ maxLength = Reference.MAX_LENGTH,
+ optionality = Optionality.MANDATORY,
+ regexPattern = Reference.REGEX_PATTERN,
+ regexPatternReplacement = Reference.REGEX_PATTERN_REPLACEMENT
+)
+@ParameterLayout(
+ named = Reference.NAMED
+)
+//@javax.jdo.annotations.Column(length = Reference.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Reference {
- int MAX_LEN = 24;
+ int MAX_LENGTH = 24;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.OPTIONAL;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.OPTIONAL;
+
+ String REGEX_PATTERN = "[ -/_A-Z0-9]+";
+ @AliasFor( annotation = Property.class, attribute = "regexPattern")
+ String propertyRegexPattern() default REGEX_PATTERN;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPattern")
+ String parameterRegexPattern() default REGEX_PATTERN;
+
+ String REGEX_PATTERN_REPLACEMENT = "Only capital letters, numbers and 3 symbols being: \"_\" , \"-\" and \"/\" are allowed";
+ @AliasFor( annotation = Property.class, attribute = "regexPatternReplacement")
+ String propertyRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+ @AliasFor( annotation = Parameter.class, attribute = "regexPatternReplacement")
+ String parameterRegexPatternReplacement() default REGEX_PATTERN_REPLACEMENT;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
- String REGEX = "[ -/_A-Z0-9]+";
- String REGEX_DESCRIPTION = "Only capital letters, numbers and 3 symbols being: \"_\" , \"-\" and \"/\" are allowed";
+ String NAMED = "Reference";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Title.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Title.java
index 83e12cd..dcc8ef1 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Title.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Title.java
@@ -23,21 +23,58 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
* title (or perhaps label) of some sort.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Title.MAX_LEN)
-@Parameter(maxLength = Title.MAX_LEN)
+@Property(
+ maxLength = Title.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = Title.NAMED
+)
+@Parameter(
+ maxLength = Title.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = Title.NAMED
+)
+//@javax.jdo.annotations.Column(length = Title.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Title {
- int MAX_LEN = 50;
+ int MAX_LENGTH = 50;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/UrlTemplate.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/UrlTemplate.java
index 730dc51..e9ad632 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/UrlTemplate.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/UrlTemplate.java
@@ -23,21 +23,58 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing a
+ * Meta-annotation for a mandatory {@link String} property or parameter representing a
* URL template, for example for an entity that holds configuration data to access external systems.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = UrlTemplate.MAX_LEN)
-@Parameter(maxLength = UrlTemplate.MAX_LEN)
+@Property(
+ maxLength = UrlTemplate.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = UrlTemplate.NAMED
+)
+@Parameter(
+ maxLength = UrlTemplate.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = UrlTemplate.NAMED
+)
+//@javax.jdo.annotations.Column(length = UrlTemplate.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface UrlTemplate {
- int MAX_LEN = 254;
+ int MAX_LENGTH = 254;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "URL Template";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}
diff --git a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Username.java b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Username.java
index 97fcf11..6c885b3 100644
--- a/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Username.java
+++ b/subdomains/base/applib/src/main/java/org/apache/isis/subdomains/base/applib/types/Username.java
@@ -23,21 +23,58 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.springframework.core.annotation.AliasFor;
/**
- * Meta-annotation for a {@link String} property or parameter representing the
+ * Meta-annotation for a mandatory {@link String} property or parameter representing the
* unique username (or login name) of a user of the system.
*
* @since 2.0 {@index}
*/
-@Property(maxLength = Username.MAX_LEN)
-@Parameter(maxLength = Username.MAX_LEN)
+@Property(
+ maxLength = Username.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@PropertyLayout(
+ named = Username.NAMED
+)
+@Parameter(
+ maxLength = Username.MAX_LENGTH,
+ optionality = Optionality.MANDATORY
+)
+@ParameterLayout(
+ named = Username.NAMED
+)
+//@javax.jdo.annotations.Column(length = Username.MAX_LENGTH, allowsNull = "false")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Username {
- int MAX_LEN = 120;
+ int MAX_LENGTH = 120;
+ @AliasFor( annotation = Property.class, attribute = "maxLength")
+ int propertyMaxLength() default MAX_LENGTH;
+ @AliasFor( annotation = Parameter.class, attribute = "maxLength")
+ int parameterMaxLength() default MAX_LENGTH;
+
+ @AliasFor( annotation = Property.class, attribute = "optionality")
+ Optionality propertyOptionality() default Optionality.MANDATORY;
+ @AliasFor( annotation = Parameter.class, attribute = "optionality")
+ Optionality parameterOptionality() default Optionality.MANDATORY;
+
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "allowsNull")
+// String columnAllowsNull() default "false";
+// @AliasFor( annotation = javax.jdo.annotations.Column.class, attribute = "length")
+// String columnLength() default MAX_LENGTH;
+
+ String NAMED = "Name";
+ @AliasFor( annotation = PropertyLayout.class, attribute = "named")
+ String propertyLayoutNamed() default NAMED;
+ @AliasFor( annotation = ParameterLayout.class, attribute = "named")
+ String parameterLayoutNamed() default NAMED;
}