javax.lang.model.type.NullType Java Examples

The following examples show how to use javax.lang.model.type.NullType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSimpleExcelBuilder.java    From myexcel with Apache License 2.0 6 votes vote down vote up
private void setTdContent(Td td, Pair<? extends Class, ?> pair) {
    Class fieldType = pair.getKey();
    if (fieldType == NullType.class) {
        return;
    }
    if (fieldType == Date.class) {
        td.setDate((Date) pair.getValue());
    } else if (fieldType == LocalDateTime.class) {
        td.setLocalDateTime((LocalDateTime) pair.getValue());
    } else if (fieldType == LocalDate.class) {
        td.setLocalDate((LocalDate) pair.getValue());
    } else if (com.github.liaochong.myexcel.core.constant.File.class.isAssignableFrom(fieldType)) {
        td.setFile((File) pair.getValue());
    } else {
        td.setContent(String.valueOf(pair.getValue()));
    }
}
 
Example #2
Source File: AbstractSimpleExcelBuilder.java    From myexcel with Apache License 2.0 6 votes vote down vote up
protected List<Pair<? extends Class, ?>> assemblingMapContents(Map<String, Object> data) {
    if (data == null || data.isEmpty()) {
        return Collections.emptyList();
    }
    List<Pair<? extends Class, ?>> contents = new ArrayList<>(data.size());
    if (fieldDisplayOrder == null) {
        data.forEach((k, v) -> {
            contents.add(Pair.of(v == null ? NullType.class : v.getClass(), v));
        });
    } else {
        for (String fieldName : fieldDisplayOrder) {
            Object val = data.get(fieldName);
            contents.add(Pair.of(val == null ? NullType.class : val.getClass(), val));
        }
    }
    return contents;
}
 
Example #3
Source File: SrcClassUtil.java    From manifold with Apache License 2.0 6 votes vote down vote up
private SrcType makeTypeVarType( Symbol.TypeVariableSymbol typeVar )
{
  StringBuilder sb = new StringBuilder( typeVar.type.toString() );
  Type lowerBound = typeVar.type.getLowerBound();
  if( lowerBound != null && !(lowerBound instanceof NullType) )
  {
    sb.append( " super " ).append( lowerBound.toString() );
  }
  else
  {
    Type upperBound = typeVar.type.getUpperBound();
    if( upperBound != null && !(upperBound instanceof NoType) && !upperBound.toString().equals( Object.class.getName() ) )
    {
      sb.append( " extends " ).append( upperBound.toString() );
    }
  }
  return new SrcType( sb.toString() );
}
 
Example #4
Source File: Util.java    From revapi with Apache License 2.0 5 votes vote down vote up
@Override
public final T visitNull(NullType t, StringBuilderAndState<S> st) {
    try {
        st.depth++;
        return doVisitNull(t, st);
    } finally {
        st.depth--;
    }
}
 
Example #5
Source File: GuiContainerHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, ReturnValue<NullType> returnValue) {
/*        SkyblockAddons main = SkyblockAddons.getInstance();
        if (main.getUtils().isOnSkyblock()) {
            boolean isOutsideGui = oldMouseX < guiLeft || oldMouseY < guiTop || oldMouseX >= guiLeft + xSize || oldMouseY >= guiTop + ySize;
            Minecraft mc = Minecraft.getMinecraft();
            if (main.getConfigValues().isEnabled(Feature.STOP_DROPPING_SELLING_RARE_ITEMS) &&
                    mc.thePlayer.inventory.getItemStack() != null && isOutsideGui &&
                    main.getInventoryUtils().shouldCancelDrop(mc.thePlayer.inventory.getItemStack())) returnValue.cancel();
        }*/
    }
 
Example #6
Source File: MoreTypes.java    From auto-parcel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a {@link NullType} if the {@link TypeMirror} represents the null type
 * or throws an {@link IllegalArgumentException}.
 */
public static NullType asNullType(TypeMirror maybeNullType) {
    return maybeNullType.accept(new CastingTypeVisitor<NullType>() {
        @Override
        public NullType visitNull(NullType nullType, String p) {
            return nullType;
        }
    }, "null");
}
 
Example #7
Source File: StandaloneTypeMirror.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
  switch (kind) {
    case BOOLEAN:
    case BYTE:
    case SHORT:
    case INT:
    case LONG:
    case CHAR:
    case FLOAT:
    case DOUBLE:
      return v.visitPrimitive((PrimitiveType) this, p);
    case PACKAGE:
    case VOID:
    case NONE:
      return v.visitNoType((NoType) this, p);
    case NULL:
      return v.visitNull((NullType) this, p);
    case ARRAY:
      return v.visitArray((ArrayType) this, p);
    case DECLARED:
      return v.visitDeclared((DeclaredType) this, p);
    case ERROR:
      return v.visitError((ErrorType) this, p);
    case TYPEVAR:
      return v.visitTypeVariable((TypeVariable) this, p);
    case WILDCARD:
      return v.visitWildcard((WildcardType) this, p);
    case EXECUTABLE:
      return v.visitExecutable((ExecutableType) this, p);
    case OTHER:
      return v.visit(this, p);
    case UNION:
      return v.visitUnion((UnionType) this, p);
    case INTERSECTION:
      return v.visitIntersection((IntersectionType) this, p);
    default:
      throw new AssertionError(String.format("Unknown TypeKind: %s", kind));
  }
}
 
Example #8
Source File: TreeBackedTypes.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public NullType getNullType() {
  return javacTypes.getNullType();
}
 
Example #9
Source File: TypeMirrorPairVisitor.java    From revapi with Apache License 2.0 4 votes vote down vote up
@Override
public final R visitNull(NullType type, TypeMirror otherType) {
    return otherType instanceof NullType ? visitNull(type, (NullType) otherType) :
        unmatchedAction(type, otherType);
}
 
Example #10
Source File: TypeMirrorPairVisitor.java    From revapi with Apache License 2.0 4 votes vote down vote up
protected R visitNull(NullType type, NullType otherType) {
    return defaultMatchAction(type, otherType);
}
 
Example #11
Source File: MoreTypes.java    From doma with Apache License 2.0 4 votes vote down vote up
@Override
public NullType getNullType() {
  return typeUtils.getNullType();
}
 
Example #12
Source File: TypeScanner8.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public R visitNull(NullType t, P p) {
  return defaultValue;
}
 
Example #13
Source File: StandaloneTypeMirror.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
  switch (kind) {
    case BOOLEAN:
    case BYTE:
    case SHORT:
    case INT:
    case LONG:
    case CHAR:
    case FLOAT:
    case DOUBLE:
      return v.visitPrimitive((PrimitiveType) this, p);
    case PACKAGE:
    case MODULE:
    case VOID:
    case NONE:
      return v.visitNoType((NoType) this, p);
    case NULL:
      return v.visitNull((NullType) this, p);
    case ARRAY:
      return v.visitArray((ArrayType) this, p);
    case DECLARED:
      return v.visitDeclared((DeclaredType) this, p);
    case ERROR:
      return v.visitError((ErrorType) this, p);
    case TYPEVAR:
      return v.visitTypeVariable((TypeVariable) this, p);
    case WILDCARD:
      return v.visitWildcard((WildcardType) this, p);
    case EXECUTABLE:
      return v.visitExecutable((ExecutableType) this, p);
    case OTHER:
      return v.visit(this, p);
    case UNION:
      return v.visitUnion((UnionType) this, p);
    case INTERSECTION:
      return v.visitIntersection((IntersectionType) this, p);
    default:
      throw new AssertionError(String.format("Unknown TypeKind: %s", kind));
  }
}
 
Example #14
Source File: MissingTypeAwareDelegatingTypes.java    From revapi with Apache License 2.0 4 votes vote down vote up
@Override
public NullType getNullType() {
    return types.getNullType();
}
 
Example #15
Source File: TypeScanner8Test.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public Void visitNull(NullType t, Void aVoid) {
  scans.add(t.toString());
  return super.visitNull(t, aVoid);
}
 
Example #16
Source File: TypeExtractor.java    From immutables with Apache License 2.0 4 votes vote down vote up
@Override
public Type visitNull(NullType t, Type.Parameters p) {
  throw new UnsupportedOperationException("NullType type not supported");
}
 
Example #17
Source File: MoreTypes.java    From auto with Apache License 2.0 4 votes vote down vote up
@Override
public NullType visitNull(NullType type, Void ignore) {
  return type;
}
 
Example #18
Source File: PrimitiveValueTypeImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public NullTypeImpl() {
  super("null", NullType.class);
}
 
Example #19
Source File: Util.java    From revapi with Apache License 2.0 4 votes vote down vote up
protected T doVisitNull(NullType t, StringBuilderAndState<S> st) {
    return defaultAction(t, st);
}
 
Example #20
Source File: TypeUtil.java    From j2objc with Apache License 2.0 4 votes vote down vote up
public NullType getNull() {
  return javacTypes.getNullType();
}
 
Example #21
Source File: TypesImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public NullType getNullType() {
    return _env.getFactory().getNullType();
}
 
Example #22
Source File: Factory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public NullType getNullType() {
	return NoTypeImpl.NULL_TYPE;
}
 
Example #23
Source File: TypeRefTypeVisitor.java    From sundrio with Apache License 2.0 4 votes vote down vote up
public TypeRef visitNull(NullType t, Integer dimension) {
    return null;
}
 
Example #24
Source File: IsInvalidTypeVisitor.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean visitNull(NullType t, Void p) {
  return false;
}
 
Example #25
Source File: FindTypeVarScanner.java    From EasyMPermission with MIT License 4 votes vote down vote up
@Override public Void visitNull(NullType t, Void p) {
	return null;
}
 
Example #26
Source File: TurbineTypeMirror.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public boolean equals(Object obj) {
  return obj instanceof NullType;
}
 
Example #27
Source File: ModelFactory.java    From turbine with Apache License 2.0 4 votes vote down vote up
public NullType nullType() {
  return new TurbineNullType(this);
}
 
Example #28
Source File: TurbineTypes.java    From turbine with Apache License 2.0 4 votes vote down vote up
@Override
public NullType getNullType() {
  return factory.nullType();
}
 
Example #29
Source File: ExportNonAccessibleElement.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Boolean visitNull(NullType arg0, Void arg1) {
    return false;
}
 
Example #30
Source File: MoreTypes.java    From auto with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@link NullType} if the {@link TypeMirror} represents the null type or throws an
 * {@link IllegalArgumentException}.
 */
public static NullType asNullType(TypeMirror maybeNullType) {
  return maybeNullType.accept(NullTypeVisitor.INSTANCE, null);
}