Ejemplo n.º 1
0
  /** INTERNAL: */
  protected MetadataColumn(MetadataAnnotation column, MetadataAccessibleObject accessibleObject) {
    super(column, accessibleObject);

    if (column != null) {
      m_name = (String) column.getAttribute("name");
      m_columnDefinition = (String) column.getAttribute("columnDefinition");
    }
  }
 /** INTERNAL: Called from annotation and xml initialization. */
 public void initAccess() {
   // Look for an annotation as long as an access type hasn't already been
   // loaded from XML (meaning m_access will not be null at this point)
   if (m_access == null) {
     MetadataAnnotation access = getAnnotation(MetadataConstants.ACCESS_ANNOTATION);
     if (access != null) {
       setAccess((String) access.getAttribute("value"));
     }
   }
 }
  public AccessMethodsMetadata(MetadataAnnotation virtualAccessMethods, MetadataAccessor accessor) {
    super(virtualAccessMethods, accessor);
    if (virtualAccessMethods.getName().equals(VirtualAccessMethods.class.getName())) {
      if (virtualAccessMethods.hasAttribute("get")) {
        this.getMethodName = virtualAccessMethods.getAttributeString("get");
      }

      if (virtualAccessMethods.hasAttribute("set")) {
        this.setMethodName = virtualAccessMethods.getAttributeString("set");
      }
    }
  }
  /** INTERNAL: Used for annotation loading. */
  public ColumnMetadata(MetadataAnnotation column, MetadataAccessor accessor) {
    super(column, accessor);

    if (column != null) {
      // Apply the values from the column annotation.
      setUnique(column.getAttributeBooleanDefaultFalse("unique"));

      setScale(column.getAttributeInteger("scale"));
      setLength(column.getAttributeInteger("length"));
      setPrecision(column.getAttributeInteger("precision"));

      setTable(column.getAttributeString("table"));
    }
  }
  /** INTERNAL: */
  public ManyToManyAccessor(
      MetadataAnnotation manyToMany,
      MetadataAnnotatedElement annotatedElement,
      ClassAccessor classAccessor) {
    super(manyToMany, annotatedElement, classAccessor);

    setMappedBy(manyToMany.getAttributeString("mappedBy"));
  }
  /** INTERNAL: */
  public NamedStoredProcedureQueryMetadata(
      MetadataAnnotation namedStoredProcedureQuery, MetadataAccessor accessor) {
    super(namedStoredProcedureQuery, accessor);

    for (Object storedProcedureParameter :
        namedStoredProcedureQuery.getAttributeArray("parameters")) {
      m_parameters.add(
          new StoredProcedureParameterMetadata(
              (MetadataAnnotation) storedProcedureParameter, accessor));
    }

    // JPA spec allows for multiple result classes.
    for (Object resultClass :
        (Object[]) namedStoredProcedureQuery.getAttributeArray("resultClasses")) {
      m_resultClasses.add(getMetadataClass((String) resultClass));
    }

    // JPA spec allows for multiple result set mappings.
    for (Object resultSetMapping :
        (Object[]) namedStoredProcedureQuery.getAttributeArray("resultSetMappings")) {
      m_resultSetMappings.add((String) resultSetMapping);
    }

    m_procedureName = namedStoredProcedureQuery.getAttributeString("procedureName");

    // Don't default these booleans as we want to know if the user has actually set them.
    m_returnsResultSet =
        namedStoredProcedureQuery.getAttributeBooleanDefaultFalse("returnsResultSet");
    m_multipleResultSets =
        namedStoredProcedureQuery.getAttributeBooleanDefaultFalse("multipleResultSets");

    m_callByIndex = namedStoredProcedureQuery.getAttributeBooleanDefaultFalse("callByIndex");
  }
  /** INTERNAL: Used for annotation loading. */
  protected AbstractConverterMetadata(MetadataAnnotation converter, MetadataAccessor accessor) {
    super(converter, accessor);

    m_name = (String) converter.getAttribute("name");
  }
 /** INTERNAL: Used for annotation loading. */
 public ValuePartitionMetadata(MetadataAnnotation annotation, MetadataAccessor accessor) {
   super(annotation, accessor);
   this.connectionPool = (String) annotation.getAttribute("connectionPool");
   this.value = (String) annotation.getAttribute("value");
 }