cz.metacentrum.perun.core.api.Attribute.setType()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中cz.metacentrum.perun.core.api.Attribute.setType()方法的一些代码示例,展示了Attribute.setType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.setType()方法的具体详情如下:
包路径:cz.metacentrum.perun.core.api.Attribute
类名称:Attribute
方法名:setType

Attribute.setType介绍

暂无

代码示例

代码示例来源:origin: CESNET/perun

private static Attribute createAttribute(Map<String, String> beanAttr) throws InternalErrorException {
  if(beanAttr==null) return null;
  Attribute attribute = new Attribute();
  attribute.setId(Integer.valueOf(beanAttr.get("id")));
  attribute.setFriendlyName(BeansUtils.eraseEscaping(beanAttr.get("friendlyName")));
  attribute.setNamespace(BeansUtils.eraseEscaping(beanAttr.get("namespace")));
  attribute.setType(BeansUtils.eraseEscaping(beanAttr.get("type")));
  attribute.setValue(BeansUtils.stringToAttributeValue(BeansUtils.eraseEscaping(beanAttr.get("value")), attribute.getType()));
  attribute.setUnique(Boolean.valueOf(beanAttr.get("unique")));
  return attribute;
}

代码示例来源:origin: CESNET/perun

/**
 * Converts attribute value to string (serialize object to string).
 * This is a wrapper for passing value and type only for specific use.
 * @see #attributeValueToString(Attribute)
 *
 * @param attributeValue value of the attribute
 * @param type type of resulting attribute
 * @return string representation of the value
 *
 * @throws InternalErrorException
 */
@SuppressWarnings("unchecked")
public static String attributeValueToString(Object attributeValue, String type) throws InternalErrorException {
  Attribute a = new Attribute();
  a.setType(type);
  a.setValue(attributeValue);
  return attributeValueToString(a);
}

相关文章