Examples of BeanType


Examples of com.caucho.amber.type.BeanType

   * Creates a field-based schema.
   */
  public SchemaExpr createField(QueryParser parser, String name)
    throws QueryParseException
  {
    BeanType type = _id.getTargetType();

    AmberField field = type.getField(name);

    if (field == null)
      throw parser.error(L.l("{0}: '{1}' is an unknown field.",
                             type.getBeanClass().getName(),
                             name));

    AmberExpr fieldExpr = _id.createField(parser, name);

    if (fieldExpr instanceof ManyToOneExpr)
      return new ManyToOneSchemaExpr((ManyToOneExpr) fieldExpr, name);

    /*
      if (fieldExpr instanceof ManyToManyExpr)
      return new ManyToManySchemaExpr((ManyToManyExpr) fieldExpr);
    */

    if (fieldExpr instanceof OneToManyExpr)
      return new OneToManySchemaExpr((OneToManyExpr) fieldExpr);

    if (fieldExpr instanceof ElementCollectionExpr)
      return new ElementCollectionSchemaExpr((ElementCollectionExpr) fieldExpr);

    if (fieldExpr instanceof DependentEntityOneToOneExpr)
      return new OneToOneSchemaExpr((DependentEntityOneToOneExpr) fieldExpr, name);

    if (fieldExpr instanceof EmbeddedExpr)
      return new EmbeddedSchemaExpr((EmbeddedExpr) fieldExpr, name);

    throw parser.error(L.l("{0}: '{1}' must be a collection or one-to-one relationship.",
                           type.getBeanClass().getName(),
                           name));
  }
View Full Code Here

Examples of com.caucho.amber.type.BeanType

   */
  public AmberExpr createField(QueryParser parser, String fieldName)
  {
    AmberField field = null;

    BeanType type = getTargetType();

    do {
      field = type.getField(fieldName);

      if (type instanceof EntityType)
        type = ((EntityType) type).getParentType();
      else // XXX
        type = null;
View Full Code Here

Examples of com.caucho.amber.type.BeanType

   * Generates the where expression.
   */
  public void generateSelect(CharBuffer cb,
                             boolean fullSelect)
  {
    BeanType type = (BeanType) getType();

    if (type instanceof EmbeddableType) {
      _expr.generateSelect(cb);
      return;
    }

    if (type instanceof EntityType) {
      EntityType relatedType = (EntityType) type;
      cb.append(relatedType.getId().generateSelect(getTable()));
    }

    if (! fullSelect)
      return;

    FromItem item = _fromItem;

    // jpa/0l4b
    if (_rootItem != null) {
      EntityType parentType = (EntityType) type;

      while (parentType.getParentType() != null
             && parentType.getParentType() instanceof EntityType) {
        parentType = parentType.getParentType();
      }

      item = _rootItem;
    }

    String valueSelect = "";

    // jpa/0l12, jpa/0l47
    valueSelect = type.generateLoadSelect(item.getTable(),
                                          item.getName());

    if (valueSelect != null && ! "".equals(valueSelect)) {
      cb.append(", ");
      cb.append(valueSelect);
    }

    for (int i = 0; i < _subItems.size(); i++) {
      item = _subItems.get(i);

      valueSelect = type.generateLoadSelect(item.getTable(), item.getName());

      if (! valueSelect.equals("")) {
        cb.append(", ");
        cb.append(valueSelect);
      }
View Full Code Here

Examples of jfun.util.beans.BeanType

   * @param bean the bean object.
   * @param name the property name.
   * @return the Function object.
   */
  public static Function setter(Bean bean, String name){
    final BeanType btype = bean.getBeanType();
    if(btype.getWriter(name) == null
        && btype.getIndexedWriter(name)==null){
      throw new IllegalArgumentException("property setter for "+
        bean.getBeanType().getType().getName()+"."+name+" not found.");
    }
    else
      return new PropertyWriter(bean, name);
View Full Code Here

Examples of jfun.util.beans.BeanType

   * @return the instance.
   * @throws IntrospectionException
   */
  public static PropertiesInjector instance(Class type)
  throws IntrospectionException{
    final BeanType bt =jfun.yan.util.Utils.toBeanType(type);
    return new DefaultPropertiesInjector(bt, null);
  }
View Full Code Here

Examples of org.apache.cxf.aegis.type.basic.BeanType

        assertTrue(info.isExtensibleAttributes());
    }

    @Test
    public void testAegisType() {
        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean3.class);

        assertFalse(type.getTypeInfo().getAttributes().hasNext());

        Iterator itr = type.getTypeInfo().getElements();
        assertTrue(itr.hasNext());
        QName q = (QName)itr.next();
        assertEquals("attProp", q.getLocalPart());
    }
View Full Code Here

Examples of org.apache.cxf.aegis.type.basic.BeanType

        assertEquals("attProp", q.getLocalPart());
    }

    @Test
    public void testExtensibilityOff() {
        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean4.class);

        assertFalse(type.getTypeInfo().isExtensibleElements());
        assertFalse(type.getTypeInfo().isExtensibleAttributes());
    }
View Full Code Here

Examples of org.apache.cxf.aegis.type.basic.BeanType

        assertFalse(type.getTypeInfo().isExtensibleAttributes());
    }

    @Test
    public void testNillableAndMinOccurs() {
        BeanType type = (BeanType)tm.getTypeCreator().createType(JaxbBean4.class);
        AnnotatedTypeInfo info = (AnnotatedTypeInfo)type.getTypeInfo();
        Iterator elements = info.getElements();
        assertTrue(elements.hasNext());
        // nillable first
        QName element = (QName)elements.next();
        if ("minOccursProperty".equals(element.getLocalPart())) {
View Full Code Here

Examples of org.apache.cxf.aegis.type.basic.BeanType

                    wsdl);
    }

    @Test
    public void testGetSetRequired() throws Exception {
        BeanType type = new BeanType(new AnnotatedTypeInfo(tm, BadBean.class, "urn:foo",
                                                           new TypeCreationOptions()));
        type.setSchemaType(new QName("urn:foo", "BadBean"));

        assertFalse(type.getTypeInfo().getElements().hasNext());
    }
View Full Code Here

Examples of org.apache.cxf.aegis.type.basic.BeanType

                getConfiguration().isDefaultExtensibleAttributes()));

        typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs());
        typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable());

        BeanType type = new BeanType(typeInfo);
        type.setTypeMapping(getTypeMapping());
        type.setSchemaType(typeName);

        return type;
    }
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.