Unmarshals the given map source into a bean.
@param source the source
@return the role
778554
public static RoleBean unmarshallRole(Map<String, Object> source) {
        if (source == null) {
            return null;
        }
        RoleBean bean = new RoleBean();
        bean.setId(asString(source.get("id")));
        bean.setName(asString(source.get("name")));
        bean.setDescription(asString(source.get("description")));
        bean.setCreatedBy(asString(source.get("createdBy")));
        bean.setCreatedOn(asDate(source.get("createdOn")));
        bean.setAutoGrant(asBoolean(source.get("autoGrant")));
        @SuppressWarnings("unchecked")
        List<Object> permissions = (List<Object>) source.get("permissions");
        if (permissions != null && !permissions.isEmpty()) {
            bean.setPermissions(new HashSet<>());
            for (Object permission : permissions) {
                bean.getPermissions().add(asEnum(permission, PermissionType.class));
            }
        }
        postMarshall(bean);
        return bean;
    }
855627
public <S, T> FromUnmarshaller<S, T> findUnmarshaller(Class<S> source, Class<T> target) {
		return findUnmarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class));
	}
825726
static Map<String, ?> buildSourceByJsonMapper(Object sourceObject) {
        try {
            return JsonMapper.convertValue(sourceObject, MAP_TYPE_REFERENCE);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndThrowRuntimeEx(log, e,
                    "buildSourceByJsonMapper", sourceObject);
        }
    }
424767
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target) {
		return findMarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class));
	}
716154
public static ClientVersionBean unmarshallClientVersion(Map<String, Object> source) {
        if (source == null) {
            return null;
        }
        ClientVersionBean bean = new ClientVersionBean();
        bean.setVersion(asString(source.get("version")));
        bean.setApikey(asString(source.get("apikey")));
        bean.setStatus(asEnum(source.get("status"), ClientStatus.class));
        bean.setCreatedBy(asString(source.get("createdBy")));
        bean.setCreatedOn(asDate(source.get("createdOn")));
        bean.setModifiedBy(asString(source.get("modifiedBy")));
        bean.setModifiedOn(asDate(source.get("modifiedOn")));
        bean.setPublishedOn(asDate(source.get("publishedOn")));
        bean.setRetiredOn(asDate(source.get("retiredOn")));
        postMarshall(bean);
        return bean;
    }
20703
public <T> T convert(Object source, Class<T> clazz)
			throws ConverterException {
		return (T) convert(new ConversionContext(), source, clazz);
	}
498445
public final Source source(final Source source) {
    return new Source() {
      @Override public long read(Buffer sink, long byteCount) throws IOException {
        boolean throwOnTimeout = false;
        enter();
        try {
          long result = source.read(sink, byteCount);
          throwOnTimeout = true;
          return result;
        } catch (IOException e) {
          throw exit(e);
        } finally {
          exit(throwOnTimeout);
        }
      }

      @Override public void close() throws IOException {
        boolean throwOnTimeout = false;
        try {
          source.close();
          throwOnTimeout = true;
        } catch (IOException e) {
          throw exit(e);
        } finally {
          exit(throwOnTimeout);
        }
      }

      @Override public Timeout timeout() {
        return AsyncTimeout.this;
      }

      @Override public String toString() {
        return "AsyncTimeout.source(" + source + ")";
      }
    };
  }
1062449
@Override
    public DataByteInput<T> source(final T source) {
        return (DataByteInput<T>) super.source(source);
    }
689775
public static XslTransformer getTransformer(Source source) throws TransformerConfigurationException {
    	if (source == null) {
    		throw new IllegalArgumentException("source is null");
    	}
        XslTransformer transformer = new XslTransformer();
        transformer.transformerImpl = transformerFactory.newTransformer(source);
        return transformer;
    }
475297
public static <T, U> U convert(T source, Class<U> targetClass) {
        return BeanConvertStrategy.convertBean(source, targetClass);
    }
1113702
public <T> T convert(Object source, Class<T> toClass) {
        return toClass.cast(source.toString());
    }
911567
public Object javaToSql(Object source)
    {
        if (source instanceof Boolean)
        {
            if (source.equals(Boolean.TRUE))
            {
                return I_TRUE;
            }
            else
            {
                return I_FALSE;
            }
        }
        else
        {
            return source;
        }
    }
1010025
public static <T> T convert(Object source, Class<T> destType) {
        return JSON.convertValue(source, destType);
    }
135023
public Object javaToSql(Object source) throws ConversionException
    {

        if (source == null)
        {
            return NULLVALUE;
        }

        try
        {
            List stringList = (List) source;
            if (stringList.isEmpty())
            {
                return NULLVALUE;
            }

            StringBuffer result = new StringBuffer();
            for (int i = 0; i < stringList.size(); i++)
            {
                String newSt = (String) stringList.get(i);
                // introduced in JDK 1.4, replace with commons-lang
                // newSt = newSt.replaceAll("#", "##");
                newSt = StringUtils.replace(newSt, "#", "##");
                if (i > 0)
                {
                    result.append("#");
                }
                result.append(newSt);
            }
            return result.toString();
        }
        catch (ClassCastException e)
        {
            throw new ConversionException("Object is not a List of String it is a"
                    + source.getClass().getName());
        }
    }
219302
public static <E, T> List<E> nonNullConvert(List<T> source, Class<E> targetClass) {
        return BeansConvertStrategy.convertBeans(source, targetClass, true);
    }
1214192
public static <K, V> Map<K, V> wrap(final Map<K, V> source) {
        if (source != null && !source.isEmpty()) {
            return new HashMap<>(source);
        }
        return new HashMap<>(0);
    }
528010
public static Object unmarshal (Class<?> type, String source)
        throws Exception
    {
        if (type.isEnum()) {
            // we need to use a dummy enum type here as there's no way to ask Enum.valueOf to
            // execute on an existentially typed enum; it all works out under the hood
            @SuppressWarnings("unchecked") Class<Dummy> etype = (Class<Dummy>)type;
            return Enum.valueOf(etype, source); // may throw an exception
        }
        // look up an argument parser for the field type
        Parser parser = _parsers.get(type);
        if (parser == null) {
            throw new Exception(
                "Don't know how to convert strings into values of type '" + type + "'.");
        }
        return parser.parse(source);
    }