| 1 | package ezvcard.io.scribe; |
| 2 | |
| 3 | import java.time.temporal.Temporal; |
| 4 | |
| 5 | import ezvcard.property.Birthday; |
| 6 | import ezvcard.util.PartialDate; |
| 7 | |
| 8 | /* |
| 9 | Copyright (c) 2012-2023, Michael Angstadt |
| 10 | All rights reserved. |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions are met: |
| 14 | |
| 15 | 1. Redistributions of source code must retain the above copyright notice, this |
| 16 | list of conditions and the following disclaimer. |
| 17 | 2. Redistributions in binary form must reproduce the above copyright notice, |
| 18 | this list of conditions and the following disclaimer in the documentation |
| 19 | and/or other materials provided with the distribution. |
| 20 | |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 28 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | (INCLUDING 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 | * Marshals {@link Birthday} properties. |
| 35 | * @author Michael Angstadt |
| 36 | */ |
| 37 | public class BirthdayScribe extends DateOrTimePropertyScribe<Birthday> { |
| 38 | public BirthdayScribe() { |
| 39 | super(Birthday.class, "BDAY"); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | protected Birthday newInstance(String text) { |
| 44 | return new Birthday(text); |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | protected Birthday newInstance(Temporal date) { |
| 49 | return new Birthday(date); |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | protected Birthday newInstance(PartialDate partialDate) { |
| 54 | return new Birthday(partialDate); |
| 55 | } |
| 56 | } |