fn convert_type(&self, pos: &m::Pos, package: &m::Package, ty: &m::Type) -> Result<Type> {
        let ty = match *ty {
            m::Type::String => self.string.clone().into(),
            m::Type::Signed(ref size) |
            m::Type::Unsigned(ref size) => {
                // default to integer if unspecified.
                // TODO: should we care about signedness?
                // TODO: > 64 bits, use BitInteger?
                if size.map(|s| s <= 32usize).unwrap_or(true) {
                    INTEGER.into()
                } else {
                    LONG.into()
                }
            }
            m::Type::Float => FLOAT.into(),
            m::Type::Double => DOUBLE.into(),
            m::Type::Boolean => BOOLEAN.into(),
            m::Type::Array(ref ty) => {
                let argument = self.convert_type(pos, package, ty)?;
                self.list.with_arguments(vec![argument]).into()
            }
            m::Type::Custom(ref custom) => {
                return self.convert_custom(pos, package, custom);
            }
            m::Type::Map(ref key, ref value) => {
                let key = self.convert_type(pos, package, key)?;
                let value = self.convert_type(pos, package, value)?;
                self.map.with_arguments(vec![key, value]).into()
            }
            m::Type::Any => self.object.clone().into(),
            ref t => {
                return Err(Error::pos(format!("unsupported type: {:?}", t), pos.clone()));
            }
        };

        Ok(ty)
    }
/// Convert the given type to a java type.
Convert the given type to a java type.
Convert the given type to a java type .
fn convert_type(&self, pos: &m::Pos, package: &m::Package, ty: &m::Type) -> Result<Type> {
        let ty = match *ty {
            m::Type::String => self.string.clone().into(),
            m::Type::Signed(ref size) |
            m::Type::Unsigned(ref size) => {
                // default to integer if unspecified.
                // TODO: should we care about signedness?
                // TODO: > 64 bits, use BitInteger?
                if size.map(|s| s <= 32usize).unwrap_or(true) {
                    INTEGER.into()
                } else {
                    LONG.into()
                }
            }
            m::Type::Float => FLOAT.into(),
            m::Type::Double => DOUBLE.into(),
            m::Type::Boolean => BOOLEAN.into(),
            m::Type::Array(ref ty) => {
                let argument = self.convert_type(pos, package, ty)?;
                self.list.with_arguments(vec![argument]).into()
            }
            m::Type::Custom(ref custom) => {
                return self.convert_custom(pos, package, custom);
            }
            m::Type::Map(ref key, ref value) => {
                let key = self.convert_type(pos, package, key)?;
                let value = self.convert_type(pos, package, value)?;
                self.map.with_arguments(vec![key, value]).into()
            }
            m::Type::Any => self.object.clone().into(),
            ref t => {
                return Err(Error::pos(format!("unsupported type: {:?}", t), pos.clone()));
            }
        };
        Ok(ty)
    }
fn convert_type ( & self , pos : & m :: Pos , package : & m :: Package , ty : & m :: Type ) -> Result < Type > { let ty = match * ty { m :: Type :: String => self . string . clone ( ) . into ( ) , m :: Type :: Signed ( ref size ) | m :: Type :: Unsigned ( ref size ) => { // default to integer if unspecified. // TODO: should we care about signedness? // TODO: > 64 bits, use BitInteger? if size . map ( | s | s <= 32usize ) . unwrap_or ( true ) { INTEGER . into ( ) } else { LONG . into ( ) } } m :: Type :: Float => FLOAT . into ( ) , m :: Type :: Double => DOUBLE . into ( ) , m :: Type :: Boolean => BOOLEAN . into ( ) , m :: Type :: Array ( ref ty ) => { let argument = self . convert_type ( pos , package , ty ) ? ; self . list . with_arguments ( vec ! [ argument ] ) . into ( ) } m :: Type :: Custom ( ref custom ) => { return self . convert_custom ( pos , package , custom ) ; } m :: Type :: Map ( ref key , ref value ) => { let key = self . convert_type ( pos , package , key ) ? ; let value = self . convert_type ( pos , package , value ) ? ; self . map . with_arguments ( vec ! [ key value ] ) . into ( ) } m :: Type :: Any => self . object . clone ( ) . into ( ) , ref t => { return Err ( Error :: pos ( format ! ( " " t ) , pos . clone ( ) ) ) ; } } ; Ok ( ty ) }
Convert the given type to a java type.
Convert the given type to a java type .
&self
pos
&m::Pos
package
&m::Package
ty
&m::Type
&self
pos
&m::Pos
package
&m::Package
ty
&m::Type