本文整理汇总了Java中org.eclipse.leshan.core.model.ResourceModel.Type.FLOAT属性的典型用法代码示例。如果您正苦于以下问题:Java Type.FLOAT属性的具体用法?Java Type.FLOAT怎么用?Java Type.FLOAT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.leshan.core.model.ResourceModel.Type
的用法示例。
在下文中一共展示了Type.FLOAT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
public ResourceModel.Type getType() {
if (booleanValue != null) {
return Type.BOOLEAN;
}
if (floatValue != null) {
return Type.FLOAT;
}
if (objectLinkValue != null) {
// TODO handle object link or not ..
return null;
}
if (stringValue != null) {
return Type.STRING;
}
return null;
}
示例2: createObjectModels
protected List<ObjectModel> createObjectModels() {
// load default object from the spec
List<ObjectModel> objectModels = ObjectLoader.loadDefault();
// define custom model for testing purpose
ResourceModel stringfield = new ResourceModel(STRING_RESOURCE_ID, "stringres", Operations.RW, false, false,
Type.STRING, null, null, null);
ResourceModel booleanfield = new ResourceModel(BOOLEAN_RESOURCE_ID, "booleanres", Operations.RW, false, false,
Type.BOOLEAN, null, null, null);
ResourceModel integerfield = new ResourceModel(INTEGER_RESOURCE_ID, "integerres", Operations.RW, false, false,
Type.INTEGER, null, null, null);
ResourceModel floatfield = new ResourceModel(FLOAT_RESOURCE_ID, "floatres", Operations.RW, false, false,
Type.FLOAT, null, null, null);
ResourceModel timefield = new ResourceModel(TIME_RESOURCE_ID, "timeres", Operations.RW, false, false, Type.TIME,
null, null, null);
ResourceModel opaquefield = new ResourceModel(OPAQUE_RESOURCE_ID, "opaque", Operations.RW, false, false,
Type.OPAQUE, null, null, null);
ResourceModel objlnkfield = new ResourceModel(OBJLNK_MULTI_INSTANCE_RESOURCE_ID, "objlnk", Operations.RW, true,
false, Type.OBJLNK, null, null, null);
ResourceModel objlnkSinglefield = new ResourceModel(OBJLNK_SINGLE_INSTANCE_RESOURCE_ID, "objlnk", Operations.RW,
false, false, Type.OBJLNK, null, null, null);
objectModels.add(new ObjectModel(TEST_OBJECT_ID, "testobject", null, ObjectModel.DEFAULT_VERSION, false, false,
stringfield, booleanfield, integerfield, floatfield, timefield, opaquefield, objlnkfield,
objlnkSinglefield));
return objectModels;
}
示例3: getType
public ResourceModel.Type getType() {
if (booleanValue != null) {
return Type.BOOLEAN;
}
if (floatValue != null) {
return Type.FLOAT;
}
if (objectLinkValue != null) {
return Type.OBJLNK;
}
if (stringValue != null) {
return Type.STRING;
}
return null;
}
示例4: parseResource
private ResourceModel parseResource(Node item) {
Integer id = Integer.valueOf(item.getAttributes().getNamedItem("ID").getTextContent());
String name = null;
Operations operations = Operations.NONE;
boolean multiple = false;
boolean mandatory = false;
Type type = Type.STRING;
String rangeEnumeration = null;
String units = null;
String description = null;
for (int i = 0; i < item.getChildNodes().getLength(); i++) {
Node field = item.getChildNodes().item(i);
switch (field.getNodeName()) {
case "Name":
name = field.getTextContent();
break;
case "Operations":
String strOp = field.getTextContent();
if (strOp != null && !strOp.isEmpty()) {
operations = Operations.valueOf(strOp);
}
break;
case "MultipleInstances":
multiple = "Multiple".equals(field.getTextContent());
break;
case "Mandatory":
mandatory = "Mandatory".equals(field.getTextContent());
break;
case "Type":
switch (field.getTextContent()) {
case "String":
type = Type.STRING;
break;
case "Integer":
type = Type.INTEGER;
break;
case "Float":
type = Type.FLOAT;
break;
case "Boolean":
type = Type.BOOLEAN;
break;
case "Opaque":
type = Type.OPAQUE;
break;
case "Time":
type = Type.TIME;
break;
}
break;
case "RangeEnumeration":
rangeEnumeration = field.getTextContent();
break;
case "Units":
units = field.getTextContent();
break;
case "Description":
description = field.getTextContent();
break;
}
}
return new ResourceModel(id, name, operations, multiple, mandatory, type, rangeEnumeration, units, description);
}
示例5: newFloatResource
public static LwM2mMultipleResource newFloatResource(int id, Map<Integer, Double> values) {
Validate.noNullElements(values.values());
return new LwM2mMultipleResource(id, values, Type.FLOAT);
}
示例6: newFloatResource
public static LwM2mSingleResource newFloatResource(int id, double value) {
return new LwM2mSingleResource(id, value, Type.FLOAT);
}
示例7: parseResource
private ResourceModel parseResource(Node item) {
Integer id = Integer.valueOf(item.getAttributes().getNamedItem("ID").getTextContent());
String name = null;
Operations operations = Operations.NONE;
boolean multiple = false;
boolean mandatory = false;
Type type = Type.STRING;
String rangeEnumeration = null;
String units = null;
String description = null;
for (int i = 0; i < item.getChildNodes().getLength(); i++) {
Node field = item.getChildNodes().item(i);
switch (field.getNodeName()) {
case "Name":
name = field.getTextContent();
break;
case "Operations":
String strOp = field.getTextContent();
if (strOp != null && !strOp.isEmpty()) {
operations = Operations.valueOf(strOp);
}
break;
case "MultipleInstances":
multiple = "Multiple".equals(field.getTextContent());
break;
case "Mandatory":
mandatory = "Mandatory".equals(field.getTextContent());
break;
case "Type":
switch (field.getTextContent()) {
case "String":
type = Type.STRING;
break;
case "Integer":
type = Type.INTEGER;
break;
case "Float":
type = Type.FLOAT;
break;
case "Boolean":
type = Type.BOOLEAN;
break;
case "Opaque":
type = Type.OPAQUE;
break;
case "Time":
type = Type.TIME;
break;
case "Objlnk":
type = Type.OBJLNK;
break;
}
break;
case "RangeEnumeration":
rangeEnumeration = field.getTextContent();
break;
case "Units":
units = field.getTextContent();
break;
case "Description":
description = field.getTextContent();
break;
}
}
return new ResourceModel(id, name, operations, multiple, mandatory, type, rangeEnumeration, units, description);
}