[New] Added ElementLdtDateVisitor and ElementZdtDateVisitor

This commit is contained in:
Robert von Burg 2020-08-06 15:34:03 +02:00
parent c2de8a3849
commit 9a6b78a68d
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,43 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* 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 li.strolch.model.visitor;
import java.time.LocalDateTime;
import li.strolch.model.Order;
import li.strolch.model.Resource;
import li.strolch.model.activity.Activity;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class ElementLdtDateVisitor implements StrolchRootElementVisitor<LocalDateTime> {
@Override
public LocalDateTime visitOrder(Order order) {
return order.getDateLdt();
}
@Override
public LocalDateTime visitResource(Resource resource) {
throw new IllegalArgumentException("Resources have no date!");
}
@Override
public LocalDateTime visitActivity(Activity activity) {
throw new IllegalArgumentException("Activities have no date!");
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* 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 li.strolch.model.visitor;
import java.time.ZonedDateTime;
import li.strolch.model.Order;
import li.strolch.model.Resource;
import li.strolch.model.activity.Activity;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class ElementZdtDateVisitor implements StrolchRootElementVisitor<ZonedDateTime> {
@Override
public ZonedDateTime visitOrder(Order order) {
return order.getDateZdt();
}
@Override
public ZonedDateTime visitResource(Resource resource) {
throw new IllegalArgumentException("Resources have no date!");
}
@Override
public ZonedDateTime visitActivity(Activity activity) {
throw new IllegalArgumentException("Activities have no date!");
}
}