diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-03-10 22:40:51 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-03-14 07:59:12 +0200 |
commit | a6653d3fe49e6a97468ac09f7f2f4d621bea1078 (patch) | |
tree | 96c82e20ca6551ee4c14c8877f0258b25c63cddf /server/src/com/vaadin/data/util/LegacyPropertyHelper.java | |
parent | f7e57d77ce621ee39167369c31d989edc5633266 (diff) | |
download | vaadin-framework-a6653d3fe49e6a97468ac09f7f2f4d621bea1078.tar.gz vaadin-framework-a6653d3fe49e6a97468ac09f7f2f4d621bea1078.zip |
Migrate vaadin-server build to maven
Change-Id: I5c740f4e9cb28103bab199f9a552153d82277e7e
Diffstat (limited to 'server/src/com/vaadin/data/util/LegacyPropertyHelper.java')
-rw-r--r-- | server/src/com/vaadin/data/util/LegacyPropertyHelper.java | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/server/src/com/vaadin/data/util/LegacyPropertyHelper.java b/server/src/com/vaadin/data/util/LegacyPropertyHelper.java deleted file mode 100644 index 7432d036fb..0000000000 --- a/server/src/com/vaadin/data/util/LegacyPropertyHelper.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2000-2014 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.data.util; - -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.vaadin.data.Property; -import com.vaadin.server.Constants; -import com.vaadin.server.DeploymentConfiguration.LegacyProperyToStringMode; -import com.vaadin.server.VaadinService; - -/** - * Helper class which provides methods for handling Property.toString in a - * Vaadin 6 compatible way - * - * @author Vaadin Ltd - * @since 7.1 - * @deprecated This is only used internally for backwards compatibility - */ -@Deprecated -public class LegacyPropertyHelper implements Serializable { - - /** - * Returns the property value converted to a String. - * - * @param p - * The property - * @return A string representation of the property value, compatible with - * how Property implementations in Vaadin 6 do it - */ - public static String legacyPropertyToString(Property p) { - maybeLogLegacyPropertyToStringWarning(p); - Object value = p.getValue(); - if (value == null) { - return null; - } - return value.toString(); - } - - public static void maybeLogLegacyPropertyToStringWarning(Property p) { - if (!logLegacyToStringWarning()) { - return; - } - - getLogger().log(Level.WARNING, - Constants.WARNING_LEGACY_PROPERTY_TOSTRING, - p.getClass().getName()); - if (getLogger().isLoggable(Level.FINE)) { - getLogger().log(Level.FINE, - "Strack trace for legacy toString to ease debugging", - new Throwable()); - } - } - - /** - * Checks if legacy Property.toString() implementation is enabled. The - * legacy Property.toString() will return the value of the property somehow - * converted to a String. If the legacy mode is disabled, toString() will - * return super.toString(). - * <p> - * The legacy toString mode can be toggled using the - * "legacyPropertyToString" init parameter - * </p> - * - * @return true if legacy Property.toString() mode is enabled, false - * otherwise - */ - public static boolean isLegacyToStringEnabled() { - if (VaadinService.getCurrent() == null) { - // This will happen at least in JUnit tests. We do not what the real - // value should be but it seems more safe to use the legacy mode. - return true; - } - return VaadinService.getCurrent().getDeploymentConfiguration() - .getLegacyPropertyToStringMode().useLegacyMode(); - } - - private static boolean logLegacyToStringWarning() { - if (VaadinService.getCurrent() == null) { - // This will happen at least in JUnit tests. We do not want to spam - // the log with these messages in this case. - return false; - } - return VaadinService.getCurrent().getDeploymentConfiguration() - .getLegacyPropertyToStringMode() == LegacyProperyToStringMode.WARNING; - - } - - private static Logger getLogger() { - return Logger.getLogger(LegacyPropertyHelper.class.getName()); - } - -} |