Ejemplo n.º 1
0
 private static Object convertConstant(Number source, ClassNode target) {
   if (ClassHelper.Byte_TYPE.equals(target)) {
     return source.byteValue();
   }
   if (ClassHelper.Short_TYPE.equals(target)) {
     return source.shortValue();
   }
   if (ClassHelper.Integer_TYPE.equals(target)) {
     return source.intValue();
   }
   if (ClassHelper.Long_TYPE.equals(target)) {
     return source.longValue();
   }
   if (ClassHelper.Float_TYPE.equals(target)) {
     return source.floatValue();
   }
   if (ClassHelper.Double_TYPE.equals(target)) {
     return source.doubleValue();
   }
   if (ClassHelper.BigInteger_TYPE.equals(target)) {
     return DefaultGroovyMethods.asType(source, BigInteger.class);
   }
   if (ClassHelper.BigDecimal_TYPE.equals(target)) {
     return DefaultGroovyMethods.asType(source, BigDecimal.class);
   }
   throw new IllegalArgumentException("Unsupported conversion");
 }
Ejemplo n.º 2
0
 public static Location getAt(World self, List pos) {
   Object p0 = DefaultGroovyMethods.getAt(pos, 0);
   Object p1 = DefaultGroovyMethods.getAt(pos, 1);
   Object p2 = DefaultGroovyMethods.getAt(pos, 2);
   Double x = DefaultGroovyMethods.asType(p0, double.class);
   Double y = DefaultGroovyMethods.asType(p1, double.class);
   Double z = DefaultGroovyMethods.asType(p2, double.class);
   return new Location(self, x, y, z);
 }
Ejemplo n.º 3
0
  @NotNull
  @Override
  protected UsageInfo[] findUsages() {
    final List<UsageInfo> result = new ArrayList<UsageInfo>();
    for (GrMemberInfo info : myMembersToMove) {
      final PsiMember member = info.getMember();
      if (member.hasModifierProperty(PsiModifier.STATIC)) {
        for (PsiReference reference : ReferencesSearch.search(member)) {
          result.add(new UsageInfo(reference));
        }
      }
    }

    return DefaultGroovyMethods.asType(result, UsageInfo[].class);
  }
Ejemplo n.º 4
0
 public CopySpec eachFile(Closure closure) {
   actions.add(
       (Action<? super FileCopyDetails>) DefaultGroovyMethods.asType(closure, Action.class));
   return this;
 }