Skip to content

Commit 604d31b

Browse files
authored
Merge pull request #27 from ical4j/develop
Added property accessors/modifiers
2 parents b11d5be + 996e838 commit 604d31b

24 files changed

+880
-21
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "ical4j-vcard-*"
7+
- "!ical4j-vcard-*-pre"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
# - name: Generate changelog
16+
# run: make changelog
17+
- name: Release
18+
uses: softprops/action-gh-release@v2
19+
with:
20+
generate_release_notes: true
21+
# body_path: CHANGELOG.md

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ical4jVersion=4.0.0-rc6
1+
ical4jVersion=4.0.2
22

33
log4jVersion=2.22.1
44
commonsIoVersion=2.15.1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package net.fortuna.ical4j.vcard;
2+
3+
import net.fortuna.ical4j.model.PropertyContainer;
4+
import net.fortuna.ical4j.vcard.property.Address;
5+
6+
import java.util.List;
7+
8+
public interface AddressPropertyAccessor extends PropertyContainer {
9+
10+
default List<Address> getAddresses() {
11+
return getProperties(PropertyName.ADR.toString());
12+
}
13+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2024, Ben Fortuna
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* o Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
*
12+
* o Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
*
16+
* o Neither the name of Ben Fortuna nor the names of any other contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*
32+
*/
33+
34+
package net.fortuna.ical4j.vcard;
35+
36+
import net.fortuna.ical4j.model.PropertyContainer;
37+
import net.fortuna.ical4j.vcard.property.Address;
38+
39+
import java.util.function.BiFunction;
40+
41+
/**
42+
* A collection of functions used to modify properties in a target property container.
43+
* Used in conjunction with {@link PropertyContainer#with(BiFunction, Object)}
44+
*/
45+
public interface AddressPropertyModifiers {
46+
47+
BiFunction<PropertyContainer, Address, PropertyContainer> ADR = (c, p) -> {
48+
if (p != null) c.add(p);
49+
return c;
50+
};
51+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package net.fortuna.ical4j.vcard;
2+
3+
import net.fortuna.ical4j.model.PropertyContainer;
4+
import net.fortuna.ical4j.vcard.property.CalAdrUri;
5+
import net.fortuna.ical4j.vcard.property.CalUri;
6+
import net.fortuna.ical4j.vcard.property.FbUrl;
7+
8+
import java.util.List;
9+
10+
public interface CalendarPropertyAccessor extends PropertyContainer {
11+
12+
default List<FbUrl> getFbUrls() {
13+
return getProperties(PropertyName.FBURL.toString());
14+
}
15+
16+
default List<CalAdrUri> getCalAdrUris() {
17+
return getProperties(PropertyName.CALADRURI.toString());
18+
}
19+
20+
default List<CalUri> getCalUris() {
21+
return getProperties(PropertyName.CALURI.toString());
22+
}
23+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2024, Ben Fortuna
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* o Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
*
12+
* o Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
*
16+
* o Neither the name of Ben Fortuna nor the names of any other contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*
32+
*/
33+
34+
package net.fortuna.ical4j.vcard;
35+
36+
import net.fortuna.ical4j.model.PropertyContainer;
37+
import net.fortuna.ical4j.vcard.property.CalAdrUri;
38+
import net.fortuna.ical4j.vcard.property.CalUri;
39+
import net.fortuna.ical4j.vcard.property.FbUrl;
40+
41+
import java.util.function.BiFunction;
42+
43+
/**
44+
* A collection of functions used to modify properties in a target property container.
45+
* Used in conjunction with {@link PropertyContainer#with(BiFunction, Object)}
46+
*/
47+
public interface CalendarPropertyModifiers {
48+
49+
BiFunction<PropertyContainer, FbUrl, PropertyContainer> FBURL = (c, p) -> {
50+
if (p != null) c.add(p);
51+
return c;
52+
};
53+
54+
BiFunction<PropertyContainer, CalAdrUri, PropertyContainer> CALADRURI = (c, p) -> {
55+
if (p != null) c.add(p);
56+
return c;
57+
};
58+
59+
BiFunction<PropertyContainer, CalUri, PropertyContainer> CALURI = (c, p) -> {
60+
if (p != null) c.add(p);
61+
return c;
62+
};
63+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package net.fortuna.ical4j.vcard;
2+
3+
import net.fortuna.ical4j.model.PropertyContainer;
4+
import net.fortuna.ical4j.vcard.property.Email;
5+
import net.fortuna.ical4j.vcard.property.Impp;
6+
import net.fortuna.ical4j.vcard.property.Lang;
7+
import net.fortuna.ical4j.vcard.property.Telephone;
8+
9+
import java.util.List;
10+
11+
public interface CommunicationsPropertyAccessor extends PropertyContainer {
12+
13+
default List<Telephone> getTelephones() {
14+
return getProperties(PropertyName.TEL.toString());
15+
}
16+
17+
default List<Email> getEmails() {
18+
return getProperties(PropertyName.EMAIL.toString());
19+
}
20+
21+
default List<Impp> getImpps() {
22+
return getProperties(PropertyName.IMPP.toString());
23+
}
24+
25+
default List<Lang> getLangs() {
26+
return getProperties(PropertyName.LANG.toString());
27+
}
28+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2024, Ben Fortuna
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* o Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
*
12+
* o Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
*
16+
* o Neither the name of Ben Fortuna nor the names of any other contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*
32+
*/
33+
34+
package net.fortuna.ical4j.vcard;
35+
36+
import net.fortuna.ical4j.model.PropertyContainer;
37+
import net.fortuna.ical4j.vcard.property.Email;
38+
import net.fortuna.ical4j.vcard.property.Impp;
39+
import net.fortuna.ical4j.vcard.property.Lang;
40+
import net.fortuna.ical4j.vcard.property.Telephone;
41+
42+
import java.util.function.BiFunction;
43+
44+
/**
45+
* A collection of functions used to modify properties in a target property container.
46+
* Used in conjunction with {@link PropertyContainer#with(BiFunction, Object)}
47+
*/
48+
public interface CommunicationsPropertyModifiers {
49+
50+
BiFunction<PropertyContainer, Telephone, PropertyContainer> TEL = (c, p) -> {
51+
if (p != null) c.add(p);
52+
return c;
53+
};
54+
55+
BiFunction<PropertyContainer, Email, PropertyContainer> EMAIL = (c, p) -> {
56+
if (p != null) c.add(p);
57+
return c;
58+
};
59+
60+
BiFunction<PropertyContainer, Impp, PropertyContainer> IMPP = (c, p) -> {
61+
if (p != null) c.add(p);
62+
return c;
63+
};
64+
65+
BiFunction<PropertyContainer, Lang, PropertyContainer> LANG = (c, p) -> {
66+
if (p != null) c.add(p);
67+
return c;
68+
};
69+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package net.fortuna.ical4j.vcard;
2+
3+
import net.fortuna.ical4j.model.PropertyContainer;
4+
import net.fortuna.ical4j.vcard.property.*;
5+
6+
import java.util.List;
7+
import java.util.Optional;
8+
9+
public interface ExplanatoryPropertyAccessor extends PropertyContainer {
10+
11+
default List<Categories> getCategories() {
12+
return getProperties(PropertyName.CATEGORIES.toString());
13+
}
14+
15+
default List<Note> getNotes() {
16+
return getProperties(PropertyName.NOTE.toString());
17+
}
18+
19+
default Optional<ProdId> getProdId() {
20+
return getProperty(PropertyName.PRODID);
21+
}
22+
23+
default Optional<Revision> getRevision() {
24+
return getProperty(PropertyName.REV);
25+
}
26+
27+
default List<Sound> getSounds() {
28+
return getProperties(PropertyName.SOUND.toString());
29+
}
30+
31+
default Optional<Uid> getUid() {
32+
return getProperty(PropertyName.UID);
33+
}
34+
35+
default List<ClientPidMap> getClientPidMaps() {
36+
return getProperties(PropertyName.CLIENTPIDMAP.toString());
37+
}
38+
39+
default List<Url> getUrls() {
40+
return getProperties(PropertyName.URL.toString());
41+
}
42+
43+
default Version getVersion() {
44+
return getRequiredProperty(PropertyName.VERSION);
45+
}
46+
}

0 commit comments

Comments
 (0)