kotlin.reflect.KProperty Java Examples

The following examples show how to use kotlin.reflect.KProperty. 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: ContextUpdater.java    From zeppelin with Apache License 2.0 6 votes vote down vote up
private void findVariables(Field[] fields, Object o) throws IllegalAccessException {
  for (Field field : fields) {
    String fieldName = field.getName();
    if (fieldName.contains("$$implicitReceiver")) {
      continue;
    }

    field.setAccessible(true);
    Object value = field.get(o);
    if (!fieldName.contains("script$")) {
      KProperty<?> descriptor = ReflectJvmMapping.getKotlinProperty(field);
      if (descriptor != null) {
        vars.putIfAbsent(fieldName, new KotlinVariableInfo(value, descriptor));
      }
    }
  }
}
 
Example #2
Source File: TypeParser.java    From typescript-generator with MIT License 5 votes vote down vote up
@Override
public Type getFieldType(Field field) {
    final KProperty<?> kProperty = ReflectJvmMapping.getKotlinProperty(field);
    if (kProperty != null) {
        return getType(kProperty.getReturnType(), new LinkedHashMap<>());
    }
    return javaTypeParser.getFieldType(field);
}
 
Example #3
Source File: DependencyDescriptor.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Check whether the specified {@link Field} represents a nullable Kotlin type or not.
 */
public static boolean isNullable(Field field) {
	KProperty<?> property = ReflectJvmMapping.getKotlinProperty(field);
	return (property != null && property.getReturnType().isMarkedNullable());
}
 
Example #4
Source File: DependencyDescriptor.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Check whether the specified {@link Field} represents a nullable Kotlin type or not.
 */
public static boolean isNullable(Field field) {
	KProperty<?> property = ReflectJvmMapping.getKotlinProperty(field);
	return (property != null && property.getReturnType().isMarkedNullable());
}
 
Example #5
Source File: KotlinVariableInfo.java    From zeppelin with Apache License 2.0 4 votes vote down vote up
public KotlinVariableInfo(Object value, KProperty<?> descriptor) {
  this.value = value;
  this.descriptor = descriptor;
}
 
Example #6
Source File: KotlinVariableInfo.java    From zeppelin with Apache License 2.0 4 votes vote down vote up
public KProperty<?> getDescriptor() {
  return descriptor;
}