diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-04-05 18:32:50 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-04-10 14:47:18 +0300 |
commit | 2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d (patch) | |
tree | fdef2375cc28a6c9db4501cd4535152434c97d10 /shared | |
parent | fd4f1d280e8eb6a453868db01b8accc1e7b8d0b1 (diff) | |
download | vaadin-framework-2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d.tar.gz vaadin-framework-2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d.zip |
Added SharedUtil for helpers shared by client and server
Change-Id: Ie289e8eefd962631a43f35dbb47fa192fcf60abf
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/com/vaadin/shared/util/SharedUtil.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/util/SharedUtil.java b/shared/src/com/vaadin/shared/util/SharedUtil.java new file mode 100644 index 0000000000..2242fa4363 --- /dev/null +++ b/shared/src/com/vaadin/shared/util/SharedUtil.java @@ -0,0 +1,45 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * 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.vaadin.shared.util; + +/** + * Misc internal utility methods used by both the server and the client package. + * + * @author Vaadin Ltd + * @since 7.1 + * + */ +public class SharedUtil { + /** + * Checks if a and b are equals using {@link #equals(Object)}. Handles null + * values as well. Does not ensure that objects are of the same type. + * Assumes that the first object's equals method handle equals properly. + * + * @param o1 + * The first value to compare + * @param o2 + * The second value to compare + * @return true if the objects are equal, false otherwise + */ + public static boolean equals(Object o1, Object o2) { + if (o1 == null) { + return o2 == null; + } + + return o1.equals(o2); + } + +} |