com.helger.jcodemodel.AbstractJClass.fullName()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中com.helger.jcodemodel.AbstractJClass.fullName()方法的一些代码示例,展示了AbstractJClass.fullName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractJClass.fullName()方法的具体详情如下:
包路径:com.helger.jcodemodel.AbstractJClass
类名称:AbstractJClass
方法名:fullName

AbstractJClass.fullName介绍

暂无

代码示例

代码示例来源:origin: androidannotations/androidannotations

protected IJExpression addResultCallMethod(IJExpression exchangeCall, AbstractJClass methodReturnClass) {
  if (methodReturnClass != null && !methodReturnClass.fullName().startsWith(RESPONSE_ENTITY)) {
    return JExpr.invoke(exchangeCall, "getBody");
  }
  return exchangeCall;
}

代码示例来源:origin: androidannotations/androidannotations

public void copyNonAAAnnotations(IJAnnotatable annotatable, List<? extends AnnotationMirror> annotationMirrors) {
  for (AnnotationMirror annotationMirror : annotationMirrors) {
    if (annotationMirror.getAnnotationType().asElement().getAnnotation(Inherited.class) == null) {
      AbstractJClass annotationClass = typeMirrorToJClass(annotationMirror.getAnnotationType());
      if (!environment.isAndroidAnnotation(annotationClass.fullName()) && !IGNORED_ANNOTATIONS.contains(annotationClass.fullName())) {
        copyAnnotation(annotatable, annotationMirror);
      }
    }
  }
}

代码示例来源:origin: androidannotations/androidannotations

private boolean hasAnnotation(IJAnnotatable annotatable, String annotationFQN) {
  for (JAnnotationUse annotation : annotatable.annotations()) {
    if (annotation.getAnnotationClass().fullName().equals(annotationFQN)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: androidannotations/androidannotations

private JMethod findAlreadyGeneratedMethod(ExecutableElement executableElement, GeneratedClassHolder holder) {
  JDefinedClass definedClass = holder.getGeneratedClass();
  String methodName = executableElement.getSimpleName().toString();
  List<? extends VariableElement> parameters = executableElement.getParameters();
  // CHECKSTYLE:OFF
  // TODO: refactor the nasty label jump
  method: for (JMethod method : definedClass.methods()) {
    if (method.name().equals(methodName) && method.params().size() == parameters.size()) {
      int i = 0;
      for (JVar param : method.params()) {
        String searchedParamType = typeMirrorToJClass(parameters.get(i).asType()).fullName();
        if (!param.type().fullName().equals(searchedParamType)) {
          continue method;
        }
        i++;
      }
      return method;
    }
  }
  // CHECKSTYLE:ON
  return null;
}

代码示例来源:origin: androidannotations/androidannotations

@Override
protected void processParameters(HasPreferences holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters) {
  String preferenceClassName = holder.getBasePreferenceClass().fullName();
  JVar preferenceParam = listenerMethod.param(getEnvironment().getJClass(preferenceClassName), "preference");
  if (userParameters.size() == 1) {
    call.arg(castArgumentIfNecessary(holder, preferenceClassName, preferenceParam, userParameters.get(0)));
  }
}

代码示例来源:origin: androidannotations/androidannotations

private String getInvocationName(JFieldVar field) {
  AbstractJClass listOfStrings = getClasses().LIST.narrow(getClasses().STRING);
  if (field.type().fullName().equals(listOfStrings.fullName())) {
    return "contains";
  }
  return "equals";
}

代码示例来源:origin: androidannotations/androidannotations

public void addSuppressWarnings(IJAnnotatable generatedElement, String annotationValue) {
  Collection<JAnnotationUse> annotations = generatedElement.annotations();
  for (JAnnotationUse annotationUse : annotations) {
    if (SuppressWarnings.class.getCanonicalName().equals(annotationUse.getAnnotationClass().fullName())) {
      AbstractJAnnotationValue value = annotationUse.getParam("value");
      StringWriter code = new StringWriter();
      JFormatter formatter = new JFormatter(code);
      formatter.generable(value);
      if (!code.toString().contains(annotationValue)) {
        if (value instanceof JAnnotationArrayMember) {
          ((JAnnotationArrayMember) value).param(annotationValue);
        } else {
          String foundValue = code.toString().substring(1, code.toString().length() - 1);
          JAnnotationArrayMember newParamArray = annotationUse.paramArray("value");
          newParamArray.param(foundValue).param(annotationValue);
        }
      }
      return;
    }
  }
  generatedElement.annotate(SuppressWarnings.class).param("value", annotationValue);
}

代码示例来源:origin: androidannotations/androidannotations

private void fireEvent(JFieldVar eventManager, JBlock body, AbstractJClass eventClass, IJExpression... eventArguments) {
  AbstractJClass actualEventClass = eventClass;
  if (eventClass.fullName().startsWith("roboguice.context.event")) {
    actualEventClass = eventClass.narrow(getClasses().ACTIVITY);
  }
  JInvocation newEvent = _new(actualEventClass);
  newEvent.arg(_this());
  for (IJExpression eventArgument : eventArguments) {
    newEvent.arg(eventArgument);
  }
  body.invoke(eventManager, "fire").arg(newEvent);
}

代码示例来源:origin: androidannotations/androidannotations

private void setOnRetainNonConfigurationInstance() throws JClassAlreadyExistsException {
  AnnotationHelper annotationHelper = new AnnotationHelper(getEnvironment());
  TypeElement fragmentActivityTypeElement = getFragmentActivity(annotationHelper);
  TypeElement typeElement = annotationHelper.typeElementFromQualifiedName(generatedClass._extends().fullName());
  String onRetainNonConfigurationInstanceName = "onRetainNonConfigurationInstance";
  if (fragmentActivityTypeElement != null && annotationHelper.isSubtype(typeElement.asType(), fragmentActivityTypeElement.asType())) {
    onRetainNonConfigurationInstanceName = "onRetainCustomNonConfigurationInstance";
  }
  NonConfigurationHolder ncHolder = getNonConfigurationHolder();
  JDefinedClass ncHolderClass = ncHolder.getGeneratedClass();
  JMethod onRetainNonConfigurationInstanceMethod = generatedClass.method(PUBLIC, ncHolderClass, onRetainNonConfigurationInstanceName);
  onRetainNonConfigurationInstanceMethod.annotate(Override.class);
  JBlock methodBody = onRetainNonConfigurationInstanceMethod.body();
  onRetainNonConfigurationInstance = methodBody.decl(ncHolderClass, "nonConfigurationInstanceState_", _new(ncHolderClass));
  IJExpression superCall = _super().invoke(onRetainNonConfigurationInstanceMethod);
  methodBody.assign(onRetainNonConfigurationInstance.ref(ncHolder.getSuperNonConfigurationInstanceField()), superCall);
  onRetainNonConfigurationInstanceBindBlock = methodBody.blockSimple();
  methodBody._return(onRetainNonConfigurationInstance);
}

代码示例来源:origin: androidannotations/androidannotations

private void setGetLastNonConfigurationInstance() throws JClassAlreadyExistsException {
  AnnotationHelper annotationHelper = new AnnotationHelper(getEnvironment());
  TypeElement fragmentActivityTypeElement = getFragmentActivity(annotationHelper);
  TypeElement typeElement = annotationHelper.typeElementFromQualifiedName(generatedClass._extends().fullName());
  String getLastNonConfigurationInstanceName = "getLastNonConfigurationInstance";
  if (fragmentActivityTypeElement != null && annotationHelper.isSubtype(typeElement.asType(), fragmentActivityTypeElement.asType())) {
    getLastNonConfigurationInstanceName = "getLastCustomNonConfigurationInstance";
  }
  NonConfigurationHolder ncHolder = getNonConfigurationHolder();
  JDefinedClass ncHolderClass = ncHolder.getGeneratedClass();
  JFieldVar superNonConfigurationInstanceField = ncHolder.getSuperNonConfigurationInstanceField();
  getLastNonConfigurationInstance = generatedClass.method(PUBLIC, Object.class, getLastNonConfigurationInstanceName);
  getLastNonConfigurationInstance.annotate(Override.class);
  JBlock body = getLastNonConfigurationInstance.body();
  JVar nonConfigurationInstance = body.decl(ncHolderClass, "nonConfigurationInstance", cast(ncHolderClass, _super().invoke(getLastNonConfigurationInstance)));
  body._if(nonConfigurationInstance.eq(_null()))._then()._return(_null());
  body._return(nonConfigurationInstance.ref(superNonConfigurationInstanceField));
}

代码示例来源:origin: com.helger/jcodemodel

/**
 * Returns the name of this constant including the type name
 *
 * @return never null.
 */
@Nonnull
public String getName ()
{
 return m_aType.fullName () + '.' + m_sName;
}

代码示例来源:origin: com.helger/jcodemodel

@Override
 public String toString ()
 {
  return getClass ().getName () + '(' + fullName () + ')';
 }
}

代码示例来源:origin: com.helger/jcodemodel

@Override
@Nonnull
public String fullName ()
{
 // This method is e.g. used for import statements
 if (m_aClass instanceof JNarrowedClass)
 {
  // Avoid the type parameters
  return ((JNarrowedClass) m_aClass).erasure ().fullName ();
 }
 return m_aClass.fullName ();
}

代码示例来源:origin: phax/jcodemodel

@Override
@Nonnull
public String fullName ()
{
 // This method is e.g. used for import statements
 if (m_aClass instanceof JNarrowedClass)
 {
  // Avoid the type parameters
  return ((JNarrowedClass) m_aClass).erasure ().fullName ();
 }
 return m_aClass.fullName ();
}

代码示例来源:origin: com.helger/jcodemodel

@Override
public boolean equals (final Object o)
{
 if (o == this)
  return true;
 if (o == null || getClass () != o.getClass ())
  return false;
 final JEnumConstantRef rhs = (JEnumConstantRef) o;
 return isEqual (m_aType.fullName (), rhs.m_aType.fullName ()) && isEqual (m_sName, rhs.m_sName);
}

代码示例来源:origin: com.helger/jcodemodel

@Override
 public int hashCode ()
 {
  return getHashCode (this, m_aType.fullName (), m_sName);
 }
}

代码示例来源:origin: com.helger/jcodemodel

@Override
@Nonnull
public String fullName ()
{
 return m_eBoundMode.declarationTokens () + m_aBoundClass.fullName ();
}

代码示例来源:origin: com.helger/jcodemodel

@Override
 public int hashCode ()
 {
  return getHashCode (this, m_aType.fullName (), m_sName);
 }
}

代码示例来源:origin: org.androidannotations/androidannotations

private boolean hasAnnotation(IJAnnotatable annotatable, String annotationFQN) {
  for (JAnnotationUse annotation : annotatable.annotations()) {
    if (annotation.getAnnotationClass().fullName().equals(annotationFQN)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.androidannotations/androidannotations

@Override
protected void processParameters(HasPreferences holder, JMethod listenerMethod, JInvocation call, List<? extends VariableElement> userParameters) {
  String preferenceClassName = holder.getBasePreferenceClass().fullName();
  JVar preferenceParam = listenerMethod.param(getEnvironment().getJClass(preferenceClassName), "preference");
  if (userParameters.size() == 1) {
    call.arg(castArgumentIfNecessary(holder, preferenceClassName, preferenceParam, userParameters.get(0)));
  }
}

相关文章