예제 #1
0
  private void applyColumnValues(AnnotationInstance columnAnnotation) {
    // if the column annotation is null we don't have to do anything. Everything is already
    // defaulted.
    if (columnAnnotation == null) {
      return;
    }

    AnnotationValue nameValue = columnAnnotation.value("name");
    if (nameValue != null) {
      this.name = nameValue.asString();
    }

    AnnotationValue uniqueValue = columnAnnotation.value("unique");
    if (uniqueValue != null) {
      this.unique = nameValue.asBoolean();
    }

    AnnotationValue nullableValue = columnAnnotation.value("nullable");
    if (nullableValue != null) {
      this.nullable = nullableValue.asBoolean();
    }

    AnnotationValue insertableValue = columnAnnotation.value("insertable");
    if (insertableValue != null) {
      this.insertable = insertableValue.asBoolean();
    }

    AnnotationValue updatableValue = columnAnnotation.value("updatable");
    if (updatableValue != null) {
      this.updatable = updatableValue.asBoolean();
    }

    AnnotationValue columnDefinition = columnAnnotation.value("columnDefinition");
    if (columnDefinition != null) {
      this.columnDefinition = columnDefinition.asString();
    }

    AnnotationValue tableValue = columnAnnotation.value("table");
    if (tableValue != null) {
      this.table = tableValue.asString();
    }

    AnnotationValue lengthValue = columnAnnotation.value("length");
    if (lengthValue != null) {
      this.length = lengthValue.asInt();
    }

    AnnotationValue precisionValue = columnAnnotation.value("precision");
    if (precisionValue != null) {
      this.precision = precisionValue.asInt();
    }

    AnnotationValue scaleValue = columnAnnotation.value("scale");
    if (scaleValue != null) {
      this.scale = scaleValue.asInt();
    }
  }
예제 #2
0
  @Override
  public int[] getBinaryVersions(String moduleName, String moduleVersion, File moduleArchive) {
    Index index = readModuleIndex(moduleArchive, false);
    final AnnotationInstance ceylonAnnotation = getAnnotation(index, moduleName, CEYLON_ANNOTATION);
    if (ceylonAnnotation == null) return null;

    AnnotationValue majorAnnotation = ceylonAnnotation.value("major");
    AnnotationValue minorAnnotation = ceylonAnnotation.value("minor");

    int major = majorAnnotation != null ? majorAnnotation.asInt() : 0;
    int minor = minorAnnotation != null ? minorAnnotation.asInt() : 0;
    return new int[] {major, minor};
  }
예제 #3
0
  @Override
  public ModuleVersionDetails readModuleInfo(
      String moduleName,
      String moduleVersion,
      File moduleArchive,
      boolean includeMembers,
      Overrides overrides) {
    Index index = readModuleIndex(moduleArchive, true);
    final AnnotationInstance moduleAnnotation = getAnnotation(index, moduleName, MODULE_ANNOTATION);
    if (moduleAnnotation == null) return null;

    AnnotationValue doc = moduleAnnotation.value("doc");
    AnnotationValue license = moduleAnnotation.value("license");
    AnnotationValue by = moduleAnnotation.value("by");
    AnnotationValue dependencies = moduleAnnotation.value("dependencies");
    String type = ArtifactContext.getSuffixFromFilename(moduleArchive.getName());

    final AnnotationInstance ceylonAnnotation = getAnnotation(index, moduleName, CEYLON_ANNOTATION);
    if (ceylonAnnotation == null) return null;

    AnnotationValue majorVer = ceylonAnnotation.value("major");
    AnnotationValue minorVer = ceylonAnnotation.value("minor");

    ModuleVersionDetails mvd =
        new ModuleVersionDetails(
            moduleName, getVersionFromFilename(moduleName, moduleArchive.getName()));
    mvd.setDoc(doc != null ? doc.asString() : null);
    mvd.setLicense(license != null ? license.asString() : null);
    if (by != null) {
      mvd.getAuthors().addAll(Arrays.asList(by.asStringArray()));
    }
    mvd.getDependencies()
        .addAll(getDependencies(dependencies, moduleName, mvd.getVersion(), overrides));
    ModuleVersionArtifact mva =
        new ModuleVersionArtifact(
            type, majorVer != null ? majorVer.asInt() : 0, minorVer != null ? minorVer.asInt() : 0);
    mvd.getArtifactTypes().add(mva);

    if (includeMembers) {
      mvd.setMembers(getMembers(index));
    }

    return mvd;
  }