Tabnine Logo
DoFnSignature$FieldAccessDeclaration
Code IndexAdd Tabnine to your IDE (free)

How to use
DoFnSignature$FieldAccessDeclaration
in
org.apache.beam.sdk.transforms.reflect

Best Java code snippets using org.apache.beam.sdk.transforms.reflect.DoFnSignature$FieldAccessDeclaration (Showing top 5 results out of 315)

origin: org.apache.beam/beam-sdks-java-core

private static Map<String, DoFnSignature.FieldAccessDeclaration> analyzeFieldAccessDeclaration(
  ErrorReporter errors, Class<?> fnClazz) {
 Map<String, FieldAccessDeclaration> fieldAccessDeclarations = new HashMap<>();
 for (Field field : declaredFieldsWithAnnotation(DoFn.FieldAccess.class, fnClazz, DoFn.class)) {
  field.setAccessible(true);
  DoFn.FieldAccess fieldAccessAnnotation = field.getAnnotation(DoFn.FieldAccess.class);
  if (!Modifier.isFinal(field.getModifiers())) {
   errors.throwIllegalArgument(
     "Non-final field %s annotated with %s. Field access declarations must be final.",
     field.toString(), DoFn.FieldAccess.class.getSimpleName());
   continue;
  }
  Class<?> fieldAccessRawType = field.getType();
  if (!fieldAccessRawType.equals(FieldAccessDescriptor.class)) {
   errors.throwIllegalArgument(
     "Field %s annotated with %s, but the value was not of type %s",
     field.toString(),
     DoFn.FieldAccess.class.getSimpleName(),
     FieldAccessDescriptor.class.getSimpleName());
  }
  fieldAccessDeclarations.put(
    fieldAccessAnnotation.value(),
    FieldAccessDeclaration.create(fieldAccessAnnotation.value(), field));
 }
 return fieldAccessDeclarations;
}
origin: org.apache.beam/beam-sdks-java-core

public void addFieldAccessDeclaration(FieldAccessDeclaration decl) {
 fieldAccessDeclarations.put(decl.id(), decl);
}
origin: org.apache.beam/beam-runners-core-java

checkArgument(
  fieldAccessDeclaration != null, "No FieldAccessDeclaration defined with id", id);
checkArgument(fieldAccessDeclaration.field().getType().equals(FieldAccessDescriptor.class));
try {
 fieldAccessDescriptor = (FieldAccessDescriptor) fieldAccessDeclaration.field().get(fn);
} catch (IllegalAccessException e) {
 throw new RuntimeException(e);
origin: org.apache.beam/beam-sdks-java-core

checkArgument(
  fieldAccessDeclaration != null, "No FieldAccessDeclaration  defined with id", id);
checkArgument(fieldAccessDeclaration.field().getType().equals(FieldAccessDescriptor.class));
try {
 fieldAccessDescriptor = (FieldAccessDescriptor) fieldAccessDeclaration.field().get(fn);
} catch (IllegalAccessException e) {
 throw new RuntimeException(e);
origin: org.apache.beam/beam-sdks-java-core

@Test
public void testFieldAccess() throws IllegalAccessException {
 FieldAccessDescriptor descriptor = FieldAccessDescriptor.withFieldNames("foo", "bar");
 DoFn<String, String> doFn =
   new DoFn<String, String>() {
    @FieldAccess("foo")
    final FieldAccessDescriptor fieldAccess = descriptor;
    @ProcessElement
    public void process(@FieldAccess("foo") Row row) {}
   };
 DoFnSignature sig = DoFnSignatures.getSignature(doFn.getClass());
 assertThat(sig.fieldAccessDeclarations().get("foo"), notNullValue());
 Field field = sig.fieldAccessDeclarations().get("foo").field();
 assertThat(field.getName(), equalTo("fieldAccess"));
 assertThat(field.get(doFn), equalTo(descriptor));
 assertThat(sig.processElement().getRowParameter(), notNullValue());
}
org.apache.beam.sdk.transforms.reflectDoFnSignature$FieldAccessDeclaration

Javadoc

Decscribes a field access declaration. This is used when the input PCollection has an associated schema, to specify exactly which fields in the row are accessed. Any fields not specified are not guaranteed to be present when reading the row.

Most used methods

  • field
  • create
  • id

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getResourceAsStream (ClassLoader)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now