congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.ff4j.exception
Code IndexAdd Tabnine to your IDE (free)

How to use org.ff4j.exception

Best Java code snippets using org.ff4j.exception (Showing top 20 results out of 315)

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Short fromString(String v) {
  try {
    return new Short(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Short.class, nbe);
  }
}
origin: ff4j/ff4j

/**
 * Close resultset.
 * 
 * @param rs
 *            target resultset
 */
public static void closeResultSet(ResultSet rs) {
  try {
    if (rs != null) {
      rs.close();
    }
  } catch (SQLException e) {
    throw new FeatureAccessException("An error occur when closing resultset", e);
  }
}

origin: ff4j/ff4j

/**
 * Validate property name and existence
 *
 * @param uid
 *      target uid
 */
protected void assertPropertyExist(String name) {
  Util.assertHasLength(name);
  if (!existProperty(name)) {
    throw new PropertyNotFoundException(name);
  }
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void delete(String fpId) {
  if (!exist(fpId)) {
    throw new FeatureNotFoundException(fpId);
  }
  getCacheManager().evictFeature(fpId);
}    
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
@Transactional
public void delete(String uid) {
  if (!exist(uid)) throw new FeatureNotFoundException(uid);
  deletePermissions(uid);
  deleteProperties(uid);
  deleteCoreFeature(uid);
}

origin: ff4j/ff4j

/**
 * Utility method to close statement properly.
 * 
 * @param ps
 * 
 */
public static void closeStatement(PreparedStatement ps) {
  try {
    if (ps != null) {
      ps.close();
    }
  } catch (SQLException e) {
    throw new FeatureAccessException("An error occur when closing statement", e);
  }
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void deleteProperty(String name) {
  if (!existProperty(name)) {
    throw new PropertyNotFoundException(name);
  }
  getCacheManager().evictProperty(name);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Integer fromString(String v) {
  try {
    return new Integer(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Integer.class, nbe);
  }
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void delete(String uid) {
  if (!exist(uid)) {
    throw new FeatureNotFoundException(uid);
  }
  // Delete feature key
  getDriver().deleteKey(getDriver().getFeatureKey(uid));
  // Register in the dictionnary
  getDriver().unregisterFeature(uid);
}  

origin: ff4j/ff4j

/**
 * Utility method to close statement properly.
 * 
 * @param ps
 * 
 */
public static void closeStatement(Statement ps) {
  try {
    if (ps != null) {
      ps.close();
    }
  } catch (SQLException e) {
    throw new FeatureAccessException("An error occur when closing statement", e);
  }
}

origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Double fromString(String v) {
  try {
    return new Double(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Double.class, nbe);
  }
}
origin: ff4j/ff4j

   /**
   * Utility method to perform rollback in correct way.
   *
   * @param sqlConn
   *            current sql connection
   */
  public static void rollback(Connection sqlConn) {
    try {
      if (sqlConn != null && !sqlConn.isClosed()) {
        sqlConn.rollback();
      }
    } catch (SQLException e) {
      throw new FeatureAccessException("Cannot rollback database, SQL ERROR", e);
    }
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public BigDecimal fromString(String v) {
  try {
    return new BigDecimal(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + BigDecimal.class, nbe);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Long fromString(String v) {
  try {
    return new Long(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Long.class, nbe);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Float fromString(String v) {
  try {
    return new Float(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Float.class, nbe);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public BigInteger fromString(String v) {
  try {
    return new BigInteger(v);
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + BigInteger.class, nbe);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Byte fromString(String v) {
  if (v == null) return null;
  if (v.length() == 0 || v.length()  > 3) {
    throw new InvalidPropertyTypeException("A byte is a single byte, a single character");
  }
  return v.getBytes()[0];
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public Boolean fromString(String v) {
  if (!Boolean.TRUE.toString().equals(v.toLowerCase()) &&
    !Boolean.FALSE.toString().equals(v) ) {
    throw new InvalidPropertyTypeException("Cannot cast " + v + "to expected " + Boolean.class);
  }
  return new Boolean(v);
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public float getFloat(String key) {
  try {
    return new Float((String) getValue(key)).floatValue();
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot create Float from " + getValue(key), nbe);
  }
}
origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public BigDecimal getBigDecimal(String key) {
  try {
    return new BigDecimal((String) getValue(key));
  } catch(NumberFormatException nbe) {
    throw new InvalidPropertyTypeException("Cannot create BigDecimal from " + getValue(key), nbe);
  }
}
org.ff4j.exception

Most used classes

  • FeatureNotFoundException
    Store could be parameterized to through exception when Feature not found.
  • PropertyAlreadyExistException
    Store could be parameterized to through exception when Feature not found.
  • FeatureAlreadyExistException
    Store could be parameterized to through exception when Feature not found.
  • GroupNotFoundException
    Group operations are available only if group exist, toherwise this exception is raised.
  • PropertyNotFoundException
    Store could be parameterized to through exception when Property not found.
  • PropertyAccessException,
  • AuditAccessException,
  • InvalidPropertyTypeException
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