Examples of SimpleValue


Examples of co.nstant.in.cbor.model.SimpleValue

        switch (dataItem.getSpecialType()) {
        case BREAK:
            write((7 << 5) | 31);
            break;
        case SIMPLE_VALUE:
            SimpleValue simpleValue = (SimpleValue) dataItem;
            switch (simpleValue.getSimpleValueType()) {
            case FALSE:
            case NULL:
            case TRUE:
            case UNDEFINED:
                SimpleValueType type = simpleValue.getSimpleValueType();
                write((7 << 5) | type.getValue());
                break;
            case UNALLOCATED:
                write((7 << 5) | simpleValue.getValue());
                break;
            case RESERVED:
            default:
                throw new CborException("Not implemented");
            }
            break;
        case UNALLOCATED:
            throw new CborException("Unallocated special type");
        case IEEE_754_HALF_PRECISION_FLOAT:
            if (!(dataItem instanceof HalfPrecisionFloat)) {
                throw new CborException("Wrong data item type");
            }
            halfPrecisionFloatEncoder.encode((HalfPrecisionFloat) dataItem);
            break;
        case IEEE_754_SINGLE_PRECISION_FLOAT:
            if (!(dataItem instanceof SinglePrecisionFloat)) {
                throw new CborException("Wrong data item type");
            }
            singlePrecisionFloatEncoder.encode((SinglePrecisionFloat) dataItem);
            break;
        case IEEE_754_DOUBLE_PRECISION_FLOAT:
            if (!(dataItem instanceof DoublePrecisionFloat)) {
                throw new CborException("Wrong data item type");
            }
            doublePrecisionFloatEncoder.encode((DoublePrecisionFloat) dataItem);
            break;
        case SIMPLE_VALUE_NEXT_BYTE:
            if (!(dataItem instanceof SimpleValue)) {
                throw new CborException("Wrong data item type");
            }
            SimpleValue simpleValueNextByte = (SimpleValue) dataItem;
            write((7 << 5) | 24);
            write(simpleValueNextByte.getValue());
            break;
        default:
            throw new CborException("Not implemented");
        }
    }
View Full Code Here

Examples of gov.nasa.arc.mct.services.config.impl.properties.SimpleValue

    assertTrue(s.contains("value=\"y\""));
  }
 
  @Test
  public void testValueMarshalling() throws JAXBException {
    SimpleValue value = new SimpleValue("hello");
    String s = marshalObject(value);
    assertTrue(s.contains("<entry value=\"hello\""));
  }
View Full Code Here

Examples of org.apache.xmlbeans.SimpleValue

        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    validate();
    log.debug( "building SimpleValue for {}", propertyName );
    if ( table == null ) {
      table = columns[0].getTable();
    }
    simpleValue = new SimpleValue( table );

    linkWithValue();

    boolean isInSecondPass = mappings.isInSecondPass();
    SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass(this);
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

        log.debug("today's date: " + todaysDate);
    }

    private Column createColumn(Class clazz) {
        Column column = new Column();
        SimpleValue sv = new SimpleValue();
        sv.setTypeName(clazz.getName());
        column.setValue(sv);
        return column;
    }
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    }

  }

  private void updatePrimaryKey(RootClass rc, PrimaryKeyInfo pki) {
    SimpleValue idValue = (SimpleValue) rc.getIdentifierProperty().getValue();

    Properties defaultStrategyProperties = new Properties();
    Property constrainedOneToOne = getConstrainedOneToOne(rc);
    if(constrainedOneToOne!=null) {
      if(pki.suggestedStrategy==null) {
        idValue.setIdentifierGeneratorStrategy("foreign");
      }

      if(pki.suggestedProperties==null) {
        defaultStrategyProperties.setProperty("property", constrainedOneToOne.getName());
        idValue.setIdentifierGeneratorProperties(defaultStrategyProperties);
      }
    }


View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

      referencedKeyValue = (KeyValue) collection.getOwner()
        .getProperty(propRef)
        .getValue();
    }

    SimpleValue keyValue = new DependantValue( collectionTable, referencedKeyValue );
    //keyValue.setForeignKeyName("none"); // Avoid creating the foreignkey
    //key.setCascadeDeleteEnabled( "cascade".equals( subnode.attributeValue("on-delete") ) );
    Iterator columnIterator = foreignKey.getColumnIterator();
    while ( columnIterator.hasNext() ) {
      Column fkcolumn = (Column) columnIterator.next();
      if(fkcolumn.getSqlTypeCode()!=null) { // TODO: user defined foreign ref columns does not have a type set.
        guessAndAlignType(collectionTable, fkcolumn, mapping, false); // needed to ensure foreign key columns has same type as the "property" column.
      }
      keyValue.addColumn( fkcolumn );
    }

    collection.setKey(keyValue);

    mappings.addCollection(collection);
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

      Properties suggestedProperties = null;
    }


  private PrimaryKeyInfo bindPrimaryKeyToProperties(Table table, RootClass rc, Set processed, Mapping mapping, DatabaseCollector collector) {
    SimpleValue id = null;
    String idPropertyname = null;

    PrimaryKeyInfo pki = new PrimaryKeyInfo();

    List keyColumns = null;
    if (table.getPrimaryKey()!=null) {
      keyColumns = table.getPrimaryKey().getColumns();
    }
    else {
      log.debug("No primary key found for " + table + ", using all properties as the identifier.");
      keyColumns = new ArrayList();
      Iterator iter = table.getColumnIterator();
      while (iter.hasNext() ) {
        Column col = (Column) iter.next();
        keyColumns.add(col);
      }
    }

    final TableIdentifier tableIdentifier = TableIdentifier.create(table);

    String tableIdentifierStrategyName = "assigned";

    boolean naturalId;

    if (keyColumns.size()>1) {
      log.debug("id strategy for " + rc.getEntityName() + " since it has a multiple column primary key");
      naturalId = true;

      id = handleCompositeKey(rc, processed, keyColumns, mapping);
      idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
      if(idPropertyname==null) {
        idPropertyname = "id";
      }
    }
    else {
      pki.suggestedStrategy = revengStrategy.getTableIdentifierStrategyName(tableIdentifier);
      String suggestedStrategy = pki.suggestedStrategy;
      if(suggestedStrategy==null) {
        suggestedStrategy = collector.getSuggestedIdentifierStrategy( tableIdentifier.getCatalog(), tableIdentifier.getSchema(), tableIdentifier.getName() );
        if(suggestedStrategy==null) {
          suggestedStrategy = "assigned";
        }
        tableIdentifierStrategyName = suggestedStrategy;
      } else {
        tableIdentifierStrategyName = suggestedStrategy;
      }

      naturalId = "assigned".equals( tableIdentifierStrategyName );
      Column pkc = (Column) keyColumns.get(0);
      checkColumn(pkc);

      id = bindColumnToSimpleValue(table, pkc, mapping, !naturalId);

      idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
      if(idPropertyname==null) {
        idPropertyname = revengStrategy.columnToPropertyName(tableIdentifier, pkc.getName() );
      }

      processed.add(pkc);
    }
    id.setIdentifierGeneratorStrategy(tableIdentifierStrategyName);
    pki.suggestedProperties = revengStrategy.getTableIdentifierProperties(tableIdentifier);
    id.setIdentifierGeneratorProperties(pki.suggestedProperties);
    if(naturalId) {
      id.setNullValue("undefined");
    }

    Property property = makeProperty(tableIdentifier, makeUnique(rc,idPropertyname), id, true, true, false, null, null);
    rc.setIdentifierProperty(property);
    rc.setIdentifier(id);
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

  }

  private Property bindBasicProperty(String propertyName, Table table, Column column, Set processedColumns, Mapping mapping) {

    SimpleValue value = bindColumnToSimpleValue( table, column, mapping, false );

    return makeProperty(TableIdentifier.create( table ), propertyName, value, true, true, false, null, null);
  }
View Full Code Here

Examples of org.hibernate.mapping.SimpleValue

    return makeProperty(TableIdentifier.create( table ), propertyName, value, true, true, false, null, null);
  }

  private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping, boolean generatedIdentifier) {
    SimpleValue value = new SimpleValue(table);
    value.addColumn(column);
    value.setTypeName(guessAndAlignType(table, column, mapping, generatedIdentifier));
    return value;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.