org.eclipse.vorto.core.api.model.datatype.Property.getConstraintRule()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(73)

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

Property.getConstraintRule介绍

[英]Returns the value of the 'Constraint Rule' containment reference.

If the meaning of the 'Constraint Rule' containment reference isn't clear, there really should be more of a description here...
[中]返回“约束规则”包含引用的值。
如果“Constraint Rule”包含引用的含义不清楚,那么这里真的应该有更多的描述。。。

代码示例

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.lwm2m

private void handleRangeEnumeration( final Object lwm2mObject, final Property property, final Item item ) {
  if (property.getConstraintRule() != null) {
   final EList<Constraint> constraints = property.getConstraintRule().getConstraints();
 final StringBuilder rangeSb = new StringBuilder();
 for( final Constraint constraint : constraints ) {
   final ConstraintIntervalType type = constraint.getType();
   final String constraintValues = constraint.getConstraintValues();
   if( type == ConstraintIntervalType.MIN ) {
    rangeSb.append( constraintValues ).append( '-' );
   }
   else if( type == ConstraintIntervalType.MAX ) {
    rangeSb.append( constraintValues );
   }
   else if( type == ConstraintIntervalType.STRLEN ) {
    rangeSb.append( "0-" ).append( constraintValues ).append( " bytes" );
   }
   else {
    final String errMsg = unsupportedValueForPropertyMsg( "ConstraintIntervalType <" + type + ">", property,
      lwm2mObject );
    throw new IllegalArgumentException( errMsg );
   }
 }
 item.setRangeEnumeration( rangeSb.toString() );
}
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen

public static String getMinConstraint(final Property property) {
 boolean _and = false;
 ConstraintRule _constraintRule = property.getConstraintRule();
 EList<Constraint> _constraints = null;
 if (_constraintRule!=null) {
  _and = false;
 } else {
  ConstraintRule _constraintRule_1 = property.getConstraintRule();
  EList<Constraint> _constraints_1 = null;
  if (_constraintRule_1!=null) {
  ConstraintRule _constraintRule_2 = property.getConstraintRule();
  EList<Constraint> _constraints_2 = null;
  if (_constraintRule_2!=null) {

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen

public static String getMaxConstraint(final Property property) {
 boolean _and = false;
 ConstraintRule _constraintRule = property.getConstraintRule();
 EList<Constraint> _constraints = null;
 if (_constraintRule!=null) {
  _and = false;
 } else {
  ConstraintRule _constraintRule_1 = property.getConstraintRule();
  EList<Constraint> _constraints_1 = null;
  if (_constraintRule_1!=null) {
  ConstraintRule _constraintRule_2 = property.getConstraintRule();
  EList<Constraint> _constraints_2 = null;
  if (_constraintRule_2!=null) {

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.datatype

@Check
public void checkDuplicatedConstraint(final Property feature) {
 HashSet<String> set = new HashSet<String>();
 ConstraintRule _constraintRule = feature.getConstraintRule();
 EList<Constraint> list = _constraintRule.getConstraints();
 for (int i = 0; (i < ((Object[])Conversions.unwrapArray(list, Object.class)).length); i++) {
  {
   Constraint con = list.get(i);
   ConstraintIntervalType _type = con.getType();
   String _literal = _type.getLiteral();
   boolean _add = set.add(_literal);
   boolean _not = (!_add);
   if (_not) {
    this.error(DatatypeSystemMessage.ERROR_DUPLICATED_CONSTRAINT, con, DatatypePackage.Literals.CONSTRAINT__TYPE);
   }
  }
 }
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.editor.datatype

@Check
public void checkConstraint(final Property prop) {
 ConstraintRule _constraintRule = prop.getConstraintRule();
 EList<Constraint> constraints = _constraintRule.getConstraints();
 final EList<Constraint> _converted_constraints = (EList<Constraint>)constraints;
 int _length = ((Object[])Conversions.unwrapArray(_converted_constraints, Object.class)).length;
 boolean _equals = (_length == 0);
 if (_equals) {
  return;
 }
 PropertyType _type = prop.getType();
 PrimitivePropertyType primi = ((PrimitivePropertyType) _type);
 boolean isMultiplcity = prop.isMultiplicity();
 for (final Constraint constraint : constraints) {
  this.verifyConstraintForType(primi, constraint, isMultiplcity);
 }
}

代码示例来源:origin: eclipse/vorto

public static InformationModel convertToFlatHierarchy(InformationModel infomodel) {
 for (FunctionblockProperty fbProperty : infomodel.getProperties()) {
  FunctionblockModel fbm = fbProperty.getType();
  fbProperty.setType(convertToFlatHierarchy(fbm));
  // merge any extended properties from information model to the FB properties
  if (fbProperty.getExtendedFunctionBlock() != null
    && fbProperty.getExtendedFunctionBlock().getStatus() != null) {
   for (Property extendedProperty : fbProperty.getExtendedFunctionBlock().getStatus()
     .getProperties()) {
    Optional<Property> baseProperty = fbm.getFunctionblock().getStatus().getProperties()
      .stream().filter(p -> p.getName().equals(extendedProperty.getName())).findFirst();
    if (baseProperty.isPresent()) {
     baseProperty.get().setConstraintRule(extendedProperty.getConstraintRule());
    }
   }
  }
 }
 return infomodel;
}

代码示例来源:origin: org.eclipse.vorto/org.eclipse.vorto.codegen.ditto

String _trim = _string.trim();
_builder.append(_trim, "\t\t");
ConstraintRule _constraintRule = property.getConstraintRule();
CharSequence _constraintsContent = Utils.getConstraintsContent(_constraintRule, invocationContext);
_builder.append(_constraintsContent, "\t\t");
String _trim_1 = _string_1.trim();
_builder.append(_trim_1, "\t");
ConstraintRule _constraintRule_1 = property.getConstraintRule();
CharSequence _constraintsContent_1 = Utils.getConstraintsContent(_constraintRule_1, invocationContext);
_builder.append(_constraintsContent_1, "\t");

相关文章