com.greenlaw110.rythm.utils.F Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rythm-engine Show documentation
Show all versions of rythm-engine Show documentation
A strong typed high performance Java Template engine with .Net Razor like syntax
The newest version!
/*
* Copyright (C) 2013 The Rythm Engine project
* Gelin Luo
*
* 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 com.greenlaw110.rythm.utils;
import java.util.Collections;
import java.util.Iterator;
/**
* Utility classes
*/
// Most of the code come from Play!Framework F.java, under Apache License 2.0
public class F {
public static interface Action0 {
void invoke();
}
public static interface Action {
void invoke(T result);
}
public static abstract class Option implements Iterable {
public abstract boolean isDefined();
public abstract T get();
public static None None() {
return (None) (Object) None;
}
public static Some Some(T value) {
return new Some(value);
}
}
public static Some Some(A a) {
return new Some(a);
}
public static class None extends Option {
@Override
public boolean isDefined() {
return false;
}
@Override
public T get() {
throw new IllegalStateException("No value");
}
public Iterator iterator() {
return Collections.emptyList().iterator();
}
@Override
public String toString() {
return "None";
}
}
public static None
© 2015 - 2024 Weber Informatics LLC | Privacy Policy