You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by si...@apache.org on 2013/02/09 13:44:41 UTC
svn commit: r1444354 - in /incubator/onami/sandbox/converters: ./ all/
format/ format/src/ format/src/main/ format/src/main/java/
format/src/main/java/org/ format/src/main/java/org/apache/
format/src/main/java/org/apache/onami/ format/src/main/java/org...
Author: simonetripodi
Date: Sat Feb 9 12:44:40 2013
New Revision: 1444354
URL: http://svn.apache.org/r1444354
Log:
[ONAMI-76] #comment Migrated converters from org.apache.onami.configuration.converters to org.apache.onami.converters.* in the configuration module #resolve
Added:
incubator/onami/sandbox/converters/format/ (with props)
incubator/onami/sandbox/converters/format/pom.xml (with props)
incubator/onami/sandbox/converters/format/src/
incubator/onami/sandbox/converters/format/src/main/
incubator/onami/sandbox/converters/format/src/main/java/
incubator/onami/sandbox/converters/format/src/main/java/org/
incubator/onami/sandbox/converters/format/src/main/java/org/apache/
incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/
incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/
incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/
incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java (with props)
incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java (with props)
incubator/onami/sandbox/converters/i18n/ (with props)
incubator/onami/sandbox/converters/i18n/pom.xml (with props)
incubator/onami/sandbox/converters/i18n/src/
incubator/onami/sandbox/converters/i18n/src/main/
incubator/onami/sandbox/converters/i18n/src/main/java/
incubator/onami/sandbox/converters/i18n/src/main/java/org/
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/CurrencyConverter.java
- copied, changed from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/CurrencyConverter.java
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/DateConverter.java
- copied, changed from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/DateConverter.java
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/LocaleConverter.java
- copied, changed from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/LocaleConverter.java
incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/TimeZoneConverter.java
- copied, changed from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/TimeZoneConverter.java
incubator/onami/sandbox/converters/system/ (with props)
incubator/onami/sandbox/converters/system/pom.xml (with props)
incubator/onami/sandbox/converters/system/src/
incubator/onami/sandbox/converters/system/src/main/
incubator/onami/sandbox/converters/system/src/main/java/
incubator/onami/sandbox/converters/system/src/main/java/org/
incubator/onami/sandbox/converters/system/src/main/java/org/apache/
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java (with props)
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java (with props)
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java (with props)
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java (with props)
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java (with props)
incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java (with props)
Modified:
incubator/onami/sandbox/converters/all/pom.xml
incubator/onami/sandbox/converters/pom.xml
Modified: incubator/onami/sandbox/converters/all/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/all/pom.xml?rev=1444354&r1=1444353&r2=1444354&view=diff
==============================================================================
--- incubator/onami/sandbox/converters/all/pom.xml (original)
+++ incubator/onami/sandbox/converters/all/pom.xml Sat Feb 9 12:44:40 2013
@@ -39,6 +39,20 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.format</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.i18n</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>org.apache.onami.converters.net</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -57,6 +71,13 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.system</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
Propchange: incubator/onami/sandbox/converters/format/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 9 12:44:40 2013
@@ -0,0 +1,2 @@
+target
+.settings
Added: incubator/onami/sandbox/converters/format/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/format/pom.xml?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/format/pom.xml (added)
+++ incubator/onami/sandbox/converters/format/pom.xml Sat Feb 9 12:44:40 2013
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ | 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.onami.converters</groupId>
+ <artifactId>org.apache.onami.converters.parent</artifactId>
+ <version>1.0.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.onami.converters.format</artifactId>
+
+ <name>Apache Onami-Converters - Format</name>
+ <description>Apache Onami-Converters Format module</description>
+
+ <properties>
+ <site.skip>true</site.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/../</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Propchange: incubator/onami/sandbox/converters/format/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/format/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/onami/sandbox/converters/format/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java (added)
+++ incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,46 @@
+package org.apache.onami.converters.format;
+
+/*
+ * 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.
+ */
+
+import java.text.DecimalFormat;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.text.DecimalFormat}.
+ */
+@MetaInfServices( Module.class )
+public final class DecimalFormatConverter
+ extends AbstractConverter<DecimalFormat>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ return new DecimalFormat( value );
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/DecimalFormatConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java (added)
+++ incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,46 @@
+package org.apache.onami.converters.format;
+
+/*
+ * 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.
+ */
+
+import java.text.SimpleDateFormat;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.text.SimpleDateFormat}.
+ */
+@MetaInfServices( Module.class )
+public final class SimpleDateFormatConverter
+ extends AbstractConverter<SimpleDateFormat>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ return new SimpleDateFormat( value );
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/format/src/main/java/org/apache/onami/converters/format/SimpleDateFormatConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: incubator/onami/sandbox/converters/i18n/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 9 12:44:40 2013
@@ -0,0 +1,2 @@
+target
+.settings
Added: incubator/onami/sandbox/converters/i18n/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/i18n/pom.xml?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/i18n/pom.xml (added)
+++ incubator/onami/sandbox/converters/i18n/pom.xml Sat Feb 9 12:44:40 2013
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ | 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.onami.converters</groupId>
+ <artifactId>org.apache.onami.converters.parent</artifactId>
+ <version>1.0.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.onami.converters.i18n</artifactId>
+
+ <name>Apache Onami-Converters - i18n</name>
+ <description>Apache Onami-Converters i18n module</description>
+
+ <properties>
+ <site.skip>true</site.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/../</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Propchange: incubator/onami/sandbox/converters/i18n/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/i18n/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/onami/sandbox/converters/i18n/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/CurrencyConverter.java (from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/CurrencyConverter.java)
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/CurrencyConverter.java?p2=incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/CurrencyConverter.java&p1=incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/CurrencyConverter.java&r1=1439553&r2=1444354&rev=1444354&view=diff
==============================================================================
--- incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/CurrencyConverter.java (original)
+++ incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/CurrencyConverter.java Sat Feb 9 12:44:40 2013
@@ -1,4 +1,4 @@
-package org.apache.onami.configuration.converters;
+package org.apache.onami.converters.i18n;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,13 +19,20 @@ package org.apache.onami.configuration.c
* under the License.
*/
+import static java.util.Currency.getInstance;
+
import java.util.Currency;
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/**
* Converter implementation for {@code java.util.Currency}.
*/
+@MetaInfServices( Module.class )
public final class CurrencyConverter
extends AbstractConverter<Currency>
{
@@ -35,7 +42,7 @@ public final class CurrencyConverter
*/
public Object convert( String value, TypeLiteral<?> toType )
{
- return Currency.getInstance( value );
+ return getInstance( value );
}
}
Copied: incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/DateConverter.java (from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/DateConverter.java)
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/DateConverter.java?p2=incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/DateConverter.java&p1=incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/DateConverter.java&r1=1439553&r2=1444354&rev=1444354&view=diff
==============================================================================
--- incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/DateConverter.java (original)
+++ incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/DateConverter.java Sat Feb 9 12:44:40 2013
@@ -1,4 +1,4 @@
-package org.apache.onami.configuration.converters;
+package org.apache.onami.converters.i18n;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -29,12 +29,17 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
import com.google.inject.ProvisionException;
import com.google.inject.TypeLiteral;
/**
* Converter implementation for {@code java.util.Calendar} and {@code java.util.Date}.
*/
+@MetaInfServices( Module.class )
public final class DateConverter
extends AbstractConverter<Date>
{
@@ -48,12 +53,12 @@ public final class DateConverter
public DateConverter()
{
// ISO date formats
- this.addPattern( "yyyy" );
- this.addPattern( "yyyy-MM" );
- this.addPattern( "yyyy-MM-dd" );
- this.addPattern( "yyyy-MM-dd'T'hh:mmZ" );
- this.addPattern( "yyyy-MM-dd'T'hh:mm:ssZ" );
- this.addPattern( "yyyy-MM-dd'T'hh:mm:ss.sZ" );
+ addPattern( "yyyy" );
+ addPattern( "yyyy-MM" );
+ addPattern( "yyyy-MM-dd" );
+ addPattern( "yyyy-MM-dd'T'hh:mmZ" );
+ addPattern( "yyyy-MM-dd'T'hh:mm:ssZ" );
+ addPattern( "yyyy-MM-dd'T'hh:mm:ss.sZ" );
}
public void setLocale( Locale locale )
@@ -77,44 +82,44 @@ public final class DateConverter
public Object convert( String value, TypeLiteral<?> toType )
{
Exception firstEx = null;
- for ( String pattern : this.patterns )
+ for ( String pattern : patterns )
{
try
{
DateFormat format;
- if ( this.locale != null )
+ if ( locale != null )
{
- format = new SimpleDateFormat( pattern, this.locale );
+ format = new SimpleDateFormat( pattern, locale );
}
else
{
format = new SimpleDateFormat( pattern );
}
- if ( this.timeZone != null )
+ if ( timeZone != null )
{
- format.setTimeZone( this.timeZone );
+ format.setTimeZone( timeZone );
}
format.setLenient( false );
- Date date = this.parse( value, format );
+ Date date = parse( value, format );
if ( Calendar.class == toType.getType() )
{
Calendar calendar = null;
- if ( this.locale == null && this.timeZone == null )
+ if ( locale == null && timeZone == null )
{
calendar = Calendar.getInstance();
}
- else if ( this.locale == null )
+ else if ( locale == null )
{
- calendar = Calendar.getInstance( this.timeZone );
+ calendar = Calendar.getInstance( timeZone );
}
- else if ( this.timeZone == null )
+ else if ( timeZone == null )
{
- calendar = Calendar.getInstance( this.locale );
+ calendar = Calendar.getInstance( locale );
}
else
{
- calendar = Calendar.getInstance( this.timeZone, this.locale );
+ calendar = Calendar.getInstance( timeZone, locale );
}
calendar.setTime( date );
calendar.setLenient( false );
@@ -132,7 +137,10 @@ public final class DateConverter
}
}
- throw new IllegalArgumentException( "Error converting '" + value + "' using patterns " + this.patterns,
+ throw new IllegalArgumentException( "Error converting '"
+ + value
+ + "' using patterns "
+ + patterns,
firstEx );
}
Copied: incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/LocaleConverter.java (from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/LocaleConverter.java)
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/LocaleConverter.java?p2=incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/LocaleConverter.java&p1=incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/LocaleConverter.java&r1=1439553&r2=1444354&rev=1444354&view=diff
==============================================================================
--- incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/LocaleConverter.java (original)
+++ incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/LocaleConverter.java Sat Feb 9 12:44:40 2013
@@ -1,4 +1,4 @@
-package org.apache.onami.configuration.converters;
+package org.apache.onami.converters.i18n;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -21,11 +21,16 @@ package org.apache.onami.configuration.c
import java.util.Locale;
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/**
* Converter implementation for {@code java.util.Locale}.
*/
+@MetaInfServices( Module.class )
public final class LocaleConverter
extends AbstractConverter<Locale>
{
Copied: incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/TimeZoneConverter.java (from r1439553, incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/TimeZoneConverter.java)
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/TimeZoneConverter.java?p2=incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/TimeZoneConverter.java&p1=incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/TimeZoneConverter.java&r1=1439553&r2=1444354&rev=1444354&view=diff
==============================================================================
--- incubator/onami/trunk/configuration/src/main/java/org/apache/onami/configuration/converters/TimeZoneConverter.java (original)
+++ incubator/onami/sandbox/converters/i18n/src/main/java/org/apache/onami/converters/i18n/TimeZoneConverter.java Sat Feb 9 12:44:40 2013
@@ -1,4 +1,4 @@
-package org.apache.onami.configuration.converters;
+package org.apache.onami.converters.i18n;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,13 +19,20 @@ package org.apache.onami.configuration.c
* under the License.
*/
+import static java.util.TimeZone.getTimeZone;
+
import java.util.TimeZone;
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/**
* Converter implementation for {@code java.util.TimeZone}.
*/
+@MetaInfServices( Module.class )
public final class TimeZoneConverter
extends AbstractConverter<TimeZone>
{
@@ -35,7 +42,7 @@ public final class TimeZoneConverter
*/
public Object convert( String value, TypeLiteral<?> toType )
{
- return TimeZone.getTimeZone( value );
+ return getTimeZone( value );
}
}
Modified: incubator/onami/sandbox/converters/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/pom.xml?rev=1444354&r1=1444353&r2=1444354&view=diff
==============================================================================
--- incubator/onami/sandbox/converters/pom.xml (original)
+++ incubator/onami/sandbox/converters/pom.xml Sat Feb 9 12:44:40 2013
@@ -37,9 +37,12 @@
<modules>
<module>core</module>
+ <module>format</module>
+ <module>i18n</module>
<module>net</module>
<module>numbers</module>
<module>sql</module>
+ <module>system</module>
<module>all</module>
</modules>
Propchange: incubator/onami/sandbox/converters/system/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Feb 9 12:44:40 2013
@@ -0,0 +1,2 @@
+target
+.settings
Added: incubator/onami/sandbox/converters/system/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/pom.xml?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/pom.xml (added)
+++ incubator/onami/sandbox/converters/system/pom.xml Sat Feb 9 12:44:40 2013
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ | 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.onami.converters</groupId>
+ <artifactId>org.apache.onami.converters.parent</artifactId>
+ <version>1.0.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.onami.converters.system</artifactId>
+
+ <name>Apache Onami-Converters - System</name>
+ <description>Apache Onami-Converters System module</description>
+
+ <properties>
+ <site.skip>true</site.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.onami.converters.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/../</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Propchange: incubator/onami/sandbox/converters/system/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/onami/sandbox/converters/system/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,91 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import java.util.BitSet;
+import java.util.StringTokenizer;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.ProvisionException;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.util.UUID}.
+ */
+@MetaInfServices( Module.class )
+public final class BitSetConverter
+ extends AbstractConverter<BitSet>
+{
+
+ private static final String DEFAULT_SEPARATOR = ",";
+
+ private static final int CHAR_LENGTH = 1;
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ BitSet bitSet = new BitSet();
+
+ int currentIndex = 0;
+ StringTokenizer tokenizer = new StringTokenizer( value, DEFAULT_SEPARATOR );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String current = tokenizer.nextToken().trim();
+
+ if ( current.length() == 0 )
+ {
+ throw new ProvisionException( "Input '" + value
+ + "' is not a valid java.util.BitSet, fragment at position " + currentIndex + " is empty" );
+ }
+
+ if ( CHAR_LENGTH == current.length() && !Character.isDigit( current.charAt( 0 ) ) )
+ {
+ bitSet.set( current.charAt( 0 ) );
+ }
+ else
+ {
+ for ( int i = 0; i < current.length(); i++ )
+ {
+ if ( !Character.isDigit( current.charAt( i ) ) )
+ {
+ throw new ProvisionException( "Input '"
+ + value
+ + "' is not a valid java.util.BitSet, fragment '"
+ + current
+ + "' at position "
+ + currentIndex
+ + " is not a valid integer" );
+ }
+ }
+ bitSet.set( Integer.parseInt( current ) );
+ }
+
+ currentIndex++;
+ }
+
+ return bitSet;
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/BitSetConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,51 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import java.nio.charset.Charset;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.ProvisionException;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.nio.charset.Charset}.
+ */
+@MetaInfServices( Module.class )
+public final class CharsetConverter
+ extends AbstractConverter<Charset>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ if ( value.length() == 0 )
+ {
+ throw new ProvisionException( "Impossible to convert an empty value to a Charset" );
+ }
+ return Charset.forName( value );
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/CharsetConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,46 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.io.File}.
+ */
+@MetaInfServices( Module.class )
+public final class FileConverter
+ extends AbstractConverter<File>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ return new File( value );
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/FileConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,48 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import static java.util.regex.Pattern.compile;
+
+import java.util.regex.Pattern;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.util.regex.Pattern}.
+ */
+@MetaInfServices( Module.class )
+public final class PatternConverter
+ extends AbstractConverter<Pattern>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ return compile( value );
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PatternConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,84 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.ProvisionException;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.util.Properties}.
+ */
+@MetaInfServices( Module.class )
+public final class PropertiesConverter
+ extends AbstractConverter<Properties>
+{
+
+ /**
+ * Default properties encoding {@code ISO-8859-1}.
+ *
+ * Properties.load(stream) expects it.
+ */
+ private static final String PROPERTIES_ENCODING = "ISO-8859-1";
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ Properties properties = new Properties();
+ ByteArrayInputStream bais = null;
+
+ try
+ {
+ bais = new ByteArrayInputStream( value.getBytes( PROPERTIES_ENCODING ) );
+ properties.load( bais );
+ }
+ catch ( IOException e )
+ {
+ // Should never happen.
+ throw new ProvisionException( "Failed to parse " + value + "' into Properties", e );
+ }
+ finally
+ {
+ if ( bais != null )
+ {
+ try
+ {
+ bais.close();
+ }
+ catch ( IOException e )
+ {
+ // close quietly
+ }
+ }
+ }
+
+ return properties;
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/PropertiesConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java
URL: http://svn.apache.org/viewvc/incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java?rev=1444354&view=auto
==============================================================================
--- incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java (added)
+++ incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java Sat Feb 9 12:44:40 2013
@@ -0,0 +1,56 @@
+package org.apache.onami.converters.system;
+
+/*
+ * 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.
+ */
+
+import static java.util.UUID.fromString;
+
+import java.util.UUID;
+
+import org.apache.onami.converters.core.AbstractConverter;
+import org.kohsuke.MetaInfServices;
+
+import com.google.inject.Module;
+import com.google.inject.ProvisionException;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Converter implementation for {@code java.util.UUID}.
+ */
+@MetaInfServices( Module.class )
+public final class UUIDConverter
+ extends AbstractConverter<UUID>
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object convert( String value, TypeLiteral<?> toType )
+ {
+ try
+ {
+ return fromString( value );
+ }
+ catch ( Throwable t )
+ {
+ throw new ProvisionException( "String value '" + value + "' is not a valid UUID", t );
+ }
+ }
+
+}
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/onami/sandbox/converters/system/src/main/java/org/apache/onami/converters/system/UUIDConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain