[jboss-cvs] JBossAS SVN: r95326 - projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 21 14:07:22 EDT 2009
Author: emuckenhuber
Date: 2009-10-21 14:07:21 -0400 (Wed, 21 Oct 2009)
New Revision: 95326
Added:
projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers/FileMetaMapper.java
Log:
[JBMAN-49]
Copied: projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers/FileMetaMapper.java (from rev 95319, projects/jboss-man/trunk/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers/FileMetaMapper.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers/FileMetaMapper.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/plugins/values/mappers/FileMetaMapper.java 2009-10-21 18:07:21 UTC (rev 95326)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metatype.plugins.values.mappers;
+
+import java.io.File;
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class FileMetaMapper extends MetaMapper<File>
+{
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, File object)
+ {
+ return SimpleValueSupport.wrap(object.getAbsolutePath());
+ }
+
+ @Override
+ public MetaType getMetaType()
+ {
+ return SimpleMetaType.STRING;
+ }
+
+ @Override
+ public Type mapToType()
+ {
+ return File.class;
+ }
+
+ @Override
+ public File unwrapMetaValue(MetaValue metaValue)
+ {
+ SimpleValue svalue = (SimpleValue) metaValue;
+ File f = null;
+ if (svalue != null)
+ {
+ f = new File(svalue.getValue().toString());
+ }
+ return f;
+ }
+}
+
+
More information about the jboss-cvs-commits
mailing list