コード例 #1
0
 public Type getDefaultSuperClass() throws LookupException {
   TypeReference typeRef = createTypeReferenceInDefaultNamespace(getDefaultSuperClassFQN());
   Type result = typeRef.getType();
   if (result == null) {
     throw new LookupException("Default super class " + getDefaultSuperClassFQN() + " not found.");
   }
   return result;
 }
コード例 #2
0
 public void apply() {
   for (CrossReference cref : _targets) {
     SingleAssociation parentLink = cref.parentLink();
     Association childLink = parentLink.getOtherRelation();
     TypeReference namedTargetExpression = parameter().argument().substitutionReference().clone();
     childLink.replace(parentLink, namedTargetExpression.parentLink());
   }
 }
コード例 #3
0
ファイル: SingleStaticImport.java プロジェクト: jensdt/jnome
 public void setTypeReference(TypeReference reference) {
   if (reference != null) {
     _typeReference.connectTo(reference.parentLink());
   } else {
     _typeReference.connectTo(null);
   }
 }
コード例 #4
0
  public void replace(TypeReference replacement, final Declaration declarator, TypeReference<?> in)
      throws LookupException {
    UnsafePredicate<TypeReference, LookupException> predicate =
        new UnsafePredicate<TypeReference, LookupException>() {
          @Override
          public boolean eval(TypeReference object) throws LookupException {
            return object.getDeclarator().sameAs(declarator);
          }
        };
    List<TypeReference> crefs = in.descendants(TypeReference.class, predicate);
    if (predicate.eval(in)) {
      crefs.add(in);
    }

    for (TypeReference cref : crefs) {
      TypeReference clonedReplacement = replacement.clone();
      TypeReference substitute =
          createNonLocalTypeReference(clonedReplacement, replacement.parent());

      //			TypeReference substitute;
      //			if(replacement.isDerived()) {
      //				Element oldParent = replacement.parent();
      //				replacement.setUniParent(null);
      //				substitute = createNonLocalTypeReference(replacement,oldParent);
      //			} else {
      //				substitute = createNonLocalTypeReference(replacement);
      //			}

      SingleAssociation crefParentLink = cref.parentLink();
      crefParentLink.getOtherRelation().replace(crefParentLink, substitute.parentLink());
    }
  }
コード例 #5
0
 public TypeReference createTypeReferenceInDefaultNamespace(String fqn) {
   TypeReference typeRef = createTypeReference(fqn);
   typeRef.setUniParent(defaultNamespace());
   return typeRef;
 }
コード例 #6
0
 public TypeReference createNonLocalTypeReference(TypeReference tref) {
   return createNonLocalTypeReference(tref, tref.parent());
 }
コード例 #7
0
 public Type findType(String fqn) throws LookupException {
   TypeReference ref = createTypeReferenceInDefaultNamespace(fqn);
   return ref.getType();
 }