feat: added classes
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
public interface CalendarProperty extends CalendarResolvable {
|
||||
}
|
||||
+2
-4
@@ -15,16 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.calendar;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* CalendarScale
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum CalendarScale implements Prop {
|
||||
public enum CalendarScale implements CalendarProperty {
|
||||
|
||||
GREGORIAN,
|
||||
;
|
||||
+2
-4
@@ -15,11 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.calendar;
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
|
||||
public enum Method implements Prop {
|
||||
public enum Method implements CalendarProperty {
|
||||
|
||||
PUBLISH("PUBLISH"),
|
||||
REQUEST("REQUEST"),
|
||||
+10
-12
@@ -15,18 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.calendar;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* ProductIdentifier
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class ProductIdentifier implements Prop {
|
||||
public final class ProductIdentifier implements CalendarProperty {
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
@@ -34,29 +32,28 @@ public final class ProductIdentifier implements Prop {
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final ProductIdentifier productIdentifier;
|
||||
private String productIdentifier;
|
||||
|
||||
private Builder() {
|
||||
this.productIdentifier = new ProductIdentifier();
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String productIdentifier) {
|
||||
this.productIdentifier.value = productIdentifier;
|
||||
this.productIdentifier = productIdentifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String companyName, String productName) {
|
||||
this.productIdentifier.value = "-//" + companyName + "//" + productName + "//EN";
|
||||
this.productIdentifier = "-//" + companyName + "//" + productName + "//EN";
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String companyName, String productName, String languageTag) {
|
||||
this.productIdentifier.value = "-//" + companyName + "//" + productName + "//" + languageTag;
|
||||
this.productIdentifier = "-//" + companyName + "//" + productName + "//" + languageTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProductIdentifier build() {
|
||||
return productIdentifier;
|
||||
return new ProductIdentifier(productIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +63,7 @@ public final class ProductIdentifier implements Prop {
|
||||
|
||||
private static final String PROPERTY_NAME = "PRODID";
|
||||
|
||||
private ProductIdentifier() {
|
||||
private ProductIdentifier(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -15,16 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.calendar;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum Version implements Prop {
|
||||
public enum Version implements CalendarProperty {
|
||||
|
||||
VERSION_2_0,
|
||||
;
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
import com.onixbyte.icalendar.property.calendar.CalendarScale;
|
||||
import com.onixbyte.icalendar.property.calendar.Method;
|
||||
import com.onixbyte.icalendar.property.calendar.ProductIdentifier;
|
||||
import com.onixbyte.icalendar.property.calendar.Version;
|
||||
import com.onixbyte.icalendar.calendar.property.CalendarScale;
|
||||
import com.onixbyte.icalendar.calendar.property.Method;
|
||||
import com.onixbyte.icalendar.calendar.property.ProductIdentifier;
|
||||
import com.onixbyte.icalendar.calendar.property.Version;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -100,9 +100,7 @@ public final class Calendar {
|
||||
.ifPresent((_method) -> calendarBuilder.append(_method.resolve()).append('\n'));
|
||||
|
||||
if (!components.isEmpty()) {
|
||||
for (var component : components) {
|
||||
calendarBuilder.append(component.resolve()).append('\n');
|
||||
}
|
||||
components.forEach(((component) -> calendarBuilder.append(component.resolve()).append('\n')));
|
||||
}
|
||||
|
||||
calendarBuilder.append("END:").append(COMPONENT_NAME).append('\n');
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
/**
|
||||
* The abstract sealed class {@code WebCalendarNode} represents a node in a web calendar, such as an <a href="">event</a>, a to-do
|
||||
* item, or an alarm. It provides common properties and methods for all calendar components and events.
|
||||
* The abstract sealed class {@code WebCalendarNode} represents a node in a web calendar, such as an
|
||||
* <a href="some_link">event</a>, a to-do item, or an alarm. It provides common properties and
|
||||
* methods for all calendar components and events.
|
||||
* <p>
|
||||
* Subclasses of {@code WebCalendarNode} should implement the {@link #resolve()} method to generate the corresponding iCalendar content for the specific calendar component or event.
|
||||
* Subclasses of {@code WebCalendarNode} should implement the {@link #resolve()} method to generate
|
||||
* the corresponding iCalendar content for the specific calendar component or event.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.1.0
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
import com.onixbyte.icalendar.property.component.DateTimeStamp;
|
||||
import com.onixbyte.icalendar.property.component.UniqueIdentifier;
|
||||
import com.onixbyte.icalendar.component.property.Classification;
|
||||
import com.onixbyte.icalendar.component.property.DateTimeStamp;
|
||||
import com.onixbyte.icalendar.component.property.UniqueIdentifier;
|
||||
|
||||
/**
|
||||
* Event
|
||||
@@ -27,11 +28,39 @@ import com.onixbyte.icalendar.property.component.UniqueIdentifier;
|
||||
*/
|
||||
public class Event extends CalendarComponent {
|
||||
|
||||
/*
|
||||
* The following properties are REQUIRED, but MUST NOT occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private DateTimeStamp dtStamp;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private UniqueIdentifier uid;
|
||||
|
||||
/*
|
||||
* The following property is REQUIRED if the component appears in an iCalendar object that
|
||||
* doesn't specify the "METHOD" property; otherwise, it is OPTIONAL; in any case, it MUST NOT
|
||||
* occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private DateTimeStamp dtStart;
|
||||
|
||||
/*
|
||||
* The following properties are OPTIONAL, but MUST NOT occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Classification classification;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
|
||||
+13
-5
@@ -15,19 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.component;
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.parameter.FormatType;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Attach
|
||||
* Attachment
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class Attach implements Prop {
|
||||
public final class Attachment implements ComponentProperty {
|
||||
|
||||
private FormatType formatType;
|
||||
|
||||
@@ -35,6 +35,14 @@ public final class Attach implements Prop {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "";
|
||||
final var attachmentBuilder = new StringBuilder("ATTACH");
|
||||
|
||||
Optional.ofNullable(formatType)
|
||||
.ifPresent((fmtType) -> attachmentBuilder.append(fmtType.resolve()));
|
||||
|
||||
attachmentBuilder.append(":")
|
||||
.append(uri.toString());
|
||||
|
||||
return attachmentBuilder.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.component.property;
|
||||
|
||||
public class Categories {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.component.property;
|
||||
|
||||
public enum Classification {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
public interface ComponentProperty extends CalendarResolvable {
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.component;
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
/**
|
||||
* DateTimeCreated
|
||||
+7
-7
@@ -15,19 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.component;
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.calendar.property.Method;
|
||||
import com.onixbyte.icalendar.config.Formatters;
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that specifies a "{@link
|
||||
* com.onixbyte.icalendar.property.calendar.Method Method}" property, this property specifies the date and time that
|
||||
* Method Method}" property, this property specifies the date and time that
|
||||
* the instance of the {@link com.onixbyte.icalendar.component.Calendar iCalendar} object was created. In the case of
|
||||
* an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that doesn't specify a "{@link
|
||||
* com.onixbyte.icalendar.property.calendar.Method Method}" property, this property specifies the date and time that
|
||||
* Method Method}" property, this property specifies the date and time that
|
||||
* the information associated with the calendar component was last revised in the calendar store.
|
||||
* <p>
|
||||
* The value MUST be specified in the UTC time format.
|
||||
@@ -37,19 +37,19 @@ import java.time.LocalDateTime;
|
||||
* com.onixbyte.icalendar.component.Calendar iCalendar} objects.
|
||||
* <p>
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that specifies a "{@link
|
||||
* com.onixbyte.icalendar.property.calendar.Method Method}" property, this property differs from the "{@link
|
||||
* Method Method}" property, this property differs from the "{@link
|
||||
* DateTimeCreated CREATED}" and "{@link LastModified LAST-MODIFIED}" properties. These two properties are used to
|
||||
* specify when the particular calendar data in the calendar store was created and last modified. This is different
|
||||
* from when the {@link com.onixbyte.icalendar.component.Calendar iCalendar} object representation of the calendar
|
||||
* service information was created or last modified.
|
||||
* <p>
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that specifies a "{@link
|
||||
* com.onixbyte.icalendar.property.calendar.Method METHOD}" property, this property is equivalent to the "{@link
|
||||
* Method METHOD}" property, this property is equivalent to the "{@link
|
||||
* LastModified LAST-MODIFIED}" property.
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class DateTimeStamp implements Prop {
|
||||
public final class DateTimeStamp implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DTSTAMP";
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.component;
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
/**
|
||||
* LastModified
|
||||
+2
-4
@@ -15,16 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.component;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
/**
|
||||
* UniqueIdentifier
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class UniqueIdentifier implements Prop {
|
||||
public final class UniqueIdentifier implements ComponentProperty {
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.datatype;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public final class CalendarUserAddress {
|
||||
|
||||
private URI value;
|
||||
|
||||
public CalendarUserAddress(URI value) {
|
||||
if (!"mailto".equalsIgnoreCase(value.getScheme())) {
|
||||
throw new IllegalArgumentException("Calendar User Address (CAL-ADDRESS) only accept mailto URI.");
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.onixbyte.icalendar.property;
|
||||
|
||||
public interface Prop {
|
||||
public interface CalendarResolvable {
|
||||
|
||||
String resolve();
|
||||
|
||||
+31
-21
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
@@ -33,33 +33,43 @@ import java.net.URI;
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
*/
|
||||
public final class AlternateRepresentation implements Prop {
|
||||
public final class AlternateRepresentation implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "ALTREP";
|
||||
|
||||
private URI uri;
|
||||
private URI value;
|
||||
|
||||
private AlternateRepresentation() {
|
||||
}
|
||||
|
||||
public AlternateRepresentation setUri(String uri) {
|
||||
this.uri = URI.create(uri);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlternateRepresentation setUri(URI uri) {
|
||||
this.uri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static AlternateRepresentation createInstance(String uri) {
|
||||
var instance = new AlternateRepresentation();
|
||||
instance.uri = URI.create(uri);
|
||||
return instance;
|
||||
private AlternateRepresentation(URI uri) {
|
||||
this.value = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=\"" + uri.toString() + "\"";
|
||||
return PROPERTY_NAME + "=\"" + value.toString() + "\"";
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private URI uri;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder uri(String uri) {
|
||||
this.uri = URI.create(uri);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder uri(URI uri) {
|
||||
this.uri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlternateRepresentation build() {
|
||||
return new AlternateRepresentation(uri);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,14 +17,14 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
/**
|
||||
* CalendarUserType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum CalendarUserType implements Prop {
|
||||
public enum CalendarUserType implements PropertyParameter {
|
||||
|
||||
/**
|
||||
* An individual.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
/**
|
||||
* Common Name can be specified on properties with a CAL-ADDRESS value type. The parameter
|
||||
@@ -27,26 +27,38 @@ import com.onixbyte.icalendar.property.Prop;
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
*/
|
||||
public final class CommonName implements Prop {
|
||||
public final class CommonName implements PropertyParameter {
|
||||
|
||||
private String value;
|
||||
private static final String PROPERTY_NAME = "CN";
|
||||
|
||||
private CommonName() {
|
||||
private final String value;
|
||||
|
||||
private CommonName(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CommonName setValue(String value) {
|
||||
this.value = value;
|
||||
public static class Builder {
|
||||
private String value;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder commonName(String commonName) {
|
||||
this.value = commonName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static CommonName createInstance(String commonName) {
|
||||
var instance = new CommonName();
|
||||
instance.value = commonName;
|
||||
return instance;
|
||||
public CommonName build() {
|
||||
return new CommonName(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "CN=\"" + this.value + "\"";
|
||||
return PROPERTY_NAME + "=\"" + this.value + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,49 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.CalendarUserAddress;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Delegate
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class Delegatee {
|
||||
public final class Delegatee implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "DELEGATED-TO";
|
||||
|
||||
private final List<CalendarUserAddress> value;
|
||||
|
||||
private Delegatee(List<CalendarUserAddress> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private List<CalendarUserAddress> value;
|
||||
|
||||
private Builder() {
|
||||
this.value = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder addDelegatee(URI delegateeUri) {
|
||||
value.add(new CalendarUserAddress(delegateeUri));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Delegatee build() {
|
||||
return new Delegatee(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + String.join(",", value
|
||||
.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.net.URI;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class Delegator implements Prop {
|
||||
public final class Delegator implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "DELEGATED-FROM";
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Prop;
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
/**
|
||||
* FormatType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum FormatType implements Prop {
|
||||
public enum FormatType implements PropertyParameter {
|
||||
|
||||
JSON("application/json"),
|
||||
|
||||
|
||||
@@ -17,10 +17,257 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
/**
|
||||
* Language
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class Language {
|
||||
public enum Language implements PropertyParameter {
|
||||
|
||||
AFRIKAANS("af"),
|
||||
SOUTH_AFRICA_AFRIKAANS("af-ZA"),
|
||||
ARABIC("ar"),
|
||||
UAE_ARABIC("ar-AE"),
|
||||
BAHRAIN_ARABIC("ar-BH"),
|
||||
ALGERIA_ARABIC("ar-DZ"),
|
||||
EGYPT_ARABIC("ar-EG"),
|
||||
IRAQ_ARABIC("ar-IQ"),
|
||||
JORDAN_ARABIC("ar-JO"),
|
||||
KUWAIT_ARABIC("ar-KW"),
|
||||
LEBANON_ARABIC("ar-LB"),
|
||||
LIBYA_ARABIC("ar-LY"),
|
||||
MOROCCO_ARABIC("ar-MA"),
|
||||
OMAN_ARABIC("ar-OM"),
|
||||
QATAR_ARABIC("ar-QA"),
|
||||
SAUDI_ARABIA_ARABIC_("ar-SA"),
|
||||
SYRIA_ARABIC("ar-SY"),
|
||||
TUNISIA_ARABIC("ar-TN"),
|
||||
YEMEN_ARABIC("ar-YE"),
|
||||
LATIN_AZERI("az"),
|
||||
AZERBAIJAN_LATIN_AZERI("az-AZ"),
|
||||
AZERBAIJAN_CYRILLIC_AZERI("az-Cyrl-AZ"),
|
||||
BELARUSIAN("be"),
|
||||
BELARUS_BELARUSIAN("be-BY"),
|
||||
BULGARIAN("bg"),
|
||||
BULGARIA_BULGARIAN("bg-BG"),
|
||||
BOSNIA_AND_HERZEGOVINA_BOSNIAN("bs-BA"),
|
||||
CATALAN("ca"),
|
||||
SPAIN_CATALAN("ca-ES"),
|
||||
CZECH("cs"),
|
||||
CZECH_REPUBLIC_CZECH("cs-CZ"),
|
||||
WELSH("cy"),
|
||||
UNITED_KINGDOM_WELSH("cy-GB"),
|
||||
DANISH("da"),
|
||||
DENMARK_DANISH("da-DK"),
|
||||
GERMAN("de"),
|
||||
AUSTRIA_GERMAN("de-AT"),
|
||||
SWITZERLAND_GERMAN("de-CH"),
|
||||
GERMANY_GERMAN("de-DE"),
|
||||
LIECHTENSTEIN_GERMAN("de-LI"),
|
||||
LUXEMBOURG_GERMAN("de-LU"),
|
||||
DIVEHI("dv"),
|
||||
MALDIVES_DIVEHI("dv-MV"),
|
||||
GREEK("el"),
|
||||
GREECE_GREEK("el-GR"),
|
||||
ENGLISH("en"),
|
||||
AUSTRALIA_ENGLISH("en-AU"),
|
||||
BELIZE_ENGLISH("en-BZ"),
|
||||
CANADA_ENGLISH("en-CA"),
|
||||
CARIBBEAN_ENGLISH("en-CB"),
|
||||
UNITED_KINGDOM_ENGLISH("en-GB"),
|
||||
IRELAND_ENGLISH("en-IE"),
|
||||
JAMAICA_ENGLISH("en-JM"),
|
||||
NEW_ZEALAND_ENGLISH("en-NZ"),
|
||||
PHILIPPINES_ENGLISH("en-PH"),
|
||||
TRINIDAD_AND_TOBAGO_ENGLISH("en-TT"),
|
||||
UNITED_STATES_ENGLISH("en-US"),
|
||||
SOUTH_AFRICA_ENGLISH("en-ZA"),
|
||||
ZIMBABWE_ENGLISH("en-ZW"),
|
||||
ESPERANTO("eo"),
|
||||
SPANISH("es"),
|
||||
ARGENTINA_SPANISH("es-AR"),
|
||||
BOLIVIA_SPANISH("es-BO"),
|
||||
CHILE_SPANISH("es-CL"),
|
||||
COLOMBIA_SPANISH("es-CO"),
|
||||
COSTA_RICA_SPANISH("es-CR"),
|
||||
DOMINICAN_REPUBLIC_SPANISH("es-DO"),
|
||||
ECUADOR_SPANISH("es-EC"),
|
||||
SPAIN_SPANISH("es-ES"),
|
||||
GUATEMALA_SPANISH("es-GT"),
|
||||
HONDURAS_SPANISH("es-HN"),
|
||||
MEXICO_SPANISH("es-MX"),
|
||||
NICARAGUA_SPANISH("es-NI"),
|
||||
PANAMA_SPANISH("es-PA"),
|
||||
PERU_SPANISH("es-PE"),
|
||||
PUERTO_RICO_SPANISH("es-PR"),
|
||||
PARAGUAY_SPANISH("es-PY"),
|
||||
EL_SALVADOR_SPANISH("es-SV"),
|
||||
URUGUAY_SPANISH("es-UY"),
|
||||
VENEZUELA_SPANISH("es-VE"),
|
||||
ESTONIAN("et"),
|
||||
ESTONIA_ESTONIAN("et-EE"),
|
||||
BASQUE("eu"),
|
||||
SPAIN_BASQUE("eu-ES"),
|
||||
FARSI("fa"),
|
||||
IRAN_FARSI("fa-IR"),
|
||||
FINNISH("fi"),
|
||||
FINLAND_FINNISH("fi-FI"),
|
||||
FAROESE("fo"),
|
||||
FAROE_ISLANDS_FAROESE("fo-FO"),
|
||||
FRENCH("fr"),
|
||||
BELGIUM_FRENCH("fr-BE"),
|
||||
CANADA_FRENCH("fr-CA"),
|
||||
SWITZERLAND_FRENCH("fr-CH"),
|
||||
FRANCE_FRENCH("fr-FR"),
|
||||
LUXEMBOURG_FRENCH("fr-LU"),
|
||||
MONACO_FRENCH("fr-MC"),
|
||||
GALICIAN("gl"),
|
||||
SPAIN_GALICIAN("gl-ES"),
|
||||
GUJARATI("gu"),
|
||||
INDIA_GUJARATI("gu-IN"),
|
||||
HEBREW("he"),
|
||||
ISRAEL_HEBREW("he-IL"),
|
||||
HINDI("hi"),
|
||||
INDIA_HINDI("hi-IN"),
|
||||
CROATIAN("hr"),
|
||||
BOSNIA_AND_HERZEGOVINA_CROATIAN("hr-BA"),
|
||||
CROATIA_CROATIAN("hr-HR"),
|
||||
HUNGARIAN("hu"),
|
||||
HUNGARY_HUNGARIAN("hu-HU"),
|
||||
ARMENIAN("hy"),
|
||||
ARMENIA_ARMENIAN("hy-AM"),
|
||||
INDONESIAN("id"),
|
||||
INDONESIA_INDONESIAN("id-ID"),
|
||||
ICELANDIC("is"),
|
||||
ICELAND_ICELANDIC("is-IS"),
|
||||
ITALIAN("it"),
|
||||
SWITZERLAND_ITALIAN("it-CH"),
|
||||
ITALY_ITALIAN("it-IT"),
|
||||
JAPANESE("ja"),
|
||||
JAPAN_JAPANESE("ja-JA"),
|
||||
GEORGIAN("ka"),
|
||||
GEORGIA_GEORGIAN("ka-GE"),
|
||||
KAZAKH("kk"),
|
||||
KAZAKHSTAN_KAZAKH("kk-KZ"),
|
||||
KANNADA("kn"),
|
||||
INDIA_KANNADA("kn-IN"),
|
||||
KOREAN("ko"),
|
||||
KOREA_KOREAN("ko-KR"),
|
||||
KONKANI("kok"),
|
||||
INDIA_KONKANI("kok-IN"),
|
||||
KYRGYZ("ky"),
|
||||
KYRGYZSTAN_KYRGYZ("ky-KG"),
|
||||
LITHUANIAN("lt"),
|
||||
LITHUANIA_LITHUANIAN("lt-LT"),
|
||||
LATVIAN("lv"),
|
||||
LATVIA_LATVIAN("lv-LV"),
|
||||
MAORI("mi"),
|
||||
NEW_ZEALAND_MAORI("mi-NZ"),
|
||||
FYRO_MACEDONIAN("mk"),
|
||||
MACEDONIA_FYRO_MACEDONIAN("mk-MK"),
|
||||
MONGOLIAN("mn"),
|
||||
MONGOLIA_MONGOLIAN("mn-MN"),
|
||||
MARATHI("mr"),
|
||||
INDIA_MARATHI("mr-IN"),
|
||||
MALAY("ms"),
|
||||
BRUNEI_DARUSSALAM_MALAY("ms-BN"),
|
||||
MALAYSIA_MALAY("ms-MY"),
|
||||
MALTESE("mt"),
|
||||
MALTA_MALTESE("mt-MT"),
|
||||
NORWEGIAN("nb"),
|
||||
NORWAY_NORWEGIAN("nb-NO"),
|
||||
DUTCH("nl"),
|
||||
BELGIUM_DUTCH("nl-BE"),
|
||||
NETHERLANDS_DUTCH("nl-NL"),
|
||||
NORWAY_NYNORSK_NORWEGIAN("nn-NO"),
|
||||
NORTHERN_SOTHO("ns"),
|
||||
SOUTH_AFRICA_NORTHERN_SOTHO("ns-ZA"),
|
||||
PUNJABI("pa"),
|
||||
INDIA_PUNJABI("pa-IN"),
|
||||
POLISH("pl"),
|
||||
POLAND_POLISH("pl-PL"),
|
||||
PASHTO("pt"),
|
||||
AFGHANISTAN_PASHTO("ps-AR"),
|
||||
PORTUGUESE("pt"),
|
||||
BRAZIL_PORTUGUESE("pt-BR"),
|
||||
PORTUGAL_PORTUGUESE("pt-PT"),
|
||||
QUECHUA("qu"),
|
||||
BOLIVIA_QUECHUA("qu-BO"),
|
||||
ECUADOR_QUECHUA("qu-EC"),
|
||||
PERU_QUECHUA("qu-PE"),
|
||||
ROMANIAN("ro"),
|
||||
ROMANIA_ROMANIAN("ro-RO"),
|
||||
RUSSIAN("ru"),
|
||||
RUSSIA_RUSSIAN("ru-RU"),
|
||||
SANSKRIT("sa"),
|
||||
INDIA_SANSKRIT("sa-IN"),
|
||||
SAMI("se"),
|
||||
FINLAND_SAMI("se-FI"),
|
||||
NORWAY_SAMI("se-NO"),
|
||||
SWEDEN_SAMI("se-SE"),
|
||||
SLOVAK("sk"),
|
||||
SLOVAKIA_SLOVAK("sk-SK"),
|
||||
SLOVENIAN("sl"),
|
||||
SLOVENIA_SLOVENIAN("sl-SI"),
|
||||
ALBANIAN("sq"),
|
||||
ALBANIA_ALBANIAN("sq-AL"),
|
||||
BOSNIA_AND_HERZEGOVINA_LATIN_SERBIAN("sr-BA"),
|
||||
BOSNIA_AND_HERZEGOVINA_CYRILLIC_SERBIAN("sr-Cyrl-BA"),
|
||||
SERBIA_AND_MONTENEGRO_LATIN_SERBIAN("sr-SP"),
|
||||
SERBIA_AND_MONTENEGRO_CYRILLIC_SERBIAN("sr-Cyrl-SP"),
|
||||
SWEDISH("sv"),
|
||||
FINLAND_SWEDISH("sv-FI"),
|
||||
SWEDEN_SWEDISH("sv-SE"),
|
||||
SWAHILI("sw"),
|
||||
KENYA_SWAHILI("sw-KE"),
|
||||
SYRIAC("syr"),
|
||||
SYRIA_SYRIAC("syr-SY"),
|
||||
TAMIL("ta"),
|
||||
INDIA_TAMIL("ta-IN"),
|
||||
TELUGU("te"),
|
||||
INDIA_TELUGU("te-IN"),
|
||||
THAI("th"),
|
||||
THAILAND_THAI("th-TH"),
|
||||
TAGALOG("tl"),
|
||||
PHILIPPINES_TAGALOG("tl-PH"),
|
||||
TSWANA("tn"),
|
||||
SOUTH_AFRICA_TSWANA("tn-ZA"),
|
||||
TURKISH("tr"),
|
||||
TURKEY_TURKISH("tr-TR"),
|
||||
TATAR("tt"),
|
||||
RUSSIA_TATAR("tt-RU"),
|
||||
TSONGA("ts"),
|
||||
UKRAINIAN("uk"),
|
||||
UKRAINE_UKRAINIAN("uk-UA"),
|
||||
URDU("ur"),
|
||||
PAKISTAN_URDU("ur-PK"),
|
||||
UZBEK("uz"),
|
||||
UZBEKISTAN_UZBEK("uz-UZ"),
|
||||
UZBEKISTAN_CYRILLIC_UZBEK("uz-Cyrl-UZ"),
|
||||
VIETNAMESE("vi"),
|
||||
VIETNAM_VIETNAMESE("vi-VN"),
|
||||
XHOSA("xh"),
|
||||
SOUTH_AFRICA_XHOSA("xh-ZA"),
|
||||
CHINESE("zh"),
|
||||
SIMPLIFIED_CHINESE("zh-CN"),
|
||||
HONG_KONG_CHINESE("zh-HK"),
|
||||
MACAU_CHINESE("zh-MO"),
|
||||
SINGAPORE_CHINESE("zh-SG"),
|
||||
TRADITIONAL_CHINESE("zh-TW"),
|
||||
ZULU("zu"),
|
||||
SOUTH_AFRICA_ZULU("zu-ZA")
|
||||
;
|
||||
|
||||
private final String value;
|
||||
|
||||
Language(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "LANGUAGE=" + value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed 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 com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.CalendarResolvable;
|
||||
|
||||
public interface PropertyParameter extends CalendarResolvable {
|
||||
}
|
||||
Reference in New Issue
Block a user