本文整理汇总了Java中org.edgexfoundry.domain.common.ValueDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java ValueDescriptor类的具体用法?Java ValueDescriptor怎么用?Java ValueDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueDescriptor类属于org.edgexfoundry.domain.common包,在下文中一共展示了ValueDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isValidValueDescriptor
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* This task is expensive!!! It is a REST call into core data. Then it must
* do a lot of string parsing to insure data meets the required Value
* Descriptor parameters. Should only be turned on for dev and test.
*
* @param reading
* (from the Event being exported)
* @return boolean indicating whether data in the Reading is square with
* expected values per the ValueDescriptor
*/
private boolean isValidValueDescriptor(Reading reading) {
ValueDescriptor vd = vdClient.valueDescriptorByName(reading.getName());
if (vd == null) {
logger.error("Reading rejected - " + reading.getValue() + " no value descriptor found for the reading.");
return false;
}
IoTType type = vd.getType();
switch (type) {
case B: // boolean
return validBoolean(reading);
case F: // floating point
return validFloat(reading, vd);
case I: // integer
return validInteger(reading, vd);
case S: // string or character data
return validString(reading);
case J: // JSON data
return validJSON(reading);
}
// default case
logger.error("Reading rejected - " + reading.getValue() + " unknown value descriptor type.");
return false;
}
开发者ID:edgexfoundry,项目名称:export-distro,代码行数:34,代码来源:ValidEventFilter.java
示例2: validFloat
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private boolean validFloat(Reading reading, ValueDescriptor vd) {
try {
double val = Double.parseDouble(reading.getValue());
if (vd.getMax() != null && vd.getMin() != null) {
double max = Double.parseDouble(vd.getMax().toString());
double min = Double.parseDouble(vd.getMin().toString());
if ((val <= max) && (val >= min))
return true;
logger.error("Reading rejected - " + reading.getValue() + " not within min " + min + " and max " + max
+ " range as expected.");
return false;
}
return true;
} catch (Exception e) {
logger.error("Reading rejected - " + reading.getValue() + " not a floating point as expected.");
return false;
}
}
开发者ID:edgexfoundry,项目名称:export-distro,代码行数:19,代码来源:ValidEventFilter.java
示例3: validInteger
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private boolean validInteger(Reading reading, ValueDescriptor vd) {
try {
int val = Integer.parseInt(reading.getValue());
if (vd.getMax() != null && vd.getMin() != null) {
int max = Integer.parseInt(vd.getMax().toString());
int min = Integer.parseInt(vd.getMin().toString());
if ((val <= max) && (val >= min))
return true;
logger.error("Reading rejected - " + reading.getValue() + " not within min " + min + " and max " + max
+ " range as expected.");
return false;
}
return true;
} catch (Exception e) {
logger.error("Reading rejected - " + reading.getValue() + " not an integer as expected.");
return false;
}
}
开发者ID:edgexfoundry,项目名称:export-distro,代码行数:19,代码来源:ValidEventFilter.java
示例4: checkTestValueDescriptorData
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private void checkTestValueDescriptorData(ValueDescriptor valueDescriptor) {
assertEquals("ValueDescriptor ID does not match saved id", testValDescId,
valueDescriptor.getId());
assertEquals("ValueDescriptor name does not match saved name", TEST_NAME,
valueDescriptor.getName());
assertEquals("ValueDescriptor min does not match saved min", TEST_MIN,
valueDescriptor.getMin());
assertEquals("ValueDescriptor max does not match saved max", TEST_MAX,
valueDescriptor.getMax());
assertEquals("ValueDescriptor type does not match saved type", TEST_TYPE,
valueDescriptor.getType());
assertEquals("ValueDescriptor label does not match saved label", TEST_UOMLABEL,
valueDescriptor.getUomLabel());
assertEquals("ValueDescriptor default value does not match saved default value", TEST_DEF_VALUE,
valueDescriptor.getDefaultValue());
assertEquals("ValueDescriptor formatting does not match saved formatting", TEST_FORMATTING,
valueDescriptor.getFormatting());
assertArrayEquals("ValueDescriptor labels does not match saved labels", TEST_LABELS,
valueDescriptor.getLabels());
assertEquals("ValueDescriptor origin does not match saved origin", TEST_ORIGIN,
valueDescriptor.getOrigin());
assertNotNull("ValueDescriptor modified date is null", valueDescriptor.getModified());
assertNotNull("ValueDescriptor create date is null", valueDescriptor.getCreated());
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:25,代码来源:ValueDescriptorRepositoryTest.java
示例5: readingsByUomLabel
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Return a list of readings with an associated value descriptor of the UoM label specified.
* LimitExceededException (HTTP 413) if the number of readings exceeds the current max limit.
* ServiceException (HTTP 503) for unknown or unanticipated issues.
*
* @param uomLabel - Unit of Measure label (UoMLabel) matching the Value Descriptor associated to
* the reading
* @param limit - maximum number of readings to be allowed to be returned
* @return - list of matching readings having value descriptor with UoM label specified
* @throws ServiceException (HTTP 503) for unknown or unanticipated issues
* @throws LimitExceededException (HTTP 413) if the number of readings exceeds the current max
* limit
*/
@RequestMapping(value = "/uomlabel/{uomLabel:.+}/{limit}", method = RequestMethod.GET)
@Override
public List<Reading> readingsByUomLabel(@PathVariable String uomLabel, @PathVariable int limit) {
if (limit > maxLimit)
throw new LimitExceededException(LIMIT_ON_READING);
try {
List<ValueDescriptor> valDescs = valDescRepos.findByUomLabel(uomLabel);
if (valDescs.isEmpty())
return new ArrayList<>();
return filterReadings(valDescs, determineLimit(limit));
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:29,代码来源:ReadingControllerImpl.java
示例6: readingsByLabel
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Return a list of readings with an associated value descriptor of the label specified.
* LimitExceededException (HTTP 413) if the number of readings exceeds the current max limit.
* ServiceException (HTTP 503) for unknown or unanticipated issues.
*
* @param label - String label that should be in matching Value Descriptor's label array
* @param limit - maximum number of readings to be allowed to be returned
* @return - list of matching readings having value descriptor with the associated label. Could be
* an empty list if none match.
* @throws ServiceException (HTTP 503) for unknown or unanticipated issues
* @throws LimitExceededException (HTTP 413) if the number of readings exceeds the current max
* limit
*/
@RequestMapping(value = "/label/{label:.+}/{limit}", method = RequestMethod.GET)
@Override
public List<Reading> readingsByLabel(@PathVariable String label, @PathVariable int limit) {
if (limit > maxLimit)
throw new LimitExceededException(LIMIT_ON_READING);
try {
List<ValueDescriptor> valDescs = valDescRepos.findByLabelsIn(label);
if (valDescs.isEmpty())
return new ArrayList<>();
return filterReadings(valDescs, determineLimit(limit));
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:29,代码来源:ReadingControllerImpl.java
示例7: readingsByType
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Return a list of readings with an associated value descriptor of the type (IoTType) specified.
* LimitExceededException (HTTP 413) if the number of readings exceeds the current max limit.
* ServiceException (HTTP 503) for unknown or unanticipated issues.
*
* @param type - an IoTType in string form (one of I, B, F, S for integer, Boolean, Floating point
* or String)
* @param limit - maximum number of readings to be allowed to be returned
* @return - list of matching readings having value descriptor of the types specified. Could be an
* empty list if none match.
* @throws ServiceException (HTTP 503) for unknown or unanticipated issues
* @throws LimitExceededException (HTTP 413) if the number of readings exceeds the current max
* limit
*/
@RequestMapping(value = "/type/{type:.+}/{limit}", method = RequestMethod.GET)
@Override
public List<Reading> readingsByType(@PathVariable String type, @PathVariable int limit) {
if (limit > maxLimit)
throw new LimitExceededException(LIMIT_ON_READING);
try {
List<ValueDescriptor> valDescs = valDescRepos.findByType(IoTType.valueOf(type));
if (valDescs.isEmpty())
return new ArrayList<>();
return filterReadings(valDescs, determineLimit(limit));
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:30,代码来源:ReadingControllerImpl.java
示例8: valueDescriptor
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Fetch a specific ValueDescriptor by its database generated id. NotFoundException (HTTP 404) if
* no value descriptor can be found by the id provided. ServcieException (HTTP 503) for unknown or
* unanticipated issues
*
* @param String ValueDescriptor id (ObjectId)
*
* @return ValueDescriptor
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues NotFoundException (HTTP
* 404) if not found by id.
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@Override
public ValueDescriptor valueDescriptor(@PathVariable String id) {
try {
ValueDescriptor valuDes = valDescRepos.findOne(id);
if (valuDes == null)
throw new NotFoundException(ValueDescriptor.class.toString(), id);
return valuDes;
} catch (NotFoundException nfE) {
throw nfE;
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:27,代码来源:ValueDescriptorControllerImpl.java
示例9: valueDescriptors
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Return all ValueDescriptor objects. LimitExceededException (HTTP 413) if the number of value
* descriptors exceeds the current max limit. ServcieException (HTTP 503) for unknown or
* unanticipated issues.
*
* @return list of ValueDescriptors
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
* @throws LimitExceededException (HTTP 413) if the number of value descriptors exceeds the
* current max limit
*/
@RequestMapping(method = RequestMethod.GET)
@Override
public List<ValueDescriptor> valueDescriptors() {
try {
if (valDescRepos.count() > maxLimit)
throw new LimitExceededException("Value Descriptor");
else
return valDescRepos.findAll();
} catch (LimitExceededException lE) {
throw lE;
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:26,代码来源:ValueDescriptorControllerImpl.java
示例10: valueDescriptorByName
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Return ValueDescriptor object with given name. ServcieException (HTTP 503) for unknown or
* unanticipated issues.
*
* @param name of the value descriptor to locate and return
* @return ValueDescriptor having the provided name, could be null if none are found.
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
*/
@RequestMapping(value = "/name/{name:.+}", method = RequestMethod.GET)
@Override
public ValueDescriptor valueDescriptorByName(@PathVariable String name) {
try {
ValueDescriptor valuDes = valDescRepos.findByName(name);
if (valuDes == null)
throw new NotFoundException(ValueDescriptor.class.toString(), name);
return valuDes;
} catch (NotFoundException nfE) {
throw nfE;
} catch (Exception e) {
logger.error(ERR_GETTING + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:24,代码来源:ValueDescriptorControllerImpl.java
示例11: valueDescriptorsForDeviceById
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Retrieve value descriptors associated to a device where the device is identified by id - that
* is value descriptors that are listed as part of a devices parameter names on puts or expected
* values on get or put commands. Throws a ServcieException (HTTP 503) for unknown or
* unanticipated issues. Throws NotFoundExcetption (HTTP 404) if a device cannot be found for the
* id provided.
*
* @param name - name of the device
* @return list of value descriptors associated to the device.
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
* @throws NotFoundException (HTTP 404) for device not found by id
*/
@RequestMapping(value = "/deviceid/{id}", method = RequestMethod.GET)
@Override
public List<ValueDescriptor> valueDescriptorsForDeviceById(@PathVariable String id) {
try {
Device device = deviceClient.device(id);
Set<String> vdNames = device.getProfile().getCommands().stream()
.map((Command cmd) -> cmd.associatedValueDescriptors()).flatMap(l -> l.stream())
.collect(Collectors.toSet());
return vdNames.stream().map(s -> this.valDescRepos.findByName(s))
.collect(Collectors.toList());
} catch (javax.ws.rs.NotFoundException nfE) {
throw new NotFoundException(Device.class.toString(), id);
} catch (Exception e) {
logger.error("Error getting value descriptor by device name: " + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:30,代码来源:ValueDescriptorControllerImpl.java
示例12: add
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Add a new ValueDescriptor whose name must be unique. ServcieException (HTTP 503) for unknown or
* unanticipated issues. DataValidationException (HTTP 409) if the a formatting string of the
* value descriptor is not a valid printf format or if the name is determined to not be unique
* with regard to other value descriptors.
*
* @param valueDescriptor object
* @return id of the new ValueDescriptor
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
* @throws DataValidationException (HTTP 409) if the format string is not valid or name not unique
*/
@RequestMapping(method = RequestMethod.POST)
@Override
public String add(@RequestBody ValueDescriptor valueDescriptor) {
if (!validateFormatString(valueDescriptor))
throw new DataValidationException(
"Value descriptor's format string doesn't fit the required pattern: " + formatSpecifier);
try {
valDescRepos.save(valueDescriptor);
return valueDescriptor.getId();
} catch (DuplicateKeyException dE) {
throw new DataValidationException(
"Value descriptor's name is not unique: " + valueDescriptor.getName());
} catch (Exception e) {
logger.error("Error adding value descriptor: " + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:29,代码来源:ValueDescriptorControllerImpl.java
示例13: update
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Update the ValueDescriptor identified by the id or name in the object provided. Id is used
* first, name is used second for identification purposes. ServcieException (HTTP 503) for unknown
* or unanticipated issues. DataValidationException (HTTP 409) if the a formatting string of the
* value descriptor is not a valid printf format. NotFoundException (404) if the value descriptor
* cannot be located by the identifier.
*
* @param valueDescriptor2 - object holding the identifier and new values for the ValueDescriptor
* @return boolean indicating success of the update
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
* @throws DataValidationException (HTTP 409) if the format string is not valid
* @throws NotFoundException (HTTP 404) when the value descriptor cannot be found by the id
*/
@RequestMapping(method = RequestMethod.PUT)
@Override
public boolean update(@RequestBody ValueDescriptor valueDescriptor2) {
try {
ValueDescriptor valueDescriptor =
getValueDescriptorByIdOrName(valueDescriptor2.getId(), valueDescriptor2.getName());
if (valueDescriptor != null) {
updateValueDescriptor(valueDescriptor2, valueDescriptor);
return true;
} else {
logger.error(
"Request to update with non-existent or unidentified value descriptor (id/name): "
+ valueDescriptor2.getId() + "/" + valueDescriptor2.getName());
throw new NotFoundException(ValueDescriptor.class.toString(), valueDescriptor2.getId());
}
} catch (DataValidationException dE) {
throw dE;
} catch (NotFoundException nE) {
throw nE;
} catch (Exception e) {
logger.error("Error updating value descriptor: " + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:38,代码来源:ValueDescriptorControllerImpl.java
示例14: delete
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* Remove the ValueDescriptor designated by database generated identifier. ServcieException (HTTP
* 503) for unknown or unanticipated issues. DataValidationException (HTTP 409) if the value
* descriptor is still referenced in Readings. NotFoundException (404) if the value descriptor
* cannot be located by the identifier.
*
* @param identifier (database generated) of the value descriptor to be deleted
* @return boolean indicating success of the remove operation
* @throws ServcieException (HTTP 503) for unknown or unanticipated issues
* @throws DataValidationException (HTTP 409) if the value descriptor is still referenced by
* readings
* @throws NotFoundException (HTTP 404) when the value descriptor cannot be found by the id
*/
@RequestMapping(value = "/id/{id}", method = RequestMethod.DELETE)
@Override
public boolean delete(@PathVariable String id) {
try {
ValueDescriptor valueDescriptor = valDescRepos.findOne(id);
if (valueDescriptor != null)
return deleteValueDescriptor(valueDescriptor);
else {
logger.error("Request to delete with non-existent value descriptor id: " + id);
throw new NotFoundException(ValueDescriptor.class.toString(), id);
}
} catch (DataValidationException dE) {
throw dE;
} catch (NotFoundException nE) {
throw nE;
} catch (Exception e) {
logger.error("Error removing value descriptor: " + e.getMessage());
throw new ServiceException(e);
}
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:34,代码来源:ValueDescriptorControllerImpl.java
示例15: generate
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
/**
* generate ValueDescriptor <br>
* Use {@link org.edgexfoundry.domain.common.ValueDescriptor#ValueDescriptor()} to generate
* ValueDescriptor instance
*
* @param name Name which matched with DeviceObject or Parameter of ResourceOperation
* @return created ValueDescriptor
*/
public static ValueDescriptor generate(String name) {
if (name == null || name.isEmpty()) {
return null;
}
ValueDescriptor valueDescriptor = new ValueDescriptor();
valueDescriptor.setName(name);
valueDescriptor.setMin(OPCUADefaultMetaData.MIN.getValue());
valueDescriptor.setMax(OPCUADefaultMetaData.MAX.getValue());
valueDescriptor.setType(IoTType.J);
valueDescriptor.setUomLabel(OPCUADefaultMetaData.UOMLABEL.getValue());
valueDescriptor.setDefaultValue(OPCUADefaultMetaData.DEFAULTVALUE.getValue());
valueDescriptor.setFormatting("%s");
String[] labels =
{OPCUADefaultMetaData.LABEL1.getValue(), OPCUADefaultMetaData.LABEL2.getValue()};
valueDescriptor.setLabels(labels);
return valueDescriptor;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:27,代码来源:ValueDescriptorGenerator.java
示例16: testUpdateValueDescriptorById
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
@Test
public void testUpdateValueDescriptorById() {
ValueDescriptor valueDescriptor2 = new ValueDescriptor();
valueDescriptor2.setId(testValDescId);
valueDescriptor2.setFormatting(UPDATE_FMT_STRING);
valueDescriptor2.setMin(UPDATE_INT);
valueDescriptor2.setMax(UPDATE_INT);
valueDescriptor2.setType(IoTType.I);
valueDescriptor2.setUomLabel(UPDATE_STRING);
valueDescriptor2.setDefaultValue(UPDATE_INT);
valueDescriptor2.setLabels(UPDATE_STRING_ARRAY);
valueDescriptor2.setOrigin(UPDATE_INT);
assertTrue("Value descriptor controller unable to update value descriptor",
controller.update(valueDescriptor2));
ValueDescriptor valueDescriptor = repos.findOne(testValDescId);
checkUpdatedValueDescriptor(valueDescriptor);
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:18,代码来源:ValueDescriptorControllerTest.java
示例17: testUpdateValueDescriptorByName
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
@Test
public void testUpdateValueDescriptorByName() {
ValueDescriptor valueDescriptor2 = new ValueDescriptor();
valueDescriptor2.setName(TEST_NAME);
valueDescriptor2.setFormatting(UPDATE_FMT_STRING);
valueDescriptor2.setMin(UPDATE_INT);
valueDescriptor2.setMax(UPDATE_INT);
valueDescriptor2.setType(IoTType.I);
valueDescriptor2.setUomLabel(UPDATE_STRING);
valueDescriptor2.setDefaultValue(UPDATE_INT);
valueDescriptor2.setLabels(UPDATE_STRING_ARRAY);
valueDescriptor2.setOrigin(UPDATE_INT);
assertTrue("Value descriptor controller unable to update value descriptor",
controller.update(valueDescriptor2));
ValueDescriptor valueDescriptor = repos.findOne(testValDescId);
checkUpdatedValueDescriptor(valueDescriptor);
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:18,代码来源:ValueDescriptorControllerTest.java
示例18: checkUpdatedValueDescriptor
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private void checkUpdatedValueDescriptor(ValueDescriptor valueDescriptor) {
assertEquals("ValueDescriptor ID does not match saved id", testValDescId,
valueDescriptor.getId());
assertEquals("ValueDescriptor name does not match saved name", TEST_NAME,
valueDescriptor.getName());
assertEquals("ValueDescriptor min does not match saved min", UPDATE_INT,
valueDescriptor.getMin());
assertEquals("ValueDescriptor max does not match saved max", UPDATE_INT,
valueDescriptor.getMax());
assertEquals("ValueDescriptor type does not match saved type", IoTType.I,
valueDescriptor.getType());
assertEquals("ValueDescriptor label does not match saved label", UPDATE_STRING,
valueDescriptor.getUomLabel());
assertEquals("ValueDescriptor default value does not match saved default value", UPDATE_INT,
valueDescriptor.getDefaultValue());
assertEquals("ValueDescriptor formatting does not match saved formatting", UPDATE_FMT_STRING,
valueDescriptor.getFormatting());
assertArrayEquals("ValueDescriptor labels does not match saved labels", UPDATE_STRING_ARRAY,
valueDescriptor.getLabels());
assertEquals("ValueDescriptor origin does not match saved origin", UPDATE_INT,
valueDescriptor.getOrigin());
assertNotNull("ValueDescriptor modified date is null", valueDescriptor.getModified());
assertNotNull("ValueDescriptor create date is null", valueDescriptor.getCreated());
assertTrue(valueDescriptor.getModified() != valueDescriptor.getCreated());
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:26,代码来源:ValueDescriptorControllerTest.java
示例19: createDescriptor
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private ValueDescriptor createDescriptor(String name, DeviceObject object, Device device) {
PropertyValue value = object.getProperties().getValue();
Units units = object.getProperties().getUnits();
ValueDescriptor descriptor = new ValueDescriptor(name, value.getMinimum(), value.getMaximum(),
IoTType.valueOf(value.getType().substring(0, 1)), units.getDefaultValue(),
value.getDefaultValue(), "%s", null, object.getDescription());
try {
descriptor.setId(valueDescriptorClient.add(descriptor));
} catch (Exception e) {
logger.error("Adding Value descriptor: " + descriptor.getName() + " failed with error "
+ e.getMessage());
}
return descriptor;
}
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:17,代码来源:ProfileStore.java
示例20: createDescriptor
import org.edgexfoundry.domain.common.ValueDescriptor; //导入依赖的package包/类
private ValueDescriptor createDescriptor(String name, DeviceObject object, Device device) {
PropertyValue value = object.getProperties().getValue();
Units units = object.getProperties().getUnits();
ValueDescriptor descriptor = new ValueDescriptor(name,value.getMinimum(),
value.getMaximum(),IoTType.valueOf(value.getType().substring(0,1)),units.getDefaultValue(),
value.getDefaultValue(), "%s", null, object.getDescription());
try {
descriptor.setId(valueDescriptorClient.add(descriptor));
} catch (Exception e) {
logger.error("Adding Value descriptor: " + descriptor.getName()
+ " failed with error " + e.getMessage());
}
return descriptor;
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:17,代码来源:ProfileStore.java
注:本文中的org.edgexfoundry.domain.common.ValueDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论