Codota Logo
Optional.isPresent
Code IndexAdd Codota to your IDE (free)

How to use
isPresent
method
in
japicmp.util.Optional

Best Java code snippets using japicmp.util.Optional.isPresent (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: siom79/japicmp

private static void toJarArchiveComparatorClassPath(Optional<String> classPathOptional, List<String> comparatorClassPath) {
  if (classPathOptional.isPresent()) {
    String classPathAsString = classPathOptional.get();
    Collections.addAll(comparatorClassPath, classPathAsString.split(File.pathSeparator));
  }
}
origin: siom79/japicmp

@XmlAttribute
public String getTitle() {
  String title;
  if (this.titleOptional.isPresent()) {
    title = this.titleOptional.get();
  } else {
    title = "JApiCmp-Report";
  }
  return title;
}
origin: siom79/japicmp

  public boolean hasChanged() {
    boolean hasChanged = false;
    if (oldTypeOptional.isPresent() && newTypeOptional.isPresent()) {
      if (!oldTypeOptional.get().equals(newTypeOptional.get())) {
        hasChanged = true;
      }
    }
    return hasChanged;
  }
}
origin: siom79/japicmp

public boolean hasChangedFromTo(T oldValue, T newValue) {
  boolean hasChanged = false;
  if (oldModifier.isPresent() && newModifier.isPresent()) {
    if (oldModifier.get() == oldValue && newModifier.get() == newValue) {
      hasChanged = true;
    }
  }
  return hasChanged;
}
origin: siom79/japicmp

  public boolean hasChangedTo(T value) {
    boolean hasChangedTo = false;
    if (newModifier.isPresent()) {
      T newValue = newModifier.get();
      if (value == newValue) {
        hasChangedTo = true;
      }
    }
    return hasChangedTo;
  }
}
origin: siom79/japicmp

  public static <T> String optionalToString(Optional<T> optional) {
    if (optional.isPresent()) {
      return optional.get().toString();
    }
    return N_A;
  }
}
origin: com.github.siom79.japicmp/japicmp

public boolean hasChangedFromTo(T oldValue, T newValue) {
  boolean hasChanged = false;
  if (oldModifier.isPresent() && newModifier.isPresent()) {
    if (oldModifier.get() == oldValue && newModifier.get() == newValue) {
      hasChanged = true;
    }
  }
  return hasChanged;
}
origin: com.github.siom79.japicmp/japicmp

  public boolean hasChangedTo(T value) {
    boolean hasChangedTo = false;
    if (newModifier.isPresent()) {
      T newValue = newModifier.get();
      if (value == newValue) {
        hasChangedTo = true;
      }
    }
    return hasChangedTo;
  }
}
origin: siom79/japicmp

@XmlAttribute(name = "name")
public String getName() {
  String name = "n.a.";
  if (oldFieldOptional.isPresent()) {
    name = oldFieldOptional.get().getName();
  }
  if (newFieldOptional.isPresent()) {
    name = newFieldOptional.get().getName();
  }
  return name;
}
origin: siom79/japicmp

private String guessVersion(File file) {
  String name = file.getName();
  Optional<SemanticVersion> semanticVersion = japicmp.versioning.Version.getSemanticVersion(name);
  String version = semanticVersion.isPresent() ? semanticVersion.get().toString() : "n.a.";
  if (name.contains("SNAPSHOT")) {
    version += "-SNAPSHOT";
  }
  return version;
}
origin: com.github.siom79.japicmp/japicmp

public static String toString(Optional<CtMethod> method) {
  if(method == null ) {
    return OptionalHelper.N_A;
  }
  if(method.isPresent()) {
    return method.get().getLongName();
  }
  return OptionalHelper.N_A;
}
origin: siom79/japicmp

private void buildInterfaceMap(JarArchiveComparator.ArchiveType archiveType, Map<String, CtClass> map, CtClass ctInterface) throws NotFoundException {
  Optional<CtClass> loadedInterfaceOptional = this.jarArchiveComparator.loadClass(archiveType, ctInterface.getName());
  if (loadedInterfaceOptional.isPresent()) {
    CtClass loadedInterface = loadedInterfaceOptional.get();
    CtClass[] loadedInterfaceInterfaces = loadedInterface.getInterfaces();
    for (CtClass additionalInterface : loadedInterfaceInterfaces) {
      map.put(additionalInterface.getName(), additionalInterface);
      buildInterfaceMap(archiveType, map, additionalInterface);
    }
  }
}
origin: siom79/japicmp

private String superclassChangeAsString(JApiSuperclass jApiSuperclass) {
  if (jApiSuperclass.getOldSuperclassName().isPresent() && jApiSuperclass.getNewSuperclassName().isPresent()) {
    return jApiSuperclass.getNewSuperclassName().get() + " (<- " + jApiSuperclass.getOldSuperclassName().get() + ")";
  } else if (jApiSuperclass.getOldSuperclassName().isPresent() && !jApiSuperclass.getNewSuperclassName().isPresent()) {
    return jApiSuperclass.getOldSuperclassName().get();
  } else if (!jApiSuperclass.getOldSuperclassName().isPresent() && jApiSuperclass.getNewSuperclassName().isPresent()) {
    return jApiSuperclass.getNewSuperclassName().get();
  }
  return "n.a.";
}
origin: com.github.siom79.japicmp/japicmp

private Map<String, CtConstructor> createConstructorMap(Optional<CtClass> ctClass) {
  Map<String, CtConstructor> methods = new HashMap<>();
  if (ctClass.isPresent()) {
    for (CtConstructor ctConstructor : ctClass.get().getDeclaredConstructors()) {
      if (options.getFilters().includeBehavior(ctConstructor)) {
        methods.put(ctConstructor.getLongName(), ctConstructor);
      }
    }
  }
  return methods;
}
origin: siom79/japicmp

private boolean fieldTypeMatches(JApiField field1, JApiField field2) {
  boolean matches = true;
  JApiType type1 = field1.getType();
  JApiType type2 = field2.getType();
  if (type1.getNewTypeOptional().isPresent() && type2.getNewTypeOptional().isPresent()) {
    if (!type1.getNewTypeOptional().get().equals(type2.getNewTypeOptional().get())) {
      matches = false;
    }
  }
  return matches;
}
origin: com.github.siom79.japicmp/japicmp

private boolean fieldTypeMatches(JApiField field1, JApiField field2) {
  boolean matches = true;
  JApiType type1 = field1.getType();
  JApiType type2 = field2.getType();
  if (type1.getNewTypeOptional().isPresent() && type2.getNewTypeOptional().isPresent()) {
    if (!type1.getNewTypeOptional().get().equals(type2.getNewTypeOptional().get())) {
      matches = false;
    }
  }
  return matches;
}
origin: siom79/japicmp

  @Override
  public JApiSuperclass callback(JApiClass clazz, Map<String, JApiClass> classMap, JApiChangeStatus changeStatusOfSuperclass) {
    JApiSuperclass ancestor = clazz.getSuperclass();
    if (ancestor.getNewSuperclassName().isPresent() && ancestor.getNewSuperclassName().get().equals(superclass.getOldSuperclassName().get())) {
      matchingAncestors.add(ancestor);
    }
    return ancestor;
  }
});
origin: siom79/japicmp

private void checkIfClassNowCheckedException(JApiClass jApiClass) {
  JApiSuperclass jApiClassSuperclass = jApiClass.getSuperclass();
  if (jApiClassSuperclass.getChangeStatus() == JApiChangeStatus.MODIFIED) {
    if (jApiClassSuperclass.getNewSuperclassName().isPresent()) {
      String fqn = jApiClassSuperclass.getNewSuperclassName().get();
      if ("java.lang.Exception".equals(fqn)) {
        addCompatibilityChange(jApiClass, JApiCompatibilityChange.CLASS_NOW_CHECKED_EXCEPTION);
      }
    }
  }
}
origin: com.github.siom79.japicmp/japicmp

private void checkIfClassNowCheckedException(JApiClass jApiClass) {
  JApiSuperclass jApiClassSuperclass = jApiClass.getSuperclass();
  if (jApiClassSuperclass.getChangeStatus() == JApiChangeStatus.MODIFIED) {
    if (jApiClassSuperclass.getNewSuperclassName().isPresent()) {
      String fqn = jApiClassSuperclass.getNewSuperclassName().get();
      if ("java.lang.Exception".equals(fqn)) {
        addCompatibilityChange(jApiClass, JApiCompatibilityChange.CLASS_NOW_CHECKED_EXCEPTION);
      }
    }
  }
}
origin: siom79/japicmp

public static boolean hasModifierLevelDecreased(JApiHasAccessModifier hasAccessModifier) {
  JApiModifier<AccessModifier> accessModifier = hasAccessModifier.getAccessModifier();
  if (accessModifier.getOldModifier().isPresent() && accessModifier.getNewModifier().isPresent()) {
    AccessModifier oldModifier = accessModifier.getOldModifier().get();
    AccessModifier newModifier = accessModifier.getNewModifier().get();
    if (newModifier.getLevel() < oldModifier.getLevel()) {
      return true;
    }
  }
  return false;
}
japicmp.utilOptionalisPresent

Popular methods of Optional

  • fromNullable
  • absent
  • get
  • of
  • hashCode
  • or

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JFileChooser (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now