Java Code Examples for kotlin.reflect.KProperty

The following examples show how to use kotlin.reflect.KProperty. These examples are extracted from open source projects. 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 Project: zeppelin   Source File: ContextUpdater.java    License: 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 Project: typescript-generator   Source File: TypeParser.java    License: 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 Project: spring-analysis-note   Source File: DependencyDescriptor.java    License: 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 Project: java-technology-stack   Source File: DependencyDescriptor.java    License: 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 Project: zeppelin   Source File: KotlinVariableInfo.java    License: 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 Project: zeppelin   Source File: KotlinVariableInfo.java    License: Apache License 2.0 4 votes vote down vote up
public KProperty<?> getDescriptor() {
  return descriptor;
}