org.apache.felix.gogo.shell
Class Converters

java.lang.Object
  extended by org.apache.felix.gogo.shell.Converters
All Implemented Interfaces:
Converter

public class Converters
extends Object
implements Converter


Field Summary
 
Fields inherited from interface org.apache.felix.service.command.Converter
CONVERTER_CLASSES, INSPECT, LINE, PART
 
Constructor Summary
Converters(BundleContext context)
           
 
Method Summary
 Bundle bundle(Bundle i)
           
 Object convert( desiredType, Object in)
          Convert an object to the desired type.
 CharSequence format(Object target, int level, Converter converter)
          Convert an objet to a CharSequence object in the requested format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converters

public Converters(BundleContext context)
Method Detail

bundle

public Bundle bundle(Bundle i)

convert

public Object convert( desiredType,
                      Object in)
               throws Exception
Description copied from interface: Converter
Convert an object to the desired type.

Return null if the conversion can not be done. Otherwise return and object that extends the desired type or implements it.

Specified by:
convert in interface Converter
Parameters:
desiredType - The type that the returned object can be assigned to
in - The object that must be converted
Returns:
An object that can be assigned to the desired type or null.
Throws:
Exception

format

public CharSequence format(Object target,
                           int level,
                           Converter converter)
                    throws IOException
Description copied from interface: Converter
Convert an objet to a CharSequence object in the requested format. The format can be INSPECT, LINE, or PART. Other values must throw IllegalArgumentException.

Specified by:
format in interface Converter
Parameters:
target - The object to be converted to a String
level - One of INSPECT, LINE, or PART.
converter - Use this object to format sub ordinate objects.
Returns:
A printed object of potentially multiple lines
Throws:
IOException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.